[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
79/118: Allow regular files as GC roots
From: |
Ludovic Courtès |
Subject: |
79/118: Allow regular files as GC roots |
Date: |
Tue, 19 May 2015 14:45:48 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit a98fa2d9e2b06e2561330c5ef845ffaf131e95ac
Author: Eelco Dolstra <address@hidden>
Date: Fri Aug 1 16:46:01 2014 +0200
Allow regular files as GC roots
If a root is a regular file, then its name must denote a store
path. For instance, the existence of the file
/nix/var/nix/gcroots/per-user/eelco/hydra-roots/wzc3cy1wwwd6d0dgxpa77ijr1yp50s6v-libxml2-2.7.7
would cause
/nix/store/wzc3cy1wwwd6d0dgxpa77ijr1yp50s6v-libxml2-2.7.7
to be a root.
This is useful because it involves less I/O (no need for a readlink()
call) and takes up less disk space (the symlink target typically takes
up a full disk block, while directory entries are packed more
efficiently). This is particularly important for hydra.nixos.org,
which has hundreds of thousands of roots, and where reading the roots
can take 25 minutes.
---
nix/libstore/gc.cc | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index f90edac..e7285fb 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -328,6 +328,12 @@ static void findRoots(StoreAPI & store, const Path & path,
Roots & roots)
}
}
+ else if (S_ISREG(st.st_mode)) {
+ Path storePath = settings.nixStore + "/" + baseNameOf(path);
+ if (store.isValidPath(storePath))
+ roots[path] = storePath;
+ }
+
}
catch (SysError & e) {
- 76/118: nix-daemon: Simplify stderr handling, (continued)
- 76/118: nix-daemon: Simplify stderr handling, Ludovic Courtès, 2015/05/19
- 77/118: nix-daemon: Less verbosity, Ludovic Courtès, 2015/05/19
- 90/118: Remove unnecessary call to addTempRoot(), Ludovic Courtès, 2015/05/19
- 88/118: Move some options out of globals, Ludovic Courtès, 2015/05/19
- 83/118: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/05/19
- 84/118: Remove ugly hack for detecting build environment setup errors, Ludovic Courtès, 2015/05/19
- 85/118: Get rid of "killing <pid>" message for unused build hooks, Ludovic Courtès, 2015/05/19
- 93/118: Reduce verbosity, Ludovic Courtès, 2015/05/19
- 92/118: Propagate remote timeouts properly, Ludovic Courtès, 2015/05/19
- 87/118: Refactor, Ludovic Courtès, 2015/05/19
- 79/118: Allow regular files as GC roots,
Ludovic Courtès <=
- 89/118: Doh, Ludovic Courtès, 2015/05/19
- 78/118: Remove some dead code, Ludovic Courtès, 2015/05/19
- 82/118: Eliminate redundant copy, Ludovic Courtès, 2015/05/19
- 95/118: Make hook shutdown more reliable, Ludovic Courtès, 2015/05/19
- 81/118: findRoots(): Prevent a call to lstat(), Ludovic Courtès, 2015/05/19
- 101/118: On Linux, disable address space randomization, Ludovic Courtès, 2015/05/19
- 91/118: Use regular file GC roots if possible, Ludovic Courtès, 2015/05/19
- 102/118: Remove bogus comment, Ludovic Courtès, 2015/05/19
- 80/118: Make readDirectory() return inode / file type, Ludovic Courtès, 2015/05/19
- 94/118: Doh, Ludovic Courtès, 2015/05/19