Re: [PATCH 11/17] block: remove queue_max_open_zones and queue_max_active_zones

Damien Le Moal
2022-07-05T02:43:12Z

On 7/4/22 21:44, Christoph Hellwig wrote:
> Always use the bdev based helpers instead.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
> block/blk-sysfs.c | 4 ++--
> include/linux/blkdev.h | 37 ++++++++++---------------------------
> 2 files changed, 12 insertions(+), 29 deletions(-)
>
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 7590810cf13fc..5ce72345ac666 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -330,12 +330,12 @@ static ssize_t queue_nr_zones_show(struct request_queue *q, char *page)
>
> static ssize_t queue_max_open_zones_show(struct request_queue *q, char *page)
> {
> - return queue_var_show(queue_max_open_zones(q), page);
> + return queue_var_show(bdev_max_open_zones(q->disk->part0), page);
> }
>
> static ssize_t queue_max_active_zones_show(struct request_queue *q, char *page)
> {
> - return queue_var_show(queue_max_active_zones(q), page);
> + return queue_var_show(bdev_max_active_zones(q->disk->part0), page);
> }
>
> static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index ddf8353488fc8..a14cc3e46e6ad 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -704,21 +704,22 @@ static inline void blk_queue_max_open_zones(struct request_queue *q,
> q->max_open_zones = max_open_zones;
> }
>
> -static inline unsigned int queue_max_open_zones(const struct request_queue *q)
> -{
> - return q->max_open_zones;
> -}
> -
> static inline void blk_queue_max_active_zones(struct request_queue *q,
> unsigned int max_active_zones)
> {
> q->max_active_zones = max_active_zones;
> }
>
> -static inline unsigned int queue_max_active_zones(const struct request_queue *q)
> +static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
> +{
> + return bdev->bd_disk->queue->max_open_zones;
> +}
> +
> +static inline unsigned int bdev_max_active_zones(struct block_device *bdev)
> {
> - return q->max_active_zones;
> + return bdev->bd_disk->queue->max_active_zones;
> }
> +
> #else /* CONFIG_BLK_DEV_ZONED */
> static inline unsigned int blk_queue_nr_zones(struct request_queue *q)
> {
> @@ -734,11 +735,11 @@ static inline unsigned int blk_queue_zone_no(struct request_queue *q,
> {
> return 0;
> }
> -static inline unsigned int queue_max_open_zones(const struct request_queue *q)
> +static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
> {
> return 0;
> }
> -static inline unsigned int queue_max_active_zones(const struct request_queue *q)
> +static inline unsigned int bdev_max_active_zones(struct block_device *bdev)
> {
> return 0;
> }
> @@ -1316,24 +1317,6 @@ static inline sector_t bdev_zone_sectors(struct block_device *bdev)
> return 0;
> }
>
> -static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
> -{
> - struct request_queue *q = bdev_get_queue(bdev);
> -
> - if (q)
> - return queue_max_open_zones(q);
> - return 0;
> -}
> -
> -static inline unsigned int bdev_max_active_zones(struct block_device *bdev)
> -{
> - struct request_queue *q = bdev_get_queue(bdev);
> -
> - if (q)
> - return queue_max_active_zones(q);
> - return 0;
> -}
> -
> static inline int queue_dma_alignment(const struct request_queue *q)
> {
> return q ? q->dma_alignment : 511;

--
Damien Le Moal
Western Digital Research