summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-02-23 16:20:03 +0300
committerJens Axboe <axboe@kernel.dk>2026-03-09 16:47:02 +0300
commit7afe93946dff63aa57c6db81f5eb43ac8233364e (patch)
tree3d630ea564e1ac0edaefd53d5519419e1d97b0eb
parenta936655697cd8d1bab2fd5189e2c33dd6356a266 (diff)
downloadlinux-7afe93946dff63aa57c6db81f5eb43ac8233364e.tar.xz
block: add a bdev_has_integrity_csum helper
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 <hch@lst.de> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Kanchan Joshi <joshi.k@samsung.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Tested-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--include/linux/blkdev.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d463b9b5a0a5..dec0acaed6e6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1477,14 +1477,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)