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.
This commit is contained in:
Eelco Dolstra 2012-03-26 20:00:02 +02:00
parent 19d9762ad5
commit 8be1979f1a
7 changed files with 3 additions and 30 deletions

View file

@ -212,7 +212,6 @@ linkend="sec-nix-build"><command>nix-build</command></link> does.</para>
<arg choice='plain'><option>--delete</option></arg> <arg choice='plain'><option>--delete</option></arg>
</group> </group>
<arg><option>--max-freed</option> <replaceable>bytes</replaceable></arg> <arg><option>--max-freed</option> <replaceable>bytes</replaceable></arg>
<arg><option>--max-links</option> <replaceable>nrlinks</replaceable></arg>
</cmdsynopsis> </cmdsynopsis>
</refsection> </refsection>
@ -280,16 +279,6 @@ options control what gets deleted and in what order:
</varlistentry> </varlistentry>
<varlistentry><term><option>--max-links</option> <replaceable>nrlinks</replaceable></term>
<listitem><para>Keep deleting paths until the hard link count on
<filename>/nix/store</filename> is less than
<replaceable>nrlinks</replaceable>, then stop. This is useful for
very large Nix stores on filesystems with a 32000 subdirectories
limit (like <literal>ext3</literal>).</para></listitem>
</varlistentry>
</variablelist> </variablelist>
</para> </para>

View file

@ -418,7 +418,7 @@ bool LocalStore::isActiveTempFile(const GCState & state,
&& state.tempRoots.find(string(path, 0, path.size() - suffix.size())) != state.tempRoots.end(); && state.tempRoots.find(string(path, 0, path.size() - suffix.size())) != state.tempRoots.end();
} }
bool LocalStore::tryToDelete(GCState & state, const Path & path) bool LocalStore::tryToDelete(GCState & state, const Path & path)
{ {
checkInterrupt(); checkInterrupt();
@ -514,16 +514,6 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path)
throw GCLimitReached(); 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 } else
printMsg(lvlTalkative, format("would delete `%1%'") % path); printMsg(lvlTalkative, format("would delete `%1%'") % path);

View file

@ -466,7 +466,7 @@ void RemoteStore::collectGarbage(const GCOptions & options, GCResults & results)
writeStrings(options.pathsToDelete, to); writeStrings(options.pathsToDelete, to);
writeInt(options.ignoreLiveness, to); writeInt(options.ignoreLiveness, to);
writeLongLong(options.maxFreed, to); writeLongLong(options.maxFreed, to);
writeInt(options.maxLinks, to); writeInt(0, to);
if (GET_PROTOCOL_MINOR(daemonVersion) >= 5) { if (GET_PROTOCOL_MINOR(daemonVersion) >= 5) {
/* removed options */ /* removed options */
writeInt(0, to); writeInt(0, to);

View file

@ -13,7 +13,6 @@ GCOptions::GCOptions()
action = gcDeleteDead; action = gcDeleteDead;
ignoreLiveness = false; ignoreLiveness = false;
maxFreed = 0; maxFreed = 0;
maxLinks = 0;
} }

View file

@ -53,10 +53,6 @@ struct GCOptions
no limit. */ no limit. */
unsigned long long maxFreed; unsigned long long maxFreed;
/* Stop after the number of hard links to the Nix store directory
has dropped below `maxLinks'. */
unsigned int maxLinks;
GCOptions(); GCOptions();
}; };

View file

@ -562,7 +562,6 @@ static void opGC(Strings opFlags, Strings opArgs)
long long maxFreed = getIntArg<long long>(*i, i, opFlags.end()); long long maxFreed = getIntArg<long long>(*i, i, opFlags.end());
options.maxFreed = maxFreed >= 1 ? maxFreed : 1; options.maxFreed = maxFreed >= 1 ? maxFreed : 1;
} }
else if (*i == "--max-links") options.maxLinks = getIntArg<unsigned int>(*i, i, opFlags.end());
else throw UsageError(format("bad sub-operation `%1%' in GC") % *i); else throw UsageError(format("bad sub-operation `%1%' in GC") % *i);
if (!opArgs.empty()) throw UsageError("no arguments expected"); if (!opArgs.empty()) throw UsageError("no arguments expected");

View file

@ -477,7 +477,7 @@ static void performOp(unsigned int clientVersion,
options.pathsToDelete = readStorePaths<PathSet>(from); options.pathsToDelete = readStorePaths<PathSet>(from);
options.ignoreLiveness = readInt(from); options.ignoreLiveness = readInt(from);
options.maxFreed = readLongLong(from); options.maxFreed = readLongLong(from);
options.maxLinks = readInt(from); readInt(from); // obsolete field
if (GET_PROTOCOL_MINOR(clientVersion) >= 5) { if (GET_PROTOCOL_MINOR(clientVersion) >= 5) {
/* removed options */ /* removed options */
readInt(from); readInt(from);