Skip to contentSkip to conversation

f2fs: fix to use correct segment type in f2fs_allocate_data_block()

PATCH Applied Chao Yu 2 participants 2 messages Feb 25, 2024 – Mar 4, 2024 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 1/1 f2fs: fix to use correct segment type in f2fs_allocate_data_block()

@type in f2fs_allocate_data_block() indicates log header's type, it can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later one, fix it.

Fixes 093749e296e2 ("f2fs: support age threshold based garbage collection")

---
v2:
- use curseg->seg_type instead of se->type due to se is valid only in atgc allocation context.

 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +2 -2
index d4f228e6f771..847fe0b7f29f 100644
@@ -3538,12 +3538,12 @@ int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 	locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr));
 	locate_dirty_segment(sbi, GET_SEGNO(sbi, *new_blkaddr));
 
-	if (IS_DATASEG(type))
+	if (IS_DATASEG(curseg->seg_type))
 		atomic64_inc(&sbi->allocated_data_blocks);
 
 	up_write(&sit_i->sentry_lock);
 
-	if (page && IS_NODESEG(type)) {
+	if (page && IS_NODESEG(curseg->seg_type)) {
 		fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg));
 
 		f2fs_inode_chksum_set(sbi, page);
Signature · 1 line
2.40.1
#1 lore raw
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 9 lines · On Sun, 25 Feb 2024 14:36:28 +0800 you wrote:

@type in f2fs_allocate_data_block() indicates log header's type, it can be CURSEG_COLD_DATA_PINNED or CURSEG_ALL_DATA_ATGC, rather than type of data/node, however IS_DATASEG()/IS_NODESEG() only accept later one, fix it.

Fixes 093749e296e2 ("f2fs: support age threshold based garbage collection")

[...]

Here is the summary with links:
- [f2fs-dev,v2] f2fs: fix to use correct segment type in f2fs_allocate_data_block()

    https://git.kernel.org/jaegeuk/f2fs/c/732485823782

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html