Re: [PATCH v14 5/7] btrfs: send: allocate send buffer with alloc_page() and vmap() for v2

Sweet Tea Dorminy
2022-03-24T17:53:27Z

On 3/17/22 13:25, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
>
> For encoded writes, we need the raw pages for reading compressed data
> directly via a bio.
Perhaps:
"For encoded writes, the existing btrfs_encoded_read*() functions expect
a list of raw pages."

I think it would be a better to continue just vmalloc'ing a large
continuous buffer and translating each page in the buffer into its raw
page with something like is_vmalloc_addr(data) ? vmalloc_to_page(data) :
virt_to_page(data). Vmalloc can request a higher-order allocation, which
probably doesn't matter but might slightly improve memory locality. And
in terms of readability, I somewhat like the elegance of having a single
identical kvmalloc call to allocate and send_buf in both cases, even if
we do need to initialize the page list for some v2 commands.