aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
authorCaleb Sander Mateos <csander@purestorage.com>2026-01-08 10:22:12 -0700
committerJens Axboe <axboe@kernel.dk>2026-01-10 10:22:54 -0700
commita31bde687b10b1a3db9c61eba5abb662dda15277 (patch)
tree0fafca5d33a9066ace9fdf6518bb779f4dac93a3 /block
parent15f506a77ad61ac3273ade9b7ef87af9bdba22ad (diff)
downloadlinux-next-history-a31bde687b10b1a3db9c61eba5abb662dda15277.tar.gz
block: use pi_tuple_size in bi_offload_capable()
bi_offload_capable() returns whether a block device's metadata size matches its PI tuple size. Use pi_tuple_size instead of switching on csum_type. This makes the code considerably simpler and less branchy. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity-auto.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/block/bio-integrity-auto.c b/block/bio-integrity-auto.c
index 9850c338548d3..eb95e29c93bc6 100644
--- a/block/bio-integrity-auto.c
+++ b/block/bio-integrity-auto.c
@@ -52,19 +52,7 @@ static bool bip_should_check(struct bio_integrity_payload *bip)
static bool bi_offload_capable(struct blk_integrity *bi)
{
- switch (bi->csum_type) {
- case BLK_INTEGRITY_CSUM_CRC64:
- return bi->metadata_size == sizeof(struct crc64_pi_tuple);
- case BLK_INTEGRITY_CSUM_CRC:
- case BLK_INTEGRITY_CSUM_IP:
- return bi->metadata_size == sizeof(struct t10_pi_tuple);
- default:
- pr_warn_once("%s: unknown integrity checksum type:%d\n",
- __func__, bi->csum_type);
- fallthrough;
- case BLK_INTEGRITY_CSUM_NONE:
- return false;
- }
+ return bi->metadata_size == bi->pi_tuple_size;
}
/**