[PATCH 09/26] block: Allow BIO-based drivers to use blk_revalidate_disk_zones()

Damien Le Moal
2024-02-02T07:31:20Z

Remove the check in blk_revalidate_disk_zones() restricting the use of
this function to mq request-based drivers to allow also BIO-based
drivers to use it. This is safe to do as long as the BIO-based block
device queue is already setup and usable, as it should, and can be
safely frozen.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
block/blk-zoned.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 929c28796c41..8bf6821735f3 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -1316,8 +1316,8 @@ static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx,
* be called within the disk ->revalidate method for blk-mq based drivers.
* Before calling this function, the device driver must already have set the
* device zone size (chunk_sector limit) and the max zone append limit.
- * For BIO based drivers, this function cannot be used. BIO based device drivers
- * only need to set disk->nr_zones so that the sysfs exposed value is correct.
+ * BIO based drivers can also use this function as long as the device queue
+ * can be safely frozen.
* If the @update_driver_data callback function is not NULL, the callback is
* executed with the device request queue frozen after all zones have been
* checked.
@@ -1334,8 +1334,6 @@ int blk_revalidate_disk_zones(struct gendisk *disk,

if (WARN_ON_ONCE(!blk_queue_is_zoned(q)))
return -EIO;
- if (WARN_ON_ONCE(!queue_is_mq(q)))
- return -EIO;

if (!capacity)
return -ENODEV;
--
2.43.0