aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-11 18:46:23 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-12 00:19:09 +0100
commit7033c7692ccbbbad8f7b9952015de071a5588e87 (patch)
treeb9745bafa5fc88819f55224aa06a048d760ca063 /nix/libstore
parent79154f0a09ad748839f88120ddd61a0e1e147b5e (diff)
downloadguix-7033c7692ccbbbad8f7b9952015de071a5588e87.tar.gz
guix-7033c7692ccbbbad8f7b9952015de071a5588e87.zip
daemon: Account for deleted store files when deduplication is on.
Previously, a store item that is a regular file would not be accounted for in the 'bytesFreed' value computed by 'deletePath' because its 'st_nlink' count would always be >= 2. This commit fixes that. * nix/libutil/util.hh (deletePath): Add optional 'linkThreshold' argument. * nix/libutil/util.cc (_deletePath): Add 'linkThreshold' argument and honor it. Pass it down in recursive call. (deletePath): Add 'linkThreshold' and honor it. * nix/libstore/gc.cc (LocalStore::deleteGarbage): Pass 'linkThreshold' argument to 'deletePath', with a value of 2 when PATH is a store item and deduplication is on.
Diffstat (limited to 'nix/libstore')
-rw-r--r--nix/libstore/gc.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 29b75aa875..5043963fa2 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -392,7 +392,14 @@ bool LocalStore::isActiveTempFile(const GCState & state,
void LocalStore::deleteGarbage(GCState & state, const Path & path)
{
unsigned long long bytesFreed;
- deletePath(path, bytesFreed);
+
+ /* When deduplication is on, store items always have at least two links:
+ the one at PATH, and one in /gnu/store/.links. In that case, increase
+ bytesFreed when PATH has two or fewer links. */
+ size_t linkThreshold =
+ (settings.autoOptimiseStore && isStorePath(path)) ? 2 : 1;
+
+ deletePath(path, bytesFreed, linkThreshold);
state.results.bytesFreed += bytesFreed;
}
le='2022-09-28 13:52:12 +0300'>2022-09-28gnu: exa: Only build with pandoc when supported.Efraim Flashner 2022-09-28gnu: exa: Don't install source.Efraim Flashner 2022-09-28gnu: exa: Update to 0.10.1.gyara 2022-09-24gnu: Add rot8.M 2022-09-09gnu: Explicitly use OpenSSL 1.1 in more packages.Marius Bakke 2022-09-05gnu: Add rust-cbindgen-0.17.Ricardo Wurmus 2022-09-01gnu: Add treefmt.Gabriel Arazas 2022-06-20gnu: rust-cargo-c: Add missing input.Efraim Flashner 2022-03-02gnu: tectonic: Update to 0.8.2.Nicolas Goaziou 2022-03-01gnu: tectonic: Update to 0.8.1.Nicolas Goaziou 2022-02-28gnu: bat: Update to 0.20.0.Nicolas Goaziou 2022-02-15gnu: alfis: Remove 'relax-requirements phase.Efraim Flashner 2022-02-14gnu: Add rtss.Jai Vetrivelan 2022-02-14gnu: alfis: Fix build.Aleksandr Vityazev 2022-01-28gnu: rust-zeroize-1: Update to 1.5.0.Attila Lendvai 2022-01-22gnu: rust-analyzer: Make it work out of the box.Z572 via Guix-patches via 2022-01-22gnu: Add alfis.Aleksandr Vityazev 2022-01-21gnu: rust-analyzer: Update to 2022-01-10.Z572 2022-01-19gnu: Add rbw.Nicolas Graves 2022-01-14gnu: Add git-interactive-rebase-tool.jgart 2022-01-13gnu: git-absorb: Fix build.Jelle Licht 2022-01-11gnu: Add swayhide.Nicolas Graves 2022-01-09gnu: bat: Update to 0.19.0.Nicolas Goaziou