Message ID | 20241106000216.1633346-1-weilongping@oppo.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2] block: fix the initial value of wp_offset for npo2 zone size | expand |
On 11/5/24 4:02 PM, LongPing Wei wrote: > The zone size of Zoned UFS may be not power of 2. > It should be better to get wp_offset by bdev_offset_from_zone_start > instead of open-coding it. Hi LongPing, As Christoph already explained, only zone sizes that are a power of 2 are supported by the Linux kernel. Hence, patches that mention npo2 zone size support in the patch description probably will be ignored. I'm wondering if this patch would become acceptable if the description would be changed into something like "Call bdev_offset_from_zone_start() instead of open-coding it." Thanks, Bart.
On 11/6/24 12:16, Bart Van Assche wrote: > On 11/5/24 4:02 PM, LongPing Wei wrote: >> The zone size of Zoned UFS may be not power of 2. >> It should be better to get wp_offset by bdev_offset_from_zone_start >> instead of open-coding it. > > Hi LongPing, > > As Christoph already explained, only zone sizes that are a power of 2 > are supported by the Linux kernel. Hence, patches that mention npo2 > zone size support in the patch description probably will be ignored. > > I'm wondering if this patch would become acceptable if the description > would be changed into something like "Call bdev_offset_from_zone_start() > instead of open-coding it." Agreed. That is a much better commit message. > > Thanks, > > Bart.
diff --git a/block/blk-zoned.c b/block/blk-zoned.c index af19296fa50d..77a448952bbd 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -537,7 +537,7 @@ static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk, spin_lock_init(&zwplug->lock); zwplug->flags = 0; zwplug->zone_no = zno; - zwplug->wp_offset = sector & (disk->queue->limits.chunk_sectors - 1); + zwplug->wp_offset = bdev_offset_from_zone_start(disk->part0, sector); bio_list_init(&zwplug->bio_list); INIT_WORK(&zwplug->bio_work, blk_zone_wplug_bio_work); zwplug->disk = disk;
The zone size of Zoned UFS may be not power of 2. It should be better to get wp_offset by bdev_offset_from_zone_start instead of open-coding it. Fixes: dd291d77cc90 ("block: Introduce zone write plugging") Signed-off-by: LongPing Wei <weilongping@oppo.com> --- v2: Fix compile error. v1: https://lore.kernel.org/linux-block/20220923173618.6899-2-p.raghav@samsung.com/ bdev_nr_zones/disk_zone_no could support npo2 zone size by this commit. --- block/blk-zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: c2ee9f594da826bea183ed14f2cc029c719bf4da