nix/store on btrfs compression: add workaround #4057
Merged
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.
See #3550.
As suggested for now I've added a "preallocate-contents" option, and tested by restarting
nix-daemon
with/path/to/output/derivation/bin/nix-daemon --option preallocate-contents false
This works as a local fix but I definitely want to make this automatic for btrfs.
It's easy to call
statfs(realStoreDir.c_str(), &statfsbuf)
and check ifstatfsbuf.f_type == BTRFS_SUPER_MAGIC
; the question is how to make the setting "auto" ?I'm thinking of:
--option
switch? (I'm not too comfortable about introducing such a new setting type...)localStore
next tomakeStoreWritable
(e.g. some newcheckFsQuirks
method?), and if btrfs force the option somehow..globalConfig.set
? not really good with code compartimentization :/Needless to say I don't like what I just suggested very much, so suggestions or comments welcome.
This is at least a starting point and folks who care can set the option in their nix.conf until then (depending on timing on the 3.0 release I'd be greedy and ask if it'd be possible to backport in 2.3 maintenance branch, but let's discuss that after we agree on the auto part I guess!)
Thanks!