Re: [PATCH 10/18] lightnvm: pblk: use bio_copy_kern when possible

From: Javier GonzÃlez
Date: Wed Sep 06 2017 - 10:01:12 EST


> On 6 Sep 2017, at 15.47, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> On Wed, Sep 06, 2017 at 12:51:03PM +0200, Javier GonzÃlez wrote:
>> In pblk, buffers forming bios can be allocated on physically contiguous
>> or virtually contiguous memory. For physically contiguous memory, we
>> already use the bio_map_kern helper funciton, however, for virtually
>> contiguous memory, we from the bio manually. This makes the code more
>> complex, specially on the completion path, where mapped pages need to be
>> freed.
>>
>> Instead, use bio_copy_kern, which does the same and at the same time
>> simplifies the completion path.
>
> Nope. You want to loop over vmalloc_to_page and call bio_add_page
> for each page,

Yes. This is basically what I did before.

> after taking care of virtually tagged caches instead
> of this bounce buffering.

And thus I considered bio_copy_kern to be a better solution, since it
will through time take care of doing the vmalloc_to_page correctly for
all cases.

>
> And you really want to allocate the request first and only then map
> the data to the request, as said before.

Ok. So this would mean that targets (e.g., pblk) deal with struct
request instead of only dealing with bios and then letting the LightNVM
core transforming bios to requests. This way we can directly map to the
request. Is this what you mean?

Just out of curiosity, why is forming the bio trough bio_copy_kern (or
manually doing the same) and then transforming to a request incorrect /
worse?

Javier

Attachment: signature.asc
Description: Message signed with OpenPGP