Re: [PATCH v2 04/13] block: remember a zone type regardless of its condition
Hannes Reinecke <[email protected]> Fri, 7 Aug 2026 11:11:02 +0200
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
On 8/6/26 6:04 PM, Damien Le Moal wrote: > Currently, bdev_zone_is_seq() identifies a sequential zone by looking at > the zone condition, assuming that any zone that does not have the > condition BLK_ZONE_COND_NOT_WP is a sequential write required zone. That > is correct only as long as the target zoned device does not support > storage element depopulation (aka HDD head depopulation), which is a > feature that can transition conventional zones to the read-only or offline > condition. For such device, we cannot distinguish anymore between > conventional and sequential zones using the zone condition as both zone > types can have the same conditions. > > Prepare for fully supporting storage element depopulation and restoration > by caching the type of a zone in addition to its condition. This is > implemented by reformating the zones_cond array using a more compact zone > condition representation with the new enum blk_zstate. This zone condition > representation only uses the lower 4 bits of a byte for the condition > values, thus leaving the high order 4 bits of each byte entry of the > array for flags. The flag BLK_ZFLAG_CONV is defined to indicate > conventional zones. > > The helper functions blk_zstate_to_zone_cond() and > blk_zone_cond_to_zstate() are implemented using lookup tables to convert > between enum blk_zone_condition values and enum blk_zstate zone condition > values. The helper blk_zstate_set() can be used to prepare a zones_state > entry for a disk with a zone condition and zone type flags. This helper is > used in disk_zone_set_cond() to update a zone condition. > bdev_zone_is_seq() is modified to use the flags of the zones_state array > entries to identify sequential zones. The zones_state array initialization > and revalidation is unchanged from the former zones_cond array. > > Overall, any zone condition that is being considered outside of the > zones_state array always uses the enum blk_zone_condition values as > before, thus minimizing the number of changes. > > Signed-off-by: Damien Le Moal <[email protected]> > --- > block/blk-zoned.c | 202 +++++++++++++++++++++++++++++------------ > include/linux/blkdev.h | 2 +- > 2 files changed, 143 insertions(+), 61 deletions(-) > Reviewed-by: Hannes Reinecke <[email protected]> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich