From d3aa183beb774c20cb77052248cf45e684d134fb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Jun 2008 14:20:16 +0000 Subject: * Garbage collector: option `--max-freed' to stop after at least N bytes have been freed, `--max-links' to stop when the Nix store directory has fewer than N hard links (the latter being important for very large Nix stores on filesystems with a 32000 subdirectories limit). --- src/nix-store/nix-store.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/nix-store') diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 9618823ea681..b59ff27bb30c 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -528,6 +528,8 @@ static void opGC(Strings opFlags, Strings opArgs) else if (*i == "--print-live") options.action = GCOptions::gcReturnLive; else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead; else if (*i == "--delete") options.action = GCOptions::gcDeleteDead; + else if (*i == "--max-freed") options.maxFreed = getIntArg(*i, i, opFlags.end()); + else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end()); else throw UsageError(format("bad sub-operation `%1%' in GC") % *i); PrintFreed freed( @@ -744,8 +746,12 @@ void run(Strings args) } else if (arg == "--indirect") indirectRoot = true; - else if (arg[0] == '-') + else if (arg[0] == '-') { opFlags.push_back(arg); + if (arg == "--max-freed" || arg == "--max-links") { /* !!! hack */ + if (i != args.end()) opFlags.push_back(*i++); + } + } else opArgs.push_back(arg); -- cgit 1.4.1