Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
a31bde68 15f506a7

+1 -13
+1 -13
block/bio-integrity-auto.c
··· 52 52 53 53 static bool bi_offload_capable(struct blk_integrity *bi) 54 54 { 55 - switch (bi->csum_type) { 56 - case BLK_INTEGRITY_CSUM_CRC64: 57 - return bi->metadata_size == sizeof(struct crc64_pi_tuple); 58 - case BLK_INTEGRITY_CSUM_CRC: 59 - case BLK_INTEGRITY_CSUM_IP: 60 - return bi->metadata_size == sizeof(struct t10_pi_tuple); 61 - default: 62 - pr_warn_once("%s: unknown integrity checksum type:%d\n", 63 - __func__, bi->csum_type); 64 - fallthrough; 65 - case BLK_INTEGRITY_CSUM_NONE: 66 - return false; 67 - } 55 + return bi->metadata_size == bi->pi_tuple_size; 68 56 } 69 57 70 58 /**