Skip to content

Commit

Permalink
fsck.f2fs: don't finish zones if it's not open
Browse files Browse the repository at this point in the history
Should finish zones if they are open.

Reviewed-by: Daeho Jeong <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Jaegeuk Kim committed Aug 13, 2024
1 parent f6f6448 commit 3aefe2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/f2fs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,8 @@ blk_zone_cond_str(struct blk_zone *blkz)
* Handle kernel zone capacity support
*/
#define blk_zone_empty(z) (blk_zone_cond(z) == BLK_ZONE_COND_EMPTY)
#define blk_zone_open(z) (blk_zone_cond(z) == BLK_ZONE_COND_IMP_OPEN || \
blk_zone_cond(z) == BLK_ZONE_COND_EXP_OPEN)
#define blk_zone_sector(z) (z)->start
#define blk_zone_length(z) (z)->len
#define blk_zone_wp_sector(z) (z)->wp
Expand Down
5 changes: 3 additions & 2 deletions lib/libf2fs_zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ int f2fs_finish_zone(int i, void *blkzone)
struct blk_zone_range range;
int ret;

if (!blk_zone_seq(blkz) || blk_zone_empty(blkz))
if (!blk_zone_seq(blkz) || !blk_zone_open(blkz))
return 0;

/* Non empty sequential zone: finish */
Expand All @@ -522,7 +522,8 @@ int f2fs_finish_zone(int i, void *blkzone)
ret = ioctl(dev->fd, BLKFINISHZONE, &range);
if (ret != 0) {
ret = -errno;
ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d\n", errno);
ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d, status=%s\n",
errno, blk_zone_cond_str(blkz));
}

return ret;
Expand Down

0 comments on commit 3aefe2d

Please sign in to comment.