On Wed, Oct 16, 2024 at 04:59:10PM +0530, Anuj Gupta wrote: > From: Kanchan Joshi <joshi.k@xxxxxxxxxxx> > > If an iocb contains metadata, extract that and prepare the bip. > Based on flags specified by the user, set corresponding guard/app/ref > tags to be checked in bip. > > Signed-off-by: Anuj Gupta <anuj20.g@xxxxxxxxxxx> > Signed-off-by: Kanchan Joshi <joshi.k@xxxxxxxxxxx> > --- > block/bio-integrity.c | 51 +++++++++++++++++++++++++++++++++++ > block/fops.c | 44 +++++++++++++++++++++++------- > include/linux/bio-integrity.h | 7 +++++ > 3 files changed, 93 insertions(+), 9 deletions(-) > > diff --git a/block/bio-integrity.c b/block/bio-integrity.c > index d3c8b56d3fe6..24fad9b6f3ec 100644 > --- a/block/bio-integrity.c > +++ b/block/bio-integrity.c > @@ -12,6 +12,7 @@ > #include <linux/bio.h> > #include <linux/workqueue.h> > #include <linux/slab.h> > +#include <uapi/linux/blkdev.h> > #include "blk.h" > > static struct kmem_cache *bip_slab; > @@ -303,6 +304,55 @@ static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages, > return nr_bvecs; > } > > +static void bio_uio_meta_to_bip(struct bio *bio, struct uio_meta *meta) > +{ > + struct bio_integrity_payload *bip = bio_integrity(bio); > + > + if (meta->flags & BLK_INTEGRITY_CHK_GUARD) > + bip->bip_flags |= BIP_CHECK_GUARD; > + if (meta->flags & BLK_INTEGRITY_CHK_APPTAG) > + bip->bip_flags |= BIP_CHECK_APPTAG; > + if (meta->flags & BLK_INTEGRITY_CHK_REFTAG) > + bip->bip_flags |= BIP_CHECK_REFTAG; > + > + bip->app_tag = meta->app_tag; > +} > + > +int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta) Just noticed this when looking at the seed situation: Can you please move bio_integrity_map_iter below bio_integrity_map_user as it is a relatively thing wrapper for it?