On Wed, Jan 21, 2026 at 07:43:11AM +0100, Christoph Hellwig wrote:
> Factor out a helper to see if the block device has an integrity checksum
> from bdev_stable_writes so that it can be reused for other checks.
> 
> Signed-off-by: Christoph Hellwig <[email protected]>

This looks like a straightforward splitting of responsibilities, so
Reviewed-by: "Darrick J. Wong" <[email protected]>

--D

> ---
>  include/linux/blkdev.h | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 438c4946b6e5..c1f3e6bcc217 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1472,14 +1472,18 @@ static inline bool bdev_synchronous(struct 
> block_device *bdev)
>       return bdev->bd_disk->queue->limits.features & BLK_FEAT_SYNCHRONOUS;
>  }
>  
> -static inline bool bdev_stable_writes(struct block_device *bdev)
> +static inline bool bdev_has_integrity_csum(struct block_device *bdev)
>  {
> -     struct request_queue *q = bdev_get_queue(bdev);
> +     struct queue_limits *lim = bdev_limits(bdev);
>  
> -     if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
> -         q->limits.integrity.csum_type != BLK_INTEGRITY_CSUM_NONE)
> -             return true;
> -     return q->limits.features & BLK_FEAT_STABLE_WRITES;
> +     return IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
> +             lim->integrity.csum_type != BLK_INTEGRITY_CSUM_NONE;
> +}
> +
> +static inline bool bdev_stable_writes(struct block_device *bdev)
> +{
> +     return bdev_has_integrity_csum(bdev) ||
> +             (bdev_limits(bdev)->features & BLK_FEAT_STABLE_WRITES);
>  }
>  
>  static inline bool blk_queue_write_cache(struct request_queue *q)
> -- 
> 2.47.3
> 
> 

Reply via email to