linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs-tools: skip finishing zones for current zones
@ 2023-12-04 19:22 Daeho Jeong
  0 siblings, 0 replies; only message in thread
From: Daeho Jeong @ 2023-12-04 19:22 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

Do not finishing zones for current zones.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Fixes: 06a25b021d15 ("f2fs-tools: make six open zone check resilient")
---
 fsck/fsck.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 8acb822..5121a56 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -3265,8 +3265,9 @@ static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque)
 	struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
 	block_t zone_block, wp_block, wp_blkoff;
 	unsigned int zone_segno, wp_segno;
-	int ret, last_valid_blkoff;
+	int i, ret, last_valid_blkoff;
 	int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT;
+	unsigned int segs_per_zone = sbi->segs_per_sec * sbi->secs_per_zone;
 
 	if (blk_zone_conv(blkz))
 		return 0;
@@ -3309,6 +3310,15 @@ static int chk_and_fix_wp_with_sit(int UNUSED(i), void *blkzone, void *opaque)
 		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)
+			return 0;
+	}
+
 	/*
 	 * If valid blocks exist in the zone beyond the write pointer, it
 	 * is a bug. No need to fix because the zone is not selected for the
-- 
2.43.0.rc2.451.g8631bc7472-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-04 21:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04 19:22 [f2fs-dev] [PATCH] f2fs-tools: skip finishing zones for current zones Daeho Jeong

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).