Commit 7afe9394 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAnuj Gupta <anuj20.g@samsung.com>
Reviewed-by: default avatarKanchan Joshi <joshi.k@samsung.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Tested-by: default avatarAnuj Gupta <anuj20.g@samsung.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a9366556
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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)