diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-09-23 19:19:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-23 19:19:21 +0200 |
commit | 8ee779da7dabeef935ec61667120aa26743e472a (patch) | |
tree | 27971be49f0842bd04839b513cc2d0228e178da7 /src/libutil/archive.cc | |
parent | 9c95a8bebf986a6e8b6298cccdc97353843bda38 (diff) | |
parent | 2548347bba2d4e6f9947dadf95ed24a16f8a1cdc (diff) |
Merge pull request #4057 from martinetd/btrfs-compression
nix/store on btrfs compression: add workaround
Diffstat (limited to 'src/libutil/archive.cc')
-rw-r--r-- | src/libutil/archive.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc index 14399dea3..cdf3d89ae 100644 --- a/src/libutil/archive.cc +++ b/src/libutil/archive.cc @@ -27,6 +27,8 @@ struct ArchiveSettings : Config #endif "use-case-hack", "Whether to enable a Darwin-specific hack for dealing with file name collisions."}; + Setting<bool> preallocateContents{this, true, "preallocate-contents", + "Whether to preallocate files when writing objects with known size."}; }; static ArchiveSettings archiveSettings; @@ -325,6 +327,9 @@ struct RestoreSink : ParseSink void preallocateContents(uint64_t len) { + if (!archiveSettings.preallocateContents) + return; + #if HAVE_POSIX_FALLOCATE if (len) { errno = posix_fallocate(fd.get(), 0, len); |