Re: [RFC PATCH 00/31] netfs: [WIP] Allow the use of MSG_SPLICE_PAGES and use netmem allocator

From: David Howells
Date: Fri Aug 08 2025 - 16:33:25 EST


Enzo Matsumiya <ematsumiya@xxxxxxx> wrote:

> Anyway, if you want me to test, just send me the patches.
> I have your linux-fs remote as well, if that's easier.

If you look at:

https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=cifs-experimental

You can see a patch with the subject "cifs: [!] FIX transport compression".
Grab that and everything up to it.

I'm pretty certain it won't work, but I can't test it. Well, maybe I can
force it on and look at the packet trace if wireshark can handle it.

Some things to note:

(1) In smb_compress(), netfs_alloc_bvecq_buffer() is used to allocate the
destination buffer and attach it to a bvecq, which it also allocates. An
iterator can be set on this to define part of the buffer to operate on.

(2) vmap_bvecq() is used to map the source and the destination buffers. It
extracts the pages and then calls vmap() on them.

(3) Space for the compression header is allocated by smb_send_rqst() in the
first bvecq slot along with the rfc1002 header and transform header (if
sealing). A pointer is passed down to smb_compress().

(4) It attempts to adjust the values such that the compression header is
included in the encrypted section if also sealing. However, it might be
better to have smb_compress() place it in the output buffer.

(5) If compression is successful, smb_compress() switches the original bvecq
and the output bvecq and moves the header segment from the original to
the output.

(6) If the compression algo returns -EMSGSIZE, then the compression header is
excluded from the header segment.

David