summaryrefslogtreecommitdiff
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2026-09-08 17:57:34 +0900
committerJens Axboe <axboe@kernel.dk>2026-09-15 06:53:06 -0600
commitbdf2bd32f3ff98215ff3b40abc3987d8e1658318 (patch)
tree35acc8a485e0e606e1c731d12ad67d43780754c2 /include/linux/blkdev.h
parent983b770dc5ba205c3afe6d30460068cdca9f1d16 (diff)
downloadlinux-next-bdf2bd32f3ff98215ff3b40abc3987d8e1658318.tar.gz
linux-next-bdf2bd32f3ff98215ff3b40abc3987d8e1658318.zip
block: remember a zone type regardless of its condition
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 set a zones_state entry with a zone condition and zone type flags, safely in accordance to the size of the zone state array being accessed. 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 <dlemoal@kernel.org> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Link: https://patch.msgid.link/20260908085745.1082697-6-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 098a65f3e48b..b91511bfbfbd 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -198,7 +198,7 @@ struct gendisk {
unsigned int nr_zones;
unsigned int zone_capacity;
unsigned int last_zone_capacity;
- u8 __rcu *zones_cond;
+ u8 __rcu *zones_state;
unsigned int zone_wplugs_hash_bits;
atomic_t nr_zone_wplugs;
spinlock_t zone_wplugs_hash_lock;