[PATCH 08/13] block: introduce blkdev_get_zone_info()
Damien Le Moal
dlemoal at kernel.org
Sun Nov 2 22:08:30 PST 2025
On 11/1/25 06:40, Bart Van Assche wrote:
>> +/**
>> + * blkdev_get_zone_info - Get a zone information from cached data
>
> "Get a zone information" -> "Get zone information"
>
>> + sector = sector & (~(zone_sectors - 1));
>
> Please consider changing the above assignment into:
>
> sector -= bdev_offset_from_zone_start(bdev, sector);
That is a lot more arithmetic for the same thing.
If anything, I think this should be:
sector = ALIGN(sector, zone_sectors);
>> + /*
>> + * If the zone does not have a zone write plug, it is either full or
>> + * empty, as we otherwise would have a zone write plug for it. In this
>> + * case, set the write pointer accordingly and report the zone.
>> + * Otherwise, if we have a zone write plug, use it.
>> + */
>> + zwplug = disk_get_zone_wplug(disk, sector);
>> + if (!zwplug) {
>> + if (zone->cond == BLK_ZONE_COND_FULL)
>> + zone->wp = sector + zone_sectors;
>> + else
>> + zone->wp = sector;
>> + return 0;
>> + }
>
> According to ZBC-2 the write pointer is invalid for full zones.
Sure, meaning that the user should not look at the value. That does not make the
above wrong in any way. But sure, I can chnage that the ULLONG_MAX if you really
prefer.
--
Damien Le Moal
Western Digital Research
More information about the Linux-nvme
mailing list