gc: remove unneccessary full repo scan
GetStorageUsage() is super expensive as it involves a full repo scan, and it's already bad enough that we have do it once. The call that's being removed here is purely for cosmetical purposes: printing the number of bytes freed by the GC run. Let's drop it. License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
Lars Gierth committed
Dec 9, 2016 at 17:28 UTC
2836c646420d220518e3563e862ab6608f10633c
1 file changed
+1
-13
core/corerepo/gc.go
+1
-13
@@ -194,19 +194,7 @@ func (gc *GC) maybeGC(ctx context.Context, offset uint64) error {
194
if err := GarbageCollect(gc.Node, ctx); err != nil {
195
return err
196
}
197
- newStorage, err := gc.Repo.GetStorageUsage()
198
- if err != nil {
199
- return err
200
- }
201
- log.Infof("Repo GC done. Released %s\n", humanize.Bytes(uint64(storage-newStorage)))
202
- if newStorage > gc.StorageGC {
203
- log.Warningf("post-GC: Watermark still exceeded")
204
- if newStorage > gc.StorageMax {
205
- err := ErrMaxStorageExceeded
206
- log.Error(err)
207
- return err
208
- }
209
- }
197
+ log.Infof("Repo GC done. See `ipfs repo stat` to see how much space got freed.\n")
198
}
199
return nil
200
}