diff options
author | Daeho Jeong <daehojeong@google.com> | 2023-12-04 11:22:51 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2023-12-04 17:17:06 -0800 |
commit | 1cbaa9069ecbf5595e757d6002cc5ac5aae09e36 (patch) | |
tree | 832e56b0a1b0e0af8fca419d5642221c9751e376 | |
parent | f2ae743ca93f3bc090c82ee1e7d30ab0fc109ebc (diff) | |
download | f2fs-tools-1cbaa9069ecbf5595e757d6002cc5ac5aae09e36.tar.gz |
f2fs-tools: skip finishing zones for current zones
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")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/fsck.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c index 9d07f0e..e93db82 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -3268,8 +3268,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; @@ -3312,6 +3313,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 |