This function is the complementary function to bio_integrity_alloc. Export it for users that would like to free the integrity context explicitly. Signed-off-by: Max Gurtovoy <mgurtovoy@xxxxxxxxxx> --- block/bio-integrity.c | 1 + block/blk.h | 4 ---- include/linux/bio.h | 6 ++++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4533eb491661..276ca86fc1d3 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -110,6 +110,7 @@ void bio_integrity_free(struct bio *bio) bio->bi_integrity = NULL; bio->bi_opf &= ~REQ_INTEGRITY; } +EXPORT_SYMBOL(bio_integrity_free); /** * bio_integrity_add_page - Attach integrity metadata diff --git a/block/blk.h b/block/blk.h index cc4e8873dfde..644e5f30a983 100644 --- a/block/blk.h +++ b/block/blk.h @@ -179,7 +179,6 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, #ifdef CONFIG_BLK_DEV_INTEGRITY void blk_flush_integrity(void); bool __bio_integrity_endio(struct bio *); -void bio_integrity_free(struct bio *bio); static inline bool bio_integrity_endio(struct bio *bio) { if (bio_integrity(bio)) @@ -245,9 +244,6 @@ static inline bool bio_integrity_endio(struct bio *bio) { return true; } -static inline void bio_integrity_free(struct bio *bio) -{ -} static inline int blk_integrity_add(struct gendisk *disk) { return 0; diff --git a/include/linux/bio.h b/include/linux/bio.h index d766be7152e1..64aabdacac24 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -700,6 +700,7 @@ static inline bool bioset_initialized(struct bio_set *bs) bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); +extern void bio_integrity_free(struct bio *); extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); extern bool bio_integrity_prep(struct bio *); extern void bio_integrity_advance(struct bio *, unsigned int); @@ -764,6 +765,11 @@ static inline void *bio_integrity_alloc(struct bio * bio, gfp_t gfp, return ERR_PTR(-EINVAL); } +static inline void bio_integrity_free(struct bio *bio) +{ + return; +} + static inline int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { -- 2.18.1