Re: [PATCH 09/13] block: introduce blkdev_report_zones_cached()

Damien Le Moal
2025-11-03T06:13:00Z

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