diff options
author | Damien Le Moal <dlemoal@kernel.org> | 2024-05-01 20:08:54 +0900 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-05-01 08:08:42 -0600 |
commit | 44cccb3027d4719c9229203233250d73d3192bf9 (patch) | |
tree | ca2759e0946bd57b24da865ead8eceb9c462f92f /drivers/md/dm-table.c | |
parent | 6ad0d7e0f4b68f87a98ea2b239123b7d865df86b (diff) | |
download | lwn-44cccb3027d4719c9229203233250d73d3192bf9.tar.gz lwn-44cccb3027d4719c9229203233250d73d3192bf9.zip |
dm: Check that a zoned table leads to a valid mapped device
Using targets such as dm-linear, a mapped device can be created to
contain only conventional zones. Such device should not be treated as
zoned as it does not contain any mandatory sequential write required
zone. Since such device can be randomly written, we can modify
dm_set_zones_restrictions() to set the mapped device zoned queue limit
to false to expose it as a regular block device. The function
dm_check_zoned() does this after counting the number of conventional
zones of the mapped device and comparing it to the total number of zones
reported. The special dm_check_zoned_cb() report zones callback function
is used to count conventional zones.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Link: https://lore.kernel.org/r/20240501110907.96950-2-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 41f1d731ae5a..2c6fbd87363f 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -2042,7 +2042,8 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, r = dm_set_zones_restrictions(t, q); if (r) return r; - if (!static_key_enabled(&zoned_enabled.key)) + if (blk_queue_is_zoned(q) && + !static_key_enabled(&zoned_enabled.key)) static_branch_enable(&zoned_enabled); } |