diff mbox series

[01/17] block: remove a superflous ifdef in blkdev.h

Message ID 20220704124500.155247-2-hch@lst.de
State New
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
It doesn't hurt to lways have the blk_zone_cond_str prototype, and the
two inlines can also be defined unconditionally.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/blkdev.h | 3 ---
 1 file changed, 3 deletions(-)

Comments

Johannes Thumshirn July 4, 2022, 12:58 p.m. UTC | #1
On 04.07.22 14:45, Christoph Hellwig wrote:
> It doesn't hurt to lways have the blk_zone_cond_str prototype, and the
> two inlines can also be defined unconditionally.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/linux/blkdev.h | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index b9a94c53c6cd3..270cd0c552924 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -899,8 +899,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
>  	return bdev->bd_queue;	/* this is never NULL */
>  }
>  
> -#ifdef CONFIG_BLK_DEV_ZONED
> -
>  /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
>  const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
>  

Won't this break tracing in null_blk, which uses blk_zone_cond_str()?
Christoph Hellwig July 4, 2022, 1:01 p.m. UTC | #2
On Mon, Jul 04, 2022 at 12:58:40PM +0000, Johannes Thumshirn wrote:
> > -#ifdef CONFIG_BLK_DEV_ZONED
> > -
> >  /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
> >  const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
> >  
> 
> Won't this break tracing in null_blk, which uses blk_zone_cond_str()?

How could removing an ifdef and exposing a prototype unconditionally
in a header break tracing?
Damien Le Moal July 5, 2022, 2:26 a.m. UTC | #3
On 7/4/22 21:44, Christoph Hellwig wrote:
> It doesn't hurt to lways have the blk_zone_cond_str prototype, and the

s/lways/always

> two inlines can also be defined unconditionally.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/linux/blkdev.h | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index b9a94c53c6cd3..270cd0c552924 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -899,8 +899,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
>  	return bdev->bd_queue;	/* this is never NULL */
>  }
>  
> -#ifdef CONFIG_BLK_DEV_ZONED
> -
>  /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
>  const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);

This is defined in block/blk-zoned.c and so not compiled if
CONFIG_BLK_DEV_ZONED is not defined. But I guess this should be fine since
if there is a user of this function with !CONFIG_BLK_DEV_ZONED, a build
should fail anyway.

>  
> @@ -915,7 +913,6 @@ static inline unsigned int bio_zone_is_seq(struct bio *bio)
>  	return blk_queue_zone_is_seq(bdev_get_queue(bio->bi_bdev),
>  				     bio->bi_iter.bi_sector);
>  }
> -#endif /* CONFIG_BLK_DEV_ZONED */
>  
>  /*
>   * Return how much of the chunk is left to be used for I/O at a given offset.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Chaitanya Kulkarni July 5, 2022, 6:22 a.m. UTC | #4
On 7/4/2022 5:44 AM, Christoph Hellwig wrote:
> It doesn't hurt to lways have the blk_zone_cond_str prototype, and the

's/lways/always'

> two inlines can also be defined unconditionally.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

-ck
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b9a94c53c6cd3..270cd0c552924 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -899,8 +899,6 @@  static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
 	return bdev->bd_queue;	/* this is never NULL */
 }
 
-#ifdef CONFIG_BLK_DEV_ZONED
-
 /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
 const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
 
@@ -915,7 +913,6 @@  static inline unsigned int bio_zone_is_seq(struct bio *bio)
 	return blk_queue_zone_is_seq(bdev_get_queue(bio->bi_bdev),
 				     bio->bi_iter.bi_sector);
 }
-#endif /* CONFIG_BLK_DEV_ZONED */
 
 /*
  * Return how much of the chunk is left to be used for I/O at a given offset.