From 8be1979f1ae4b85c36988f7b3cf8240c9682dc54 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 26 Mar 2012 20:00:02 +0200 Subject: [PATCH] Remove the --max-links GC option We don't need this anymore now that current filesystems support more than 32,000 files in a directory. --- doc/manual/nix-store.xml | 11 ----------- src/libstore/gc.cc | 12 +----------- src/libstore/remote-store.cc | 2 +- src/libstore/store-api.cc | 1 - src/libstore/store-api.hh | 4 ---- src/nix-store/nix-store.cc | 1 - src/nix-worker/nix-worker.cc | 2 +- 7 files changed, 3 insertions(+), 30 deletions(-) diff --git a/doc/manual/nix-store.xml b/doc/manual/nix-store.xml index a32559c03..aaacb7cfb 100644 --- a/doc/manual/nix-store.xml +++ b/doc/manual/nix-store.xml @@ -212,7 +212,6 @@ linkend="sec-nix-build">nix-build does. bytes - nrlinks @@ -280,16 +279,6 @@ options control what gets deleted and in what order: - nrlinks - - Keep deleting paths until the hard link count on - /nix/store is less than - nrlinks, then stop. This is useful for - very large Nix stores on filesystems with a 32000 subdirectories - limit (like ext3). - - - diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 95c715411..d81bf40c7 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -418,7 +418,7 @@ bool LocalStore::isActiveTempFile(const GCState & state, && state.tempRoots.find(string(path, 0, path.size() - suffix.size())) != state.tempRoots.end(); } - + bool LocalStore::tryToDelete(GCState & state, const Path & path) { checkInterrupt(); @@ -514,16 +514,6 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path) throw GCLimitReached(); } - if (state.options.maxLinks) { - struct stat st; - if (stat(nixStore.c_str(), &st) == -1) - throw SysError(format("statting `%1%'") % nixStore); - if (st.st_nlink < state.options.maxLinks) { - printMsg(lvlInfo, format("link count on the store has dropped below %1%; stopping") % state.options.maxLinks); - throw GCLimitReached(); - } - } - } else printMsg(lvlTalkative, format("would delete `%1%'") % path); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index c77a12870..0b8fa36f6 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -466,7 +466,7 @@ void RemoteStore::collectGarbage(const GCOptions & options, GCResults & results) writeStrings(options.pathsToDelete, to); writeInt(options.ignoreLiveness, to); writeLongLong(options.maxFreed, to); - writeInt(options.maxLinks, to); + writeInt(0, to); if (GET_PROTOCOL_MINOR(daemonVersion) >= 5) { /* removed options */ writeInt(0, to); diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 36ade2170..19bc048ab 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -13,7 +13,6 @@ GCOptions::GCOptions() action = gcDeleteDead; ignoreLiveness = false; maxFreed = 0; - maxLinks = 0; } diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 61bcaf505..a62a64816 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -53,10 +53,6 @@ struct GCOptions no limit. */ unsigned long long maxFreed; - /* Stop after the number of hard links to the Nix store directory - has dropped below `maxLinks'. */ - unsigned int maxLinks; - GCOptions(); }; diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 404da2c51..fa96725b1 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -562,7 +562,6 @@ static void opGC(Strings opFlags, Strings opArgs) long long maxFreed = getIntArg(*i, i, opFlags.end()); options.maxFreed = maxFreed >= 1 ? maxFreed : 1; } - else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end()); else throw UsageError(format("bad sub-operation `%1%' in GC") % *i); if (!opArgs.empty()) throw UsageError("no arguments expected"); diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index f5201ab6a..a95252350 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -477,7 +477,7 @@ static void performOp(unsigned int clientVersion, options.pathsToDelete = readStorePaths(from); options.ignoreLiveness = readInt(from); options.maxFreed = readLongLong(from); - options.maxLinks = readInt(from); + readInt(from); // obsolete field if (GET_PROTOCOL_MINOR(clientVersion) >= 5) { /* removed options */ readInt(from);