From b2db1e96e2caa589af7bd8beec67e4cc0f5292bf Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 21 Feb 2020 07:20:16 -0800 Subject: [PATCH] Remove crawler concurrency (#9023) Only have one crawler per disk. Removes locking, but keep fastwalk itself able to run concurrently. --- cmd/data-usage.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/cmd/data-usage.go b/cmd/data-usage.go index be1b622d2..7d84b76e2 100644 --- a/cmd/data-usage.go +++ b/cmd/data-usage.go @@ -22,7 +22,6 @@ import ( "encoding/json" "os" "path/filepath" - "sync" "time" jsoniter "github.com/json-iterator/go" @@ -160,10 +159,7 @@ func updateUsage(basePath string, doneCh <-chan struct{}, waitForLowActiveIO fun ObjectsSizesHistogram: make(map[string]uint64), } - numWorkers := 4 - var mutex sync.Mutex // Mutex to update dataUsageInfo - - fastWalk(basePath, numWorkers, doneCh, func(path string, typ os.FileMode) error { + fastWalk(basePath, 1, doneCh, func(path string, typ os.FileMode) error { // Wait for I/O to go down. waitForLowActiveIO() @@ -177,16 +173,11 @@ func updateUsage(basePath string, doneCh <-chan struct{}, waitForLowActiveIO fun } if entry == "" && typ&os.ModeDir != 0 { - mutex.Lock() dataUsageInfo.BucketsCount++ dataUsageInfo.BucketsSizes[bucket] = 0 - mutex.Unlock() return nil } - mutex.Lock() - defer mutex.Unlock() - if typ&os.ModeDir != 0 { return nil }