[PATCH 09/13] block: introduce blkdev_report_zones_cached()
Damien Le Moal
dlemoal at kernel.org
Sun Nov 2 22:12:56 PST 2025
On 11/1/25 06:53, Bart Van Assche wrote:
>> + for (sector = ALIGN(sector, zone_sectors);
>> + sector < capacity && idx < nr_zones;
>> + sector += zone_sectors, idx++) {
>
> Please change "sector = ALIGN(sector, zone_sectors)" into an something
> based on bdev_offset_from_zone_start(), e.g. the following code:
>
> sector += zone_sectors - 1;
> sector -= bdev_offset_from_zone_start(bdev, sector);
Why ? That is a lot harder to understand that what we are doing is align to the
zone start. And your proposed code is not correct anyway as we would miss one
zone (the zone containing sector) if sector is not already aligned to the zone
start.
--
Damien Le Moal
Western Digital Research
More information about the Linux-nvme
mailing list