Re: [PATCH 1/3] block: add a bio_reuse helper

Christoph Hellwig
2025-12-18T09:45:31Z

On Thu, Dec 18, 2025 at 05:40:00PM +0800, Ming Lei wrote:
> > +/**
> > + * bio_reuse - reuse a bio with the payload left intact
> > + * @bio bio to reuse
> > + *
> > + * Allow reusing an existing bio for another operation with all set up
> > + * fields including the payload, device and end_io handler left intact.
> > + *
> > + * Typically used for bios first used to read data which is then written
> > + * to another location without modification.
> > + */
> > +void bio_reuse(struct bio *bio)
> > +{
> > + unsigned short vcnt = bio->bi_vcnt, i;
> > + bio_end_io_t *end_io = bio->bi_end_io;
> > + void *private = bio->bi_private;
>
> The incoming bio can't be a cloned bio, so

It better no be, yes.