ANDROID: block: Support npo2 zone sizes
Checking if a given sector is aligned to a zone is a common operation that is performed for zoned devices. Add bdev_is_zone_start helper to check for this instead of opencoding it everywhere. Convert the calculations on zone size to be generic instead of relying on power-of-2(po2) based arithmetic in the block layer using the helpers wherever possible. The only hot path affected by this change for zoned devices with po2 zone size is in blk_check_zone_append() but bdev_is_zone_start() helper is used to optimize the calculation for po2 zone sizes. Finally, allow zoned devices with non po2 zone sizes provided that their zone capacity and zone size are equal. The main motivation to allow zoned devices with non po2 zone size is to remove the unmapped LBA between zone capacity and zone size for devices that cannot have a po2 zone capacity. Signed-off-by:Pankaj Raghav <p.raghav@samsung.com> Bug: 269471019 Bug: 415836627 Link: https://lore.kernel.org/linux-block/20220923173618.6899-4-p.raghav@samsung.com/ Change-Id: I2ecc186d7b14f5508b6abfe9821526d39a21d7e4 [ bvanassche: ported this patch to kernel 6.12 ] Signed-off-by:
Bart Van Assche <bvanassche@google.com>
Loading
Please sign in to comment