Repository navigation
perf: zero only what a read could see, not every new block - #160
Merged
Merged
Conversation
#145 zeroed every new block before a partial write. FUSE hands writes over in 128 KiB pieces, so that doubled the bytes written for all new data. Bytes past the end of a file cannot be read, so they may stay as the disk held them. A first write into a block now zeroes only the parts below the end of the file that it does not cover. A write, truncate or fallocate that grows the file zeroes the rest of its old last block first, through the write path, so a block a snapshot or clone shares is copied. Truncate no longer zeroes on shrink. A growing write holds the inode lock exclusively from its first data write through its size update, and if it drops the lock mid-write it first covers what it wrote in the old last block, so another node's growth never zeroes data it has not yet sized. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ned the gap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
This was referenced Nov 16, 2026
mattmattox
added a commit
that referenced
this pull request
Nov 16, 2026
The 48h soak on daa33a6 found another file's block with its first 176128 bytes zeroed on disk after a write into a hole on a different node. That range matches the head zero of the hole write, which points at #160's narrower zeroing. #145's full-block zeroing ran clean for 26,792 soak ops. Restore it until #160's cause is found. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox
added a commit
that referenced
this pull request
Nov 16, 2026
mattmattox
added a commit
that referenced
this pull request
Nov 17, 2026
…182) * test(goclusterfs): pace the uncommitted-blocks writer on the reader TestReaderNeverSeesUncommittedBlocks required the reader to see at least 3 sizes while the writer filled 16 blocks, which depends on how the two are scheduled: with #160's narrower zeroing the writes were fast enough that the reader sometimes saw only 2, about 1 run in 20 on .68. After each block the writer now waits for a read that started after it, so the reader sees every block's size, while it keeps reading during the next block's writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(goclusterfs): pace at quarters instead of every block Waiting after every block made the test take 30 s under -race. Three waits, after each quarter of the file, are enough to show the reader three sizes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #145, as the PM asked. #145 zeroed every new block before a partial write. FUSE hands writes over in 128 KiB pieces, so that doubled the bytes written for all new data.
The rule now
[S, min(start, end of S's block))first. It goes in as a zero segment through the normal write loop, so a block shared with a snapshot or clone is copied, with the usual lock order.zeroPastEndis gone.Locking, so growth never wipes another node's unsized data
Cost
TestSequentialWriteWritesDataOncewrites 16 MiB in 128 KiB pieces and requires at most 1.2x its size, from wchar. It measures 1.04x; at fix: never let a read show bytes nobody wrote to the file #145 it was 2.04x.-raceon .66 went from 819 s to 524 s, with the soak running alongside.Tests
TestGrowingWriteNeverZeroesAnotherNodesAppend: one node appends while another writes past EOF.Results on .66
-raceover./internal/...and./tests/soak: all packages pass except one load-timing test ininternal/lock, a package this PR doesn't touch, which passed 3/3 when rerun alone.🤖 Generated with Claude Code