[PATCHv2] block: always allocate integrity buffer

Martin K. Petersen martin.petersen at oracle.com
Wed May 7 15:31:33 PDT 2025


Keith,

> +	if (bio_op(bio) == REQ_OP_READ && !bio->bi_status &&
> +	    bip->bip_flags & BIP_CHECK_GUARD) {

> -	if (bio_data_dir(bio) == WRITE)
> +	if (bio_data_dir(bio) == WRITE && bid->bip.bip_flags & BIP_CHECK_GUARD)
>  		blk_integrity_generate(bio);

I know that we can't have one without the other currently but there's
some cognitive PI dissonance wrt. keying off BIP_CHECK_GUARD only.

Maybe worth considering:

#define BIP_CHECK_FLAGS (BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG)

and validating against that? Or a bip_should_check() wrapper.

Not a biggie, it just trips me up when we encode implementation-specific
assumptions.

Anyway. It's probably OK.

Reviewed-by: Martin K. Petersen <martin.petersen at oracle.com>

-- 
Martin K. Petersen



More information about the Linux-nvme mailing list