mirror of
https://github.com/minio/minio.git
synced 2025-04-24 04:10:43 -04:00
fix: Remove unnecessary loops for searchParent (#19353)
This commit is contained in:
parent
364d3a0ac9
commit
ec3a3bb10d
@ -523,22 +523,20 @@ func (d *dataUsageCache) searchParent(h dataUsageHash) *dataUsageHash {
|
|||||||
want := h.Key()
|
want := h.Key()
|
||||||
if idx := strings.LastIndexByte(want, '/'); idx >= 0 {
|
if idx := strings.LastIndexByte(want, '/'); idx >= 0 {
|
||||||
if v := d.find(want[:idx]); v != nil {
|
if v := d.find(want[:idx]); v != nil {
|
||||||
for child := range v.Children {
|
_, ok := v.Children[want]
|
||||||
if child == want {
|
if ok {
|
||||||
found := hashPath(want[:idx])
|
found := hashPath(want[:idx])
|
||||||
return &found
|
return &found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for k, v := range d.Cache {
|
for k, v := range d.Cache {
|
||||||
for child := range v.Children {
|
_, ok := v.Children[want]
|
||||||
if child == want {
|
if ok {
|
||||||
found := dataUsageHash(k)
|
found := dataUsageHash(k)
|
||||||
return &found
|
return &found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user