diff options
author | Zhiguo Niu <zhiguo.niu@unisoc.com> | 2024-03-11 08:48:54 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2024-03-13 02:25:17 +0100 |
commit | 245930617c9bd85330c78e1a70775e1f61b12f7a (patch) | |
tree | aa6efdbb215c654ff0046b8c4245b008253a9de1 /fs/f2fs/gc.c | |
parent | f2fs: unify the error handling of f2fs_is_valid_blkaddr (diff) | |
download | linux-245930617c9bd85330c78e1a70775e1f61b12f7a.tar.xz linux-245930617c9bd85330c78e1a70775e1f61b12f7a.zip |
f2fs: fix to handle error paths of {new,change}_curseg()
{new,change}_curseg() may return error in some special cases,
error handling should be did in their callers, and this will also
facilitate subsequent error path expansion in {new,change}_curseg().
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r-- | fs/f2fs/gc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index ca1bf412b882..8852814dab7f 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -2035,8 +2035,11 @@ static int free_segment_range(struct f2fs_sb_info *sbi, mutex_unlock(&DIRTY_I(sbi)->seglist_lock); /* Move out cursegs from the target range */ - for (type = CURSEG_HOT_DATA; type < NR_CURSEG_PERSIST_TYPE; type++) - f2fs_allocate_segment_for_resize(sbi, type, start, end); + for (type = CURSEG_HOT_DATA; type < NR_CURSEG_PERSIST_TYPE; type++) { + err = f2fs_allocate_segment_for_resize(sbi, type, start, end); + if (err) + goto out; + } /* do GC to move out valid blocks in the range */ err = f2fs_gc_range(sbi, start, end, dry_run, 0); |