From 01d56c1eeca497de247413a64a544605c53d9d41 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Aug 2012 22:34:46 -0400 Subject: Drop the block count in the garbage collector --- src/libstore/local-store.hh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/libstore/local-store.hh') diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 50910f353ad1..721cc6afbed5 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -304,8 +304,7 @@ void getOwnership(const Path & path); /* Like deletePath(), but changes the ownership of `path' using the setuid wrapper if necessary (and possible). */ -void deletePathWrapped(const Path & path, - unsigned long long & bytesFreed, unsigned long long & blocksFreed); +void deletePathWrapped(const Path & path, unsigned long long & bytesFreed); void deletePathWrapped(const Path & path); -- cgit 1.4.1 From 6763084ae53fc0228d50ab94bbbced89c1b14f1c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Aug 2012 22:43:03 -0400 Subject: Count bytes freed deleting unused links --- src/libstore/gc.cc | 6 ++++-- src/libstore/local-store.hh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libstore/local-store.hh') diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index a1bb4051cd1b..255dc3aa099f 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -575,7 +575,7 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path) safely deleted. FIXME: race condition with optimisePath(): we might see a link count of 1 just before optimisePath() increases the link count. */ -void LocalStore::removeUnusedLinks() +void LocalStore::removeUnusedLinks(const GCState & state) { AutoCloseDir dir = opendir(linksDir.c_str()); if (!dir) throw SysError(format("opening directory `%1%'") % linksDir); @@ -604,6 +604,8 @@ void LocalStore::removeUnusedLinks() if (unlink(path.c_str()) == -1) throw SysError(format("deleting `%1%'") % path); + + state.results.bytesFreed += st.st_blocks * 512; } struct stat st; @@ -732,7 +734,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) /* Clean up the links directory. */ printMsg(lvlError, format("deleting unused links...")); - removeUnusedLinks(); + removeUnusedLinks(state); } diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 721cc6afbed5..6a5e3641c4eb 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -264,7 +264,7 @@ private: int openGCLock(LockType lockType); - void removeUnusedLinks(); + void removeUnusedLinks(const GCState & state); void startSubstituter(const Path & substituter, RunningSubstituter & runningSubstituter); -- cgit 1.4.1