[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/08: Use posix_fallocate to create /nix/var/nix/db/reserved
From: |
Ludovic Courtès |
Subject: |
05/08: Use posix_fallocate to create /nix/var/nix/db/reserved |
Date: |
Thu, 02 Jul 2015 22:34:06 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit 5e0a9ae2e25a1016389f4893a6ed6682aadcf51d
Author: Eelco Dolstra <address@hidden>
Date: Mon Jun 22 15:54:55 2015 +0200
Use posix_fallocate to create /nix/var/nix/db/reserved
---
nix/libstore/local-store.cc | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 9d8ae71..b2c7847 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -288,7 +288,17 @@ LocalStore::LocalStore(bool reserveSpace)
struct stat st;
if (stat(reservedPath.c_str(), &st) == -1 ||
st.st_size != settings.reservedSize)
- writeFile(reservedPath, string(settings.reservedSize, 'X'));
+ {
+ AutoCloseFD fd = open(reservedPath.c_str(), O_WRONLY |
O_CREAT, 0600);
+ int res = -1;
+#if HAVE_POSIX_FALLOCATE
+ res = posix_fallocate(fd, 0, settings.reservedSize);
+#endif
+ if (res == -1) {
+ writeFull(fd, string(settings.reservedSize, 'X'));
+ ftruncate(fd, settings.reservedSize);
+ }
+ }
}
else
deletePath(reservedPath);
- branch nix updated (e531520 -> 0dccab9), Ludovic Courtès, 2015/07/02
- 01/08: Allow substitutes for builds that have preferLocalBuild set, Ludovic Courtès, 2015/07/02
- 03/08: Export outputPaths function, Ludovic Courtès, 2015/07/02
- 04/08: Make /nix/var/nix/db/reserved bigger, Ludovic Courtès, 2015/07/02
- 05/08: Use posix_fallocate to create /nix/var/nix/db/reserved,
Ludovic Courtès <=
- 06/08: GC: Handle ENOSPC creating/moving to the trash directory, Ludovic Courtès, 2015/07/02
- 02/08: Use std::vector::data(), Ludovic Courtès, 2015/07/02
- 08/08: Typo, Ludovic Courtès, 2015/07/02
- 07/08: Preserve supplementary groups of build users, Ludovic Courtès, 2015/07/02