heal: calculate the number of workers based on NRRequests (#17945)

This commit is contained in:
Anis Eleuch
2023-09-11 14:48:54 -07:00
committed by GitHub
parent 9878031cfd
commit 41de53996b
10 changed files with 131 additions and 61 deletions

View File

@@ -114,6 +114,8 @@ type xlStorage struct {
formatData []byte
nrRequests uint64
// mutex to prevent concurrent read operations overloading walks.
rotational bool
walkMu *sync.Mutex
@@ -244,6 +246,11 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
diskIndex: -1,
}
// Sanitize before setting it
if info.NRRequests > 0 {
s.nrRequests = info.NRRequests
}
// We stagger listings only on HDDs.
if info.Rotational == nil || *info.Rotational {
s.rotational = true
@@ -658,6 +665,7 @@ func (s *xlStorage) DiskInfo(_ context.Context, _ bool) (info DiskInfo, err erro
dcinfo.UsedInodes = di.Files - di.Ffree
dcinfo.FreeInodes = di.Ffree
dcinfo.FSType = di.FSType
dcinfo.NRRequests = s.nrRequests
dcinfo.Rotational = s.rotational
diskID, err := s.GetDiskID()
// Healing is 'true' when