[1/7] block: remove superfluous check for request queue in bdev_is_zoned

Message ID 20230106083317.93938-2-p.raghav@samsung.com
State New
Headers
Series block zoned cleanups |

Commit Message

Pankaj Raghav Jan. 6, 2023, 8:33 a.m. UTC
  Remove the superfluous request queue check in bdev_is_zoned() as the
bdev_get_queue can never return NULL.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 include/linux/blkdev.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
  

Comments

Damien Le Moal Jan. 6, 2023, 11:01 a.m. UTC | #1
On 1/6/23 17:33, Pankaj Raghav wrote:
> Remove the superfluous request queue check in bdev_is_zoned() as the
> bdev_get_queue can never return NULL.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---
>  include/linux/blkdev.h | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 43d4e073b111..0e40b014c40b 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1283,12 +1283,7 @@ static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev)
>  
>  static inline bool bdev_is_zoned(struct block_device *bdev)
>  {
> -	struct request_queue *q = bdev_get_queue(bdev);
> -
> -	if (q)
> -		return blk_queue_is_zoned(q);
> -
> -	return false;
> +	return blk_queue_is_zoned(bdev_get_queue(bdev));
>  }
>  
>  static inline bool bdev_op_is_zoned_write(struct block_device *bdev,

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
  
Bart Van Assche Jan. 6, 2023, 10:34 p.m. UTC | #2
On 1/6/23 00:33, Pankaj Raghav wrote:
> Remove the superfluous request queue check in bdev_is_zoned() as the
> bdev_get_queue can never return NULL.

the bdev_get_queue -> bdev_get_queue()

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
  
Chaitanya Kulkarni Jan. 9, 2023, 7:41 a.m. UTC | #3
On 1/6/23 00:33, Pankaj Raghav wrote:
> Remove the superfluous request queue check in bdev_is_zoned() as the
> bdev_get_queue can never return NULL.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---

Looks good.

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

-ck
  
Johannes Thumshirn Jan. 9, 2023, 8:55 a.m. UTC | #4
On 06.01.23 09:34, Pankaj Raghav wrote:
> Remove the superfluous request queue check in bdev_is_zoned() as the

minus the last 'the'

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
  
Christoph Hellwig Jan. 10, 2023, 6:52 a.m. UTC | #5
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
  

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 43d4e073b111..0e40b014c40b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1283,12 +1283,7 @@  static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev)
 
 static inline bool bdev_is_zoned(struct block_device *bdev)
 {
-	struct request_queue *q = bdev_get_queue(bdev);
-
-	if (q)
-		return blk_queue_is_zoned(q);
-
-	return false;
+	return blk_queue_is_zoned(bdev_get_queue(bdev));
 }
 
 static inline bool bdev_op_is_zoned_write(struct block_device *bdev,