mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
f2fs: fix to check return value __allocate_new_segment
__allocate_new_segment may return error when get_new_segment fails, so its caller should check its return value. Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
36959d18c3
commit
28f66cc654
3 changed files with 7 additions and 4 deletions
|
@ -3705,7 +3705,7 @@ void f2fs_allocate_segment_for_resize(struct f2fs_sb_info *sbi, int type,
|
||||||
unsigned int start, unsigned int end);
|
unsigned int start, unsigned int end);
|
||||||
int f2fs_allocate_new_section(struct f2fs_sb_info *sbi, int type, bool force);
|
int f2fs_allocate_new_section(struct f2fs_sb_info *sbi, int type, bool force);
|
||||||
int f2fs_allocate_pinning_section(struct f2fs_sb_info *sbi);
|
int f2fs_allocate_pinning_section(struct f2fs_sb_info *sbi);
|
||||||
void f2fs_allocate_new_segments(struct f2fs_sb_info *sbi);
|
int f2fs_allocate_new_segments(struct f2fs_sb_info *sbi);
|
||||||
int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range);
|
int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range);
|
||||||
bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi,
|
bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi,
|
||||||
struct cp_control *cpc);
|
struct cp_control *cpc);
|
||||||
|
|
|
@ -851,7 +851,7 @@ next:
|
||||||
f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);
|
f2fs_ra_meta_pages_cond(sbi, blkaddr, ra_blocks);
|
||||||
}
|
}
|
||||||
if (!err)
|
if (!err)
|
||||||
f2fs_allocate_new_segments(sbi);
|
err = f2fs_allocate_new_segments(sbi);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3163,16 +3163,19 @@ retry:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void f2fs_allocate_new_segments(struct f2fs_sb_info *sbi)
|
int f2fs_allocate_new_segments(struct f2fs_sb_info *sbi)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
f2fs_down_read(&SM_I(sbi)->curseg_lock);
|
f2fs_down_read(&SM_I(sbi)->curseg_lock);
|
||||||
down_write(&SIT_I(sbi)->sentry_lock);
|
down_write(&SIT_I(sbi)->sentry_lock);
|
||||||
for (i = CURSEG_HOT_DATA; i <= CURSEG_COLD_DATA; i++)
|
for (i = CURSEG_HOT_DATA; i <= CURSEG_COLD_DATA; i++)
|
||||||
__allocate_new_segment(sbi, i, false, false);
|
err += __allocate_new_segment(sbi, i, false, false);
|
||||||
up_write(&SIT_I(sbi)->sentry_lock);
|
up_write(&SIT_I(sbi)->sentry_lock);
|
||||||
f2fs_up_read(&SM_I(sbi)->curseg_lock);
|
f2fs_up_read(&SM_I(sbi)->curseg_lock);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi,
|
bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi,
|
||||||
|
|
Loading…
Add table
Reference in a new issue