summary refs log tree commit diff
path: root/nix/libstore/gc.cc
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2019-09-06 20:46:00 -0400
committerMark H Weaver <mhw@netris.org>2019-09-06 20:46:00 -0400
commit65542a8852759f35e19959149ac92297c8b54be5 (patch)
treebc8f398c7b10a4725b20aa59ab1452d30f358ea3 /nix/libstore/gc.cc
parentbc60349b5bc58a0b803df5adce1de6db82453744 (diff)
parentf66aee3d0d2f573187ed5d44ae7c13d73cd4097a (diff)
downloadguix-65542a8852759f35e19959149ac92297c8b54be5.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/libstore/gc.cc')
-rw-r--r--nix/libstore/gc.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 310b8792fe..46171e116c 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -569,9 +569,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;
         }
 
@@ -580,13 +579,13 @@ void LocalStore::removeUnusedLinks(const GCState & state)
         if (unlink(path.c_str()) == -1)
             throw SysError(format("deleting `%1%'") % path);
 
-        state.results.bytesFreed += st.st_blocks * 512;
+        state.results.bytesFreed += st.st_size;
     }
 
     struct stat st;
     if (stat(linksDir.c_str(), &st) == -1)
         throw SysError(format("statting `%1%'") % linksDir);
-    long long overhead = st.st_blocks * 512ULL;
+    long long overhead = st.st_size;
 
     printMsg(lvlInfo, format("note: currently hard linking saves %.2f MiB")
         % ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));