fix: silent noop ftruncate, remove FOPEN_KEEP_CACHE, add --no-disk-cache#27
Merged
Conversation
ftruncate(fd, N) on an empty/new file now sets size=N and marks the inode as sparse instead of uploading N bytes of zeros to CAS. Reads on sparse files return zeros directly. The sparse flag is cleared when the file is opened for real writes (O_TRUNC). This makes ftruncate instant (metadata-only) like ext4, instead of triggering a full CAS upload cycle. Useful for any tool that pre-allocates files via ftruncate before writing.
Contributor
Benchmark Results |
Contributor
POSIX Compliance (pjdfstest) |
Allows benchmarking without the on-disk xorb cache, comparable to mountpoint-s3 without --cache. Reads go directly to CAS on each FUSE miss (OS page cache still applies). The FileDownloadSession API already supported None for chunk_cache; this wires it up via a CLI flag and a HF_NO_DISK_CACHE=1 env var in the benchmark scripts.
Drop FOPEN_KEEP_CACHE from FUSE open() reply, matching mountpoint-s3's approach. Without this flag, the kernel invalidates the page cache on each open(), ensuring reads fetch fresh data from the remote. Previously, FOPEN_KEEP_CACHE preserved stale page cache across re-opens, which both masked data staleness issues and inflated benchmark numbers (reads served from DRAM instead of CAS).
The sparse pre-allocation feature added significant complexity (sparse field, 6 code paths, rollback logic) for a single use case (fio --create_only) that we no longer need since read benchmarks now write real data first. Simple mode now silently ignores setattr(size) like mountpoint-s3 does. Advanced-writes mode keeps its existing staging file resize behavior.
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.
Summary
setattr(size)returns success without changing the inode, instead of returning EPERM. Real truncation goes throughopen(O_TRUNC).open(), ensuring fresh data from remote.--no-disk-cacheflag: disables xorb chunk cache so every read fetches from CAS. Useful for benchmarking.Changes
setattr-- simple mode returns Ok instead of EPERM for size changes (noop, size unchanged)fuse.rs--FopenFlags::empty()instead ofFOPEN_KEEP_CACHEsetup.rs-- new--no-disk-cacheCLI flag, conditionally creates xorb cachesetattr_simple_mode_epermrenamed tosetattr_simple_mode_noop, newsetattr_simple_mode_empty_file_nooptestREADME.md-- added--no-disk-cacheto options table