Re: [PATCH] block: Make __bio_clone_fast() copy bi_vcnt

Bart Van Assche
2018-06-29T20:00:33Z

On 06/28/18 17:04, Kent Overstreet wrote:
> On Thu, Jun 28, 2018 at 04:54:44PM -0700, Bart Van Assche wrote:
>> Thanks for chiming in. The linux-block mailing list is archived by multiple
>> websites. The entire e-mail thread is available on e.g.
>> https://www.mail-archive.com/linux-block@vger.kernel.org/msg23006.html.
>>
>> I have a question for you: at least in kernel v4.17 bio_clone_bioset()
>> copies bi_vcnt from the source to the destination bio. However,
>> __bio_clone_fast() doesn't copy bi_vcnt. Isn't that an inconsistency?
>
> No - when you use bio_clone_bioset() you get a bio that you own and can do
> whatever you want with, so it does make sense for it to initialize bi_vcnt.
>
> e.g. you could use bio_clone_bioset() when you're going to be bouncing a bio,
> iterating over each bvec and allocating a new page and copying data from the old
> page to the new page.

Hello Kent,

Have you considered to explain this in a comment above
__bio_clone_fast() to avoid that the next person who reads that function
gets confused?

Bart.