From: Daeho Jeong <daeho43@gmail.com>
To: linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: [f2fs-dev] [PATCH] f2fs-tools: reset only current zones
Date: Fri, 8 Mar 2024 10:16:46 -0800 [thread overview]
Message-ID: <20240308181646.70959-1-daeho43@gmail.com> (raw)
From: Daeho Jeong <daehojeong@google.com>
Send reset commands to only current zones and finish the others.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fsck/fsck.c | 53 +++++++++++++++++++++++++++--------------------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/fsck/fsck.c b/fsck/fsck.c
index 3461a52..5b32d1f 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -3288,38 +3288,39 @@ static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque)
last_valid_blkoff = last_vblk_off_in_zone(sbi, zone_segno);
- /*
- * When there is no valid block in the zone, check write pointer is
- * at zone start. If not, reset the write pointer.
- */
- if (last_valid_blkoff < 0 &&
- blk_zone_wp_sector(blkz) != blk_zone_sector(blkz)) {
- if (!c.fix_on) {
- MSG(0, "Inconsistent write pointer: wp[0x%x,0x%x]\n",
- wp_segno, wp_blkoff);
- fsck->chk.wp_inconsistent_zones++;
- return 0;
- }
-
- FIX_MSG("Reset write pointer of zone at segment 0x%x",
- zone_segno);
- ret = f2fs_reset_zone(wpd->dev_index, blkz);
- if (ret) {
- printf("[FSCK] Write pointer reset failed: %s\n",
- dev->path);
- return ret;
- }
- fsck->chk.wp_fixed = 1;
- return 0;
- }
-
/* if a curseg points to the zone, do not finishing zone */
for (i = 0; i < NO_CHECK_TYPE; i++) {
struct curseg_info *cs = CURSEG_I(sbi, i);
if (zone_segno <= cs->segno &&
- cs->segno < zone_segno + segs_per_zone)
+ cs->segno < zone_segno + segs_per_zone) {
+ /*
+ * When there is no valid block in the zone, check
+ * write pointer is at zone start. If not, reset
+ * the write pointer.
+ */
+ if (last_valid_blkoff < 0 &&
+ blk_zone_wp_sector(blkz) != blk_zone_sector(blkz)) {
+ if (!c.fix_on) {
+ MSG(0, "Inconsistent write pointer: "
+ "wp[0x%x,0x%x]\n",
+ wp_segno, wp_blkoff);
+ fsck->chk.wp_inconsistent_zones++;
+ return 0;
+ }
+
+ FIX_MSG("Reset write pointer of zone at "
+ "segment 0x%x", zone_segno);
+ ret = f2fs_reset_zone(wpd->dev_index, blkz);
+ if (ret) {
+ printf("[FSCK] Write pointer reset "
+ "failed: %s\n", dev->path);
+ return ret;
+ }
+ fsck->chk.wp_fixed = 1;
+ }
return 0;
+ }
}
/*
--
2.44.0.278.ge034bb2e1d-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
reply other threads:[~2024-03-08 18:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240308181646.70959-1-daeho43@gmail.com \
--to=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).