Message ID | 20230106083317.93938-6-p.raghav@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block zoned cleanups | expand |
Given that we don't even support the non pow of 2 zones in the block layer I don't see why this is needed. But either way it doesn't really seem to fit into this series.
On 2023-01-10 07:56, Christoph Hellwig wrote: > Given that we don't even support the non pow of 2 zones in the block > layer I don't see why this is needed. But either way it doesn't really > seem to fit into this series. You are right. It is just an extra stop gap, but it is not needed as block layer does not support pow of 2 anyway! I will remove this patch in the next version.
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c index 95b132b52f33..9325bf5dee81 100644 --- a/drivers/md/dm-zoned-target.c +++ b/drivers/md/dm-zoned-target.c @@ -792,6 +792,10 @@ static int dmz_fixup_devices(struct dm_target *ti) return -EINVAL; } zone_nr_sectors = bdev_zone_sectors(bdev); + if (!is_power_of_2(zone_nr_sectors)) { + ti->error = "Zone size is not a power-of-2 number of sectors"; + return -EINVAL; + } zoned_dev->zone_nr_sectors = zone_nr_sectors; zoned_dev->nr_zones = bdev_nr_zones(bdev); } @@ -804,6 +808,10 @@ static int dmz_fixup_devices(struct dm_target *ti) return -EINVAL; } zoned_dev->zone_nr_sectors = bdev_zone_sectors(bdev); + if (!is_power_of_2(zoned_dev->zone_nr_sectors)) { + ti->error = "Zone size is not a power-of-2 number of sectors"; + return -EINVAL; + } zoned_dev->nr_zones = bdev_nr_zones(bdev); }