Skip to content

Commit 7f262f7

Browse files
mcgrofJaegeuk Kim
authored andcommitted
f2fs: ensure only power of 2 zone sizes are allowed
F2FS zoned support has power of 2 zone size assumption in many places such as in __f2fs_issue_discard_zone, init_blkz_info. As the power of 2 requirement has been removed from the block layer, explicitly add a condition in f2fs to allow only power of 2 zone size devices. This condition will be relaxed once those calculation based on power of 2 is made generic. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent d46db45 commit 7f262f7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/f2fs/super.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,6 +3658,10 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
36583658
return 0;
36593659

36603660
zone_sectors = bdev_zone_sectors(bdev);
3661+
if (!is_power_of_2(zone_sectors)) {
3662+
f2fs_err(sbi, "F2FS does not support non power of 2 zone sizes\n");
3663+
return -EINVAL;
3664+
}
36613665

36623666
if (sbi->blocks_per_blkz && sbi->blocks_per_blkz !=
36633667
SECTOR_TO_BLOCK(zone_sectors))

0 commit comments

Comments
 (0)