summaryrefslogtreecommitdiff
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorWu Bo <bo.wu@vivo.com>2023-12-28 20:25:07 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2024-02-05 18:58:38 -0800
commit0d8c7542f93a06e68c05a1a8ad47c52ea7cc3e95 (patch)
tree68d8d77f7df15a0b458f59bcb03a9c7fe3d17f8f /fs/f2fs/segment.c
parentc10e8558d49d4ec62d78af1cf2852a1640bea9f7 (diff)
f2fs: check free sections before disable checkpoint
'f2fs_is_checkpoint_ready()' checks free sections. If there is not enough free sections, most f2fs operations will return -ENOSPC when checkpoint is disabled. It would be better to check free sections before disable checkpoint. Signed-off-by: Wu Bo <bo.wu@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 4c8836ded90f..f0f12b1eddc8 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -906,6 +906,8 @@ int f2fs_disable_cp_again(struct f2fs_sb_info *sbi, block_t unusable)
if (is_sbi_flag_set(sbi, SBI_CP_DISABLED_QUICK) &&
dirty_segments(sbi) > ovp_hole_segs)
return -EAGAIN;
+ if (has_not_enough_free_secs(sbi, 0, 0))
+ return -EAGAIN;
return 0;
}