[f2fs-dev] [PATCH 2/2] fsck.f2fs: read each sit block only once in build_sit_entries

Yangyang Zang <[email protected]>
Newsgroups net.sourceforge.lists.linux-f2fs-devel
Message-ID <[email protected]>
build_sit_entries() calls get_current_sit_page() for every entry while
scanning consecutive sit entries. Since each sit block contains multiple
consecutive sit entries, this causes the same sit block to be read and
copied repeatedly.

Read the sit block only when entering a new sit block, and reuse the
cached block for the remaining sit entries in that block.

Signed-off-by: Yangyang Zang <[email protected]>
---
 fsck/mount.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index ea171a4c97c5..4c63c2d185ba 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2676,7 +2676,8 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
 		for (; segno < end && segno < MAIN_SEGS(sbi); segno++) {
 			se = &sit_i->sentries[segno];
 
-			get_current_sit_page(sbi, segno, sit_blk);
+			if (SIT_ENTRY_OFFSET(sit_i, segno) == 0)
+				get_current_sit_page(sbi, segno, sit_blk);
 			sit = sit_blk->entries[SIT_ENTRY_OFFSET(sit_i, segno)];
 
 			check_block_count(sbi, segno, &sit);
-- 
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.