diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-08-29 14:49:58 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-08-29 14:49:58 +0200 |
commit | a2c4fcd5e9782dc8d2998773380c7171ee53b813 (patch) | |
tree | 8ded004bb7d06f44dd28c08c922771238cc85cea /src/libstore/gc.cc | |
parent | 31f5ecfaa5bce2282f50daed1e4f477c64705fb3 (diff) |
Don't rely on st_blocks
It doesn't seem very reliable on ZFS.
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r-- | src/libstore/gc.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index f73601679..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; |