> Add support for sending user-meta buffer. Set tags to be checked > using flags specified by user/block-layer user and underlying DIF/DIX > configuration. Introduce BLK_INTEGRITY_APP_TAG to specify apptag. > This provides a way for upper layers to specify apptag checking. We'll also need that flag for nvme, don't we? It should also be added in a block layer patch and not as part of a driver patch. > +/* > + * Can't check reftag alone or apptag alone > + */ > +static bool sd_prot_flags_valid(struct scsi_cmnd *scmd) > +{ > + struct request *rq = scsi_cmd_to_rq(scmd); > + struct bio *bio = rq->bio; > + > + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG) && > + !bio_integrity_flagged(bio, BIP_CHECK_APPTAG)) > + return false; > + if (!bio_integrity_flagged(bio, BIP_CHECK_REFTAG) && > + bio_integrity_flagged(bio, BIP_CHECK_APPTAG)) > + return false; > + return true; > +} We'll need to advertise this limitations to the application or in-kernel user somehow.. > + if ((bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) && > + (!dix || bio_integrity_flagged(bio, BIP_CHECK_REFTAG))) Incorrect formatting. This is better: if (!bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) && (!dix || bio_integrity_flagged(bio, BIP_CHECK_REFTAG)))