mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
improve perf a bit
This commit is contained in:
parent
d9490c5e1f
commit
31f1f96038
@ -370,6 +370,7 @@ func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) (total, a
|
|||||||
return len(vl.writables), len(vl.writables), len(vl.crowded)
|
return len(vl.writables), len(vl.writables), len(vl.crowded)
|
||||||
}
|
}
|
||||||
total = len(vl.writables)
|
total = len(vl.writables)
|
||||||
|
threshold := option.Threshold()
|
||||||
for _, v := range vl.writables {
|
for _, v := range vl.writables {
|
||||||
for _, dn := range vl.vid2location[v].list {
|
for _, dn := range vl.vid2location[v].list {
|
||||||
if dn.GetDataCenter().Id() == NodeId(option.DataCenter) {
|
if dn.GetDataCenter().Id() == NodeId(option.DataCenter) {
|
||||||
@ -381,7 +382,7 @@ func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) (total, a
|
|||||||
}
|
}
|
||||||
active++
|
active++
|
||||||
info, _ := dn.GetVolumesById(v)
|
info, _ := dn.GetVolumesById(v)
|
||||||
if float64(info.Size) > float64(vl.volumeSizeLimit)*option.Threshold() {
|
if float64(info.Size) > float64(vl.volumeSizeLimit)*threshold {
|
||||||
crowded++
|
crowded++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user