Repository navigation
Gather writev iovecs into a single FS.write - #27286
Merged
Merged
Conversation
guybedford
force-pushed
the
iov-writev-gather
branch
3 times, most recently
from
July 8, 2026 23:10
7ee04cc to
cc0503b
Compare
sbc100
approved these changes
Jul 8, 2026
sbc100
reviewed
Jul 8, 2026
Per-iovec writes fragment a stream socket send into one segment per iovec, breaking stream byte semantics (e.g. mio's TCP writes). POSIX writev is a single gather-write, and __syscall_sendmsg already gathers into one buffer before writing. Do the same in doWritev: sum the iovec lengths, copy each into one contiguous buffer, and issue a single FS.write.
guybedford
force-pushed
the
iov-writev-gather
branch
from
July 9, 2026 00:06
cc0503b to
5bfccda
Compare
sbc100
enabled auto-merge (squash)
July 9, 2026 00:14
Collaborator
Author
|
I pushed the change to update the failing fixture here only, where the change is a correct behavioural change of the test under the PR. |
guybedford
force-pushed
the
iov-writev-gather
branch
from
July 9, 2026 01:08
014d270 to
4d35bba
Compare
juj
added a commit
that referenced
this pull request
Nov 19, 2026
These two tests were added in #27284 and #27286 and assume that `writev` gathers all its iovecs into a single write on the underlying device, which is how the JS filesystem behaves. WasmFS instead writes each iovec separately (returning a short write if a later one fails), so both tests fail there: wasmfs.test_fs_writev_gather: Aborted(expected a single 8-byte gather write) Aborted(Assertion failed: nwritten == 8, at: test/fs/test_writev_gather.c,42,main) wasmfs.test_fs_readv_eagain: Aborted(Assertion failed: nwrite == 8, at: test/fs/test_readv_eagain.c,72,main) - test_fs_writev_gather only tests the gathering behaviour, so disable it under WasmFS. - In test_fs_readv_eagain, expect the write of the first iovec to succeed and the second one to would-block under WasmFS, which results in a partial write of 4 bytes rather than EAGAIN. --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
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.
doWritevcurrently issues oneFS.writeper iovec. For a stream socket that fragments a singlewritevinto one segment per iovec, which breaks stream byte semantics — e.g. mio's TCP writes came through split rather than as one contiguous send.POSIX
writevis a single gather-write, and__syscall_sendmsgalready gathers all iovecs into one contiguous buffer before writing. This makesdoWritevdo the same:FS.writeAdds
test/fs/test_writev_gather.c, which registers a device whosewritehook asserts it receives the whole payload in exactly one call.Made with AI assistance under my review