[PATCH 01/20] block: optimize blk_queue_zoned_model for !CONFIG_BLK_DEV_ZONED

Damien Le Moal Damien.LeMoal at wdc.com
Mon Sep 28 10:11:02 EDT 2020


On 2020/09/28 21:35, Christoph Hellwig wrote:
> Always return BLK_ZONED_NONE if zoned device support is not enabled.
> This allows various compiler optimizations including the dead code
> elimination that we so like for avoiding ifdefs.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  include/linux/blkdev.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 8e77f12de52214..1b81b2766858bb 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -692,7 +692,9 @@ static inline bool queue_is_mq(struct request_queue *q)
>  static inline enum blk_zoned_model
>  blk_queue_zoned_model(struct request_queue *q)
>  {
> -	return q->limits.zoned;
> +	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED))
> +		return q->limits.zoned;
> +	return BLK_ZONED_NONE;
>  }
>  
>  static inline bool blk_queue_is_zoned(struct request_queue *q)
> 

Looks good.

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

-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list