> I grepped the kernel for bdev_zone_sectors and there are more assumptions > that bdev_zone_sectors is a power of 2. > > drivers/md/dm-zone.c: sector_t mask = bdev_zone_sectors(disk->part0) - 1 > drivers/nvme/target/zns.c: if (get_capacity(bd_disk) & (bdev_zone_sectors(ns->bdev) - 1)) > drivers/nvme/target/zns.c: if (sect & (bdev_zone_sectors(req->ns->bdev) - 1)) { > fs/zonefs/super.c: sbi->s_zone_sectors_shift = ilog2(bdev_zone_sectors(sb->s_bdev)); > fs/btrfs/zoned.c: return (sector_t)zone_number << ilog2(bdev_zone_sectors(bdev)); > fs/btrfs/zoned.c: zone_info->zone_size_shift = ilog2(zone_info->zone_size); > include/linux/blkdev.h: return sector & (bdev_zone_sectors(bdev) - 1); > fs/f2fs/super.c: if (nr_sectors & (zone_sectors - 1)) > > So, if we want to support non-power-of-2 zone size, we need some > systematic fix. Now it appears that Linux doesn't even attempt to support > disks non-power-of-2 zone size. FYI, I sent the patches to add non-power-of-2 zone size support to the block layer [0] a long time back. Sadly, it was not finally merged upstream. Android wanted this support, so for now it is in the Android tree. -- Pankaj Raghav [0] https://lore.kernel.org/linux-block/20220923173618.6899-1-p.raghav@xxxxxxxxxxx/