[PATCH 04/11] block: remove the blk_integrity_profile structure

Kanchan Joshi joshi.k at samsung.com
Fri Jun 7 11:31:43 PDT 2024


On 6/7/2024 11:28 AM, Christoph Hellwig wrote:
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1177,7 +1177,7 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
>   	struct mapped_device *md = dm_table_get_md(ti->table);
>   
>   	/* We require an underlying device with non-PI metadata */
> -	if (!bi || strcmp(bi->profile->name, "nop")) {
> +	if (!bi || bi->csum_type != BLK_INTEGRITY_CSUM_NONE) {
>   		ti->error = "Integrity profile not supported.";
>   		return -EINVAL;

I'd rename BLK_INTEGRITY_CSUM_NONE to BLK_INTEGRITY_CSUM_NOP. Overall.

Current choice is a bit confusing as it indicates that code is trying to 
handle "none" case while it is actually trying to handle/support "nop" 
profile.

With extended format off:
# nvme format /dev/nvme0n1 -l 5 -m 0 -i 0 -f
Success formatting namespace:1
# cat /sys/block/nvme0n1/integrity/format
nop

With extended format on:
# nvme format /dev/nvme0n1 -l 5 -m 1 -i 0 -f
Success formatting namespace:1
# cat /sys/block/nvme0n1/integrity/format
none

nop is the case when bi->tuple_size is perfectly valid (i.e. not zero), 
and the code needs to have support for it.
none is the case when bi->tuple_size is zero, and the code only needs to 
ensure that it does nothing.

That said, the change can be deferred to a future patch as well.

So, looks good!

Reviewed-by: Kanchan Joshi <joshi.k at samsung.com>



More information about the Linux-nvme mailing list