Skip to contentSkip to conversation

f2fs: fix CURSEG_HOT_DATA left space check

PATCH Applied mason.zhang 4 participants 5 messages Aug 6, 2025 – Aug 20, 2025 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 f2fs: fix CURSEG_HOT_DATA left space check

This fix combines the space check for data_blocks and dent_blocks when verifying HOT_DATA segment capacity, preventing potential insufficient space issues during checkpoint.

Fixes bf34c93d2645 ("f2fs: check curseg space before foreground GC")
---
 fs/f2fs/segment.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.h +1 -1
index db619fd2f51a..d8dae0049b6a 100644
@@ -649,7 +649,7 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
 				get_ckpt_valid_blocks(sbi, segno, true);
 	}
 
-	if (dent_blocks > left_blocks)
+	if (dent_blocks + data_blocks > left_blocks)
 		return false;
 	return true;
 }
Signature · 1 line
2.48.1
maintainer Reviewed-by on v3 1/1
#1 lore raw
Quoted 6 lines · mason.zhang

This fix combines the space check for data_blocks and dent_blocks when verifying HOT_DATA segment capacity, preventing potential insufficient space issues during checkpoint.

Fixes bf34c93d2645 ("f2fs: check curseg space before foreground GC")

Thanks,

#2 lore raw
In reply to mason.zhang
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 8 lines · On Wed, 6 Aug 2025 20:32:36 +0800 you wrote:

This fix combines the space check for data_blocks and dent_blocks when verifying HOT_DATA segment capacity, preventing potential insufficient space issues during checkpoint.

Fixes bf34c93d2645 ("f2fs: check curseg space before foreground GC")

[...]

Here is the summary with links:
- [f2fs-dev,v3] f2fs: fix CURSEG_HOT_DATA left space check

    https://git.kernel.org/jaegeuk/f2fs/c/066694aac462

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer
#3 lore raw
In reply to mason.zhang
Quoted 6 lines · mason.zhang

This fix combines the space check for data_blocks and dent_blocks when verifying HOT_DATA segment capacity, preventing potential insufficient space issues during checkpoint.

Fixes bf34c93d2645 ("f2fs: check curseg space before foreground GC")

It breaks f2fs/005 of xfstests, can you please take a look?

Thanks,

Quoted 17 lines
---
 fs/f2fs/segment.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.h +1 -1
index db619fd2f51a..d8dae0049b6a 100644
@@ -649,7 +649,7 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
 				get_ckpt_valid_blocks(sbi, segno, true);
 	}
 
-	if (dent_blocks > left_blocks)
+	if (dent_blocks + data_blocks > left_blocks)
 		return false;
 	return true;
 }
maintainer
#4 lore raw
Quoted 9 lines · Chao Yu
Quoted 6 lines · mason.zhang

This fix combines the space check for data_blocks and dent_blocks when verifying HOT_DATA segment capacity, preventing potential insufficient space issues during checkpoint.

Fixes bf34c93d2645 ("f2fs: check curseg space before foreground GC")

It breaks f2fs/005 of xfstests, can you please take a look?

Ah, this was why I got failure. I'll drop this first.

Quoted 21 lines

Thanks,

Quoted 17 lines
---
 fs/f2fs/segment.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.h +1 -1
index db619fd2f51a..d8dae0049b6a 100644
@@ -649,7 +649,7 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
 				get_ckpt_valid_blocks(sbi, segno, true);
 	}
 
-	if (dent_blocks > left_blocks)
+	if (dent_blocks + data_blocks > left_blocks)
 		return false;
 	return true;
 }