diff mbox series

[f2fs-dev] f2fs: check free sections before disable checkpoint

Message ID 20231229032507.2016012-1-bo.wu@vivo.com (mailing list archive)
State Accepted
Commit e2f29120ff1f25b3bd59310b0443ce7f049c5f0a
Headers show
Series [f2fs-dev] f2fs: check free sections before disable checkpoint | expand

Commit Message

Wu Bo Dec. 29, 2023, 3:25 a.m. UTC
'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>
---
 fs/f2fs/segment.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chao Yu Jan. 12, 2024, 1:20 a.m. UTC | #1
On 2023/12/29 11:25, Wu Bo wrote:
> '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>

Thanks,
patchwork-bot+f2fs@kernel.org Jan. 29, 2024, 8:29 p.m. UTC | #2
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Thu, 28 Dec 2023 20:25:07 -0700 you wrote:
> '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>
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: check free sections before disable checkpoint
    https://git.kernel.org/jaegeuk/f2fs/c/e2f29120ff1f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 727d016318f9..8f8c0bb75be1 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;
 }