Repository navigation
fuse: do not write through a write that drains a pipe (stacked on #279) - #280
Merged
hbirth merged 3 commits intoNov 6, 2026
Conversation
…e write grant" This reverts commit 9973e48. Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
filemap_splice_read() serves the page cache without calling ->read_iter, so splice, sendfile and the copy_file_range fallback skip the size update, the DLM read grant with its invalidation fence and the direct io dispatch, and fill pages that no grant covers. Use copy_splice_read(). Fixes: 2cb1e08 ("splice: Use filemap_splice_read() instead of generic_file_splice_read()") Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
With the writeback cache, a streamed write of FUSE_WRITE_STREAM_MIN or more is written through: four writes of the same size in a row make the file streamed, and each such write is sent as one synchronous WRITE. That suits a writer working through a file in records of its own size. Splice, sendfile and the copy_file_range fallback are not such writers. iter_file_splice_write() hands ->write_iter one pipe's worth at a time, and do_splice_direct() uses a 64 KiB internal pipe, so every copy that goes this way looks like a stream of 64 KiB records. Each 64 KiB chunk then costs a DLM write lock request and a synchronous WRITE. On a 6.17 client with fuse_splice_read() fixed to go through ->read_iter, a 4 GiB copy into a writeback-cached file ran at 55 MB/s with shutil.copyfile (sendfile), 54 MB/s with cat and 62 MB/s with cp, 1324 WRITEs/s of 64 KiB at 0.8 ms each, while dd bs=1M did 258-344 MB/s. The chunk size is the pipe's, not the writer's record, so a write that drains a pipe neither feeds the rolling mean nor counts as streamed. It is a buffered write like any other: dirty in the page cache under the same DLM grant and range lock, and written back in max_write requests. iter_file_splice_write() passes a bvec in a sync kiocb; io_uring registered buffers are bvecs in an async kiocb and still count as records. Same 4 GiB copies, writeback cache, every copy compared with cmp after a cold remount: shutil.copyfile 55 -> 258 MB/s cat 54 -> 342 MB/s cp 62 -> 354 MB/s splice, 1 MiB pipe 320 -> 796 MB/s During shutil the WRITEs are now 4 MiB. Copies with write(2), such as dd, take the same path as before. Without the writeback cache nothing changes: every write is synchronous there by design, and the copies stay at 64-71 MB/s. Signed-off-by: Sven Oehme <soehme@ddn.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hbirth
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #279. This branch is #279 (Horst's splice read fix and its revert of 9973e48) plus one commit; please review only the last one,
0f56879c27fb"fuse: do not write through a write that drains a pipe". Rebase it onto the base once #279 is merged. Tracking: RED-54152 (RED-54025).Problem. With #279 the splice read side is fixed, but splice, sendfile and copy_file_range-fallback copies into a writeback-cached file still run at only 55-62 MB/s.
->write_iterone pipe's worth at a time, and do_splice_direct() uses a 64 KiB internal pipe.Change. A write that drains a pipe (a bvec in a sync kiocb) neither feeds the rolling mean nor counts as streamed, so it takes the normal cached path and is written back in max_write requests.
Measured on a 6.17.0-42 client against a one-node cluster. Each copy is 4 GiB within one mount, after a cold remount, and compared with
cmp:During shutil the WRITEs are now 4 MiB instead of 64 KiB. Without the writeback cache nothing changes (64-71 MB/s), since every write is synchronous there by design. dd bs=64k with write(2) is unchanged at 57-76 MB/s.
Correctness checks, all passed:
socket.sendfilematched by sha256.Notes:
Claude sessions
0f56879c27c10f24a4-49fe-51da-96c4-4a22a16358c2cd /mnt/red/.claude/worktrees/bridge-cse_0131UunDKWYf1fyEXfedDXbu && claude --resume c10f24a4-49fe-51da-96c4-4a22a16358c2🤖 Generated with Claude Code