summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-07-02 18:10:24 +0300
committerJens Axboe <axboe@kernel.dk>2024-07-03 19:21:16 +0300
commit74cc150282e41c6c0704cd305c9a4392dc64ef4d (patch)
tree26eac2a44a351acfffe8f5367e0af1f647ebdb09 /block
parent85253bac4d02b1f95d6109c221aeccd7a262ec4d (diff)
downloadlinux-74cc150282e41c6c0704cd305c9a4392dc64ef4d.tar.xz
block: don't free the integrity payload in bio_integrity_unmap_free_user
Now that the integrity payload is always freed in bio_uninit, don't bother freeing it a little earlier in bio_integrity_unmap_free_user. With that the separate bio_integrity_unmap_free_user can go away by just passing the bio to bio_integrity_unmap_user. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Kanchan Joshi <joshi.k@samsung.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240702151047.1746127-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c31
-rw-r--r--block/blk-map.c2
2 files changed, 12 insertions, 21 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 4aa836d603fb..4b5c60458556 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -131,34 +131,25 @@ static void bio_integrity_uncopy_user(struct bio_integrity_payload *bip)
bio_integrity_unpin_bvec(copy, nr_vecs, true);
}
-static void bio_integrity_unmap_user(struct bio_integrity_payload *bip)
+/**
+ * bio_integrity_unmap_user - Unmap user integrity payload
+ * @bio: bio containing bip to be unmapped
+ *
+ * Unmap the user mapped integrity portion of a bio.
+ */
+void bio_integrity_unmap_user(struct bio *bio)
{
- bool dirty = bio_data_dir(bip->bip_bio) == READ;
+ struct bio_integrity_payload *bip = bio_integrity(bio);
if (bip->bip_flags & BIP_COPY_USER) {
- if (dirty)
+ if (bio_data_dir(bio) == READ)
bio_integrity_uncopy_user(bip);
kfree(bvec_virt(bip->bip_vec));
return;
}
- bio_integrity_unpin_bvec(bip->bip_vec, bip->bip_max_vcnt, dirty);
-}
-
-/**
- * bio_integrity_unmap_free_user - Unmap and free bio user integrity payload
- * @bio: bio containing bip to be unmapped and freed
- *
- * Description: Used to unmap and free the user mapped integrity portion of a
- * bio. Submitter attaching the user integrity buffer is responsible for
- * unmapping and freeing it during completion.
- */
-void bio_integrity_unmap_free_user(struct bio *bio)
-{
- struct bio_integrity_payload *bip = bio_integrity(bio);
-
- bio_integrity_unmap_user(bip);
- bio_integrity_free(bio);
+ bio_integrity_unpin_bvec(bip->bip_vec, bip->bip_max_vcnt,
+ bio_data_dir(bio) == READ);
}
/**
diff --git a/block/blk-map.c b/block/blk-map.c
index df5f82d11472..0e1167b23934 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -758,7 +758,7 @@ int blk_rq_unmap_user(struct bio *bio)
}
if (bio_integrity(bio))
- bio_integrity_unmap_free_user(bio);
+ bio_integrity_unmap_user(bio);
next_bio = bio;
bio = bio->bi_next;