Add documentation for fuse over io-uring usage of kernel-managed bufrings and zero-copy. Signed-off-by: Joanne Koong --- .../filesystems/fuse/fuse-io-uring.rst | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/fuse/fuse-io-uring.rst b/Documentation/filesystems/fuse/fuse-io-uring.rst index d73dd0dbd238..4c17169069e9 100644 --- a/Documentation/filesystems/fuse/fuse-io-uring.rst +++ b/Documentation/filesystems/fuse/fuse-io-uring.rst @@ -95,5 +95,58 @@ Sending requests with CQEs | buf_index). +* The server obtains a cqe representing the request. The cqe flag will have + IORING_CQE_F_BUFFER set if a selected buffer was used for the payload. The + buffer id is stashed in cqe->flags (through IORING_CQE_BUFFER_SHIFT). The + server can directly access the payload by using that buffer id to calculate + the offset into the virtual address obtained for the buffers. +* The server processes the request and then sends a + FUSE_URING_CMD_COMMIT_AND_FETCH sqe with the reply. +* When the kernel handles the sqe, it will process the reply and if there is a + next request, it will reuse the same selected buffer for the request. If + there is no next request, it will recycle the buffer back to the ring. + +Zero-copy +========= + +Fuse io-uring zero-copy allows the server to directly read from / write to the +client's pages and bypass any intermediary buffer copies. This is only allowed +on privileged servers. + +In order to use zero-copy, the server must pregister the following: +* a sparse buffer for every entry in the queue. This is where the client's + pages will reside +* a fixed buffer at index queue_depth (tailing the sparse buffer). + This is where the headers will reside +* a kernel-managed buffer ring. This is where any non-zero-copied payload (eg + out headers) will reside + +When the client issues a read/write, fuse stores the client's underlying pages +in the sparse buffer entry corresponding to the ent in the queue. The server +can then issue reads/writes on these pages through io_uring rw operations. +Please note that the server is not able to directly access these pages, it +must go through the io-uring interface to read/write to them. The pages are +unregistered once the server replies to the request. Non-zero-copyable +payload (if needed) is placed in a buffer from the kernel-managed buffer ring. -- 2.47.3