[RFC 0/3] ksmbd: use splice for SMB2 READ responses
"wang zhaolong" <[email protected]>
| Newsgroups | org.kernel.vger.linux-cifs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Wang Zhaolong <[email protected]> SMB2 READ currently copies file data into an allocated auxiliary buffer before sending the response. This series adds a page-backed payload, collects page-cache data with splice_direct_to_actor(), and sends it after the SMB response header with MSG_SPLICE_PAGES. This RFC deliberately limits the new path to plain TCP reads of at least 64 KiB. Signed, encrypted, compressed, compound, RDMA, stream, non-regular, O_DIRECT and DAX reads continue to use the buffered path. Unsupported splice collection also falls back before the response owns the payload. If a socket error occurs after part of a PDU has been sent, the connection is shut down rather than reusing a corrupted byte stream. I would particularly appreciate feedback on the work-owned bio_vec payload, the transport hook, and whether splice_direct_to_actor() is an appropriate interface for this path. I tested the series in QEMU with ksmbd and the SMB client in the same guest. The smb2.read.eof tests passed, including zero-length and MinimumCount cases. Reads of 65535 bytes used the buffered path, while 65536-byte and 1 MiB reads used the splice payload path. Forced signed and encrypted 1 MiB reads stayed on the buffered path. All data checks matched and no kernel warning was observed. For an exploratory performance comparison, I used a warm 4 GiB file over SMB 3.1.1 with cache=none, 1 MiB synchronous reads and one job. Median results across eight valid 60-second samples per kernel were: baseline patched delta bandwidth 1.728 GB/s 2.246 GB/s +30.0% mean completion latency 604.1 us 464.5 us -23.1% median sample P99 latency 794.6 us 606.2 us -23.7% One patched-kernel sample with TCP retransmissions was discarded by the validity gate and replaced. These are loopback results; an independent client is still needed to measure network-path and server CPU effects. The benchmark candidate preceded the final zero-length READ ordering fix, which did not change the positive-length payload path exercised here. Compression, large compound READ, RDMA, stream, non-regular, DAX and O_DIRECT exclusions, and the unsupported-splice fallback, were not exercised by this lab. Wang Zhaolong (3): ksmbd: add read payload infrastructure ksmbd: add splice-based read payload helper ksmbd: use splice payloads for simple SMB2 READ fs/smb/server/connection.c | 25 ++++- fs/smb/server/connection.h | 4 + fs/smb/server/ksmbd_work.c | 45 ++++++++ fs/smb/server/ksmbd_work.h | 12 +++ fs/smb/server/smb2pdu.c | 67 ++++++++++++ fs/smb/server/transport_tcp.c | 58 ++++++++++ fs/smb/server/vfs.c | 195 ++++++++++++++++++++++++++++++---- fs/smb/server/vfs.h | 4 + 8 files changed, 382 insertions(+), 28 deletions(-) -- 2.47.3