Re: [PATCH 10/18] lightnvm: pblk: use bio_copy_kern when possible
From: Christoph Hellwig
Date: Wed Sep 06 2017 - 09:47:40 EST
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, after taking care of virtually tagged caches instead
of this bounce buffering.
And you really want to allocate the request first and only then map
the data to the request, as said before.