summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2026-02-27 10:44:38 +0000
committerJens Axboe <axboe@kernel.dk>2026-03-09 14:30:00 -0600
commitd0e5fc70620266f975cfa5137795a8c1697ba362 (patch)
treea39c0ac789eedc1577381059b3a4983dbb1d5f2d /block
parentb0e497db68ae5b0af8e9a0bd1a761607757d5dfe (diff)
downloadlinux-next-d0e5fc70620266f975cfa5137795a8c1697ba362.tar.gz
linux-next-d0e5fc70620266f975cfa5137795a8c1697ba362.zip
block: Correct comments on bio_alloc_clone() and bio_init_clone()
Correct the comments that the cloned bio must be freed before the memory pointed to by @bio_src->bi_io_vecs (is freed). Christoph Hellwig contributed most the of the update wording. Signed-off-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/block/bio.c b/block/bio.c
index d80d5d26804e..eadf4c1e9994 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -897,10 +897,11 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp)
* @gfp: allocation priority
* @bs: bio_set to allocate from
*
- * Allocate a new bio that is a clone of @bio_src. The caller owns the returned
- * bio, but not the actual data it points to.
- *
- * The caller must ensure that the return bio is not freed before @bio_src.
+ * Allocate a new bio that is a clone of @bio_src. This reuses the bio_vecs
+ * pointed to by @bio_src->bi_io_vec, and clones the iterator pointing to
+ * the current position in it. The caller owns the returned bio, but not
+ * the bio_vecs, and must ensure the bio is freed before the memory
+ * pointed to by @bio_Src->bi_io_vecs.
*/
struct bio *bio_alloc_clone(struct block_device *bdev, struct bio *bio_src,
gfp_t gfp, struct bio_set *bs)
@@ -929,9 +930,7 @@ EXPORT_SYMBOL(bio_alloc_clone);
* @gfp: allocation priority
*
* Initialize a new bio in caller provided memory that is a clone of @bio_src.
- * The caller owns the returned bio, but not the actual data it points to.
- *
- * The caller must ensure that @bio_src is not freed before @bio.
+ * The same bio_vecs reuse and bio lifetime rules as bio_alloc_clone() apply.
*/
int bio_init_clone(struct block_device *bdev, struct bio *bio,
struct bio *bio_src, gfp_t gfp)