aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 366dbfb0a..a166f4ee2 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -690,9 +690,8 @@ void LocalStore::removeUnusedLinks(const GCState & state)
throw SysError(format("statting '%1%'") % path);
if (st.st_nlink != 1) {
- unsigned long long size = st.st_blocks * 512ULL;
- actualSize += size;
- unsharedSize += (st.st_nlink - 1) * size;
+ actualSize += st.st_size;
+ unsharedSize += (st.st_nlink - 1) * st.st_size;
continue;
}
@@ -701,7 +700,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
if (unlink(path.c_str()) == -1)
throw SysError(format("deleting '%1%'") % path);
- state.results.bytesFreed += st.st_blocks * 512ULL;
+ state.results.bytesFreed += st.st_size;
}
struct stat st;
@@ -920,11 +919,11 @@ void LocalStore::autoGC(bool sync)
promise.set_value();
});
- printInfo("running auto-GC to free %d bytes", settings.maxFree - avail);
-
GCOptions options;
options.maxFreed = settings.maxFree - avail;
+ printInfo("running auto-GC to free %d bytes", options.maxFreed);
+
GCResults results;
collectGarbage(options, results);