diff mbox series

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

Message ID 20240202073104.2418230-10-dlemoal@kernel.org (mailing list archive)
State New, archived
Headers show
Series Zone write plugging | expand

Commit Message

Damien Le Moal Feb. 2, 2024, 7:30 a.m. UTC
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(-)

Comments

Hannes Reinecke Feb. 4, 2024, 12:26 p.m. UTC | #1
On 2/2/24 15:30, Damien Le Moal wrote:
> 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;
Reviewed-by: Hannes Reinecke <hare@suse.de

Cheers,

Hannes
diff mbox series

Patch

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;