diff mbox series

[09/17] block: pass a gendisk to blk_queue_clear_zone_settings

Message ID 20220704124500.155247-10-hch@lst.de
State Superseded
Headers show
Series [01/17] block: remove a superflous ifdef in blkdev.h | expand

Commit Message

Christoph Hellwig July 4, 2022, 12:44 p.m. UTC
Switch to a gendisk based API in preparation for moving all zone related
fields from the request_queue to the gendisk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c | 2 +-
 block/blk-zoned.c    | 4 +++-
 block/blk.h          | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Johannes Thumshirn July 4, 2022, 1:23 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Damien Le Moal July 5, 2022, 2:41 a.m. UTC | #2
On 7/4/22 21:44, Christoph Hellwig wrote:
> Switch to a gendisk based API in preparation for moving all zone related
> fields from the request_queue to the gendisk.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

> ---
>  block/blk-settings.c | 2 +-
>  block/blk-zoned.c    | 4 +++-
>  block/blk.h          | 4 ++--
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 35b7bba306a83..8bb9eef5310eb 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -946,7 +946,7 @@ void disk_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
>  		blk_queue_zone_write_granularity(q,
>  						queue_logical_block_size(q));
>  	} else {
> -		blk_queue_clear_zone_settings(q);
> +		disk_clear_zone_settings(disk);
>  	}
>  }
>  EXPORT_SYMBOL_GPL(disk_set_zoned);
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 7fbe395fa51fc..5a97b48102221 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -622,8 +622,10 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
>  }
>  EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones);
>  
> -void blk_queue_clear_zone_settings(struct request_queue *q)
> +void disk_clear_zone_settings(struct gendisk *disk)
>  {
> +	struct request_queue *q = disk->queue;
> +
>  	blk_mq_freeze_queue(q);
>  
>  	blk_queue_free_zone_bitmaps(q);
> diff --git a/block/blk.h b/block/blk.h
> index 58ad50cacd2d5..7482a3a441dd9 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -406,10 +406,10 @@ static inline int blk_iolatency_init(struct request_queue *q) { return 0; }
>  
>  #ifdef CONFIG_BLK_DEV_ZONED
>  void blk_queue_free_zone_bitmaps(struct request_queue *q);
> -void blk_queue_clear_zone_settings(struct request_queue *q);
> +void disk_clear_zone_settings(struct gendisk *disk);
>  #else
>  static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {}
> -static inline void blk_queue_clear_zone_settings(struct request_queue *q) {}
> +static inline void disk_clear_zone_settings(struct gendisk *disk) {}
>  #endif
>  
>  int blk_alloc_ext_minor(void);
Chaitanya Kulkarni July 5, 2022, 6:29 a.m. UTC | #3
On 7/4/2022 5:44 AM, Christoph Hellwig wrote:
> Switch to a gendisk based API in preparation for moving all zone related
> fields from the request_queue to the gendisk.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   block/blk-settings.c | 2 +-
>   block/blk-zoned.c    | 4 +++-
>   block/blk.h          | 4 ++--
>   3 files changed, 6 insertions(+), 4 deletions(-)
> 

Reviewed-by : Chaitanya Kulkarni <kch@nvidia.com>

-ck
diff mbox series

Patch

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 35b7bba306a83..8bb9eef5310eb 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -946,7 +946,7 @@  void disk_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
 		blk_queue_zone_write_granularity(q,
 						queue_logical_block_size(q));
 	} else {
-		blk_queue_clear_zone_settings(q);
+		disk_clear_zone_settings(disk);
 	}
 }
 EXPORT_SYMBOL_GPL(disk_set_zoned);
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 7fbe395fa51fc..5a97b48102221 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -622,8 +622,10 @@  int blk_revalidate_disk_zones(struct gendisk *disk,
 }
 EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones);
 
-void blk_queue_clear_zone_settings(struct request_queue *q)
+void disk_clear_zone_settings(struct gendisk *disk)
 {
+	struct request_queue *q = disk->queue;
+
 	blk_mq_freeze_queue(q);
 
 	blk_queue_free_zone_bitmaps(q);
diff --git a/block/blk.h b/block/blk.h
index 58ad50cacd2d5..7482a3a441dd9 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -406,10 +406,10 @@  static inline int blk_iolatency_init(struct request_queue *q) { return 0; }
 
 #ifdef CONFIG_BLK_DEV_ZONED
 void blk_queue_free_zone_bitmaps(struct request_queue *q);
-void blk_queue_clear_zone_settings(struct request_queue *q);
+void disk_clear_zone_settings(struct gendisk *disk);
 #else
 static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {}
-static inline void blk_queue_clear_zone_settings(struct request_queue *q) {}
+static inline void disk_clear_zone_settings(struct gendisk *disk) {}
 #endif
 
 int blk_alloc_ext_minor(void);