Repository navigation
perf(inode): replace syncutil.InvariantMutex with sync.Mutex in FileInode - #5218
Draft
kislaykishore wants to merge 1 commit into
Draft
kislaykishore wants to merge 1 commit into
kislaykishore wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces the custom syncutil.InvariantMutex with a standard sync.Mutex in FileInode. It manually integrates invariant checking inside NewFileInode, Lock, and Unlock methods, conditioned on syncutil.InvariantCheckingEnabled(). As there are no review comments provided, I have no additional feedback to offer.
kislaykishore
force-pushed
the
perf/file-inode-mutex-opt
branch
from
November 4, 2026 14:30
ed3a4f4 to
e7ad8a8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## perf/lru-memory-opt #5218 +/- ##
====================================================
Coverage 85.21% 85.21%
====================================================
Files 181 181
Lines 19946 19951 +5
====================================================
+ Hits 16997 17002 +5
Misses 2948 2948
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kislaykishore
force-pushed
the
perf/file-inode-mutex-opt
branch
2 times, most recently
from
November 13, 2026 14:43
6fceffb to
181b72a
Compare
kislaykishore
changed the base branch from
perf/lookup-count-memory-opt
to
perf/lru-memory-opt
November 13, 2026 14:47
kislaykishore
force-pushed
the
perf/file-inode-mutex-opt
branch
from
November 20, 2026 17:29
181b72a to
f5e1a01
Compare
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.
Description
Reduce
FileInodesize and per-inode heap allocations by replacingsyncutil.InvariantMutexwithsync.Mutex:mu syncutil.InvariantMutex(32 bytes, embeddingsync.RWMutexand afunc()callback) withmu sync.Mutex(8 bytes), saving 24 bytes perFileInode.f.checkInvariants()directly whensyncutil.InvariantCheckingEnabled()is true inNewFileInode,Lock(), andUnlock().f.checkInvariantsmethod-value closure heap allocation previously performed bysyncutil.NewInvariantMutex(f.checkInvariants)on everyNewFileInodecall.Link to the issue in case of a bug fix.
b/585048166
Testing details
make build.go test -v -race ./internal/fs/inode/...andgo test -tags=check_invariants -race ./internal/fs/inode/....Any backward incompatible change? If so, please explain.
N/A