All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yangyang Zang <zangyangyang66@gmail.com>
To: jaegeuk@kernel.org, chao@kernel.org
Cc: Yangyang Zang <zangyangyang1@xiaomi.com>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 2/2] fsck.f2fs: read each sit block only once in build_sit_entries
Date: Wed,  1 Jul 2026 17:28:50 +0800	[thread overview]
Message-ID: <20260701092850.1247010-2-zangyangyang1@xiaomi.com> (raw)
In-Reply-To: <20260701092850.1247010-1-zangyangyang1@xiaomi.com>

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 <zangyangyang1@xiaomi.com>
---
 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2026-07-01  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  9:28 [f2fs-dev] [PATCH 1/2] fsck.f2fs: fix meta readahead after non-contiguous blocks Yangyang Zang
2026-07-01  9:28 ` Yangyang Zang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260701092850.1247010-2-zangyangyang1@xiaomi.com \
    --to=zangyangyang66@gmail.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=zangyangyang1@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.