aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-04-18 08:47:55 -0700
committerchrislu <chris.lu@gmail.com>2024-04-18 08:47:55 -0700
commit31f1f960386ef1ad10fa5301e88e19c88e3756c1 (patch)
tree324b98073c82d4005a9803c6a4bb78260f12b498
parentd9490c5e1fd94e69c1ecd9528ee386cfe7ee73e1 (diff)
downloadseaweedfs-31f1f960386ef1ad10fa5301e88e19c88e3756c1.tar.xz
seaweedfs-31f1f960386ef1ad10fa5301e88e19c88e3756c1.zip
improve perf a bit
-rw-r--r--weed/topology/volume_layout.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go
index d04552d35..2296a0f92 100644
--- a/weed/topology/volume_layout.go
+++ b/weed/topology/volume_layout.go
@@ -370,6 +370,7 @@ func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) (total, a
return len(vl.writables), len(vl.writables), len(vl.crowded)
}
total = len(vl.writables)
+ threshold := option.Threshold()
for _, v := range vl.writables {
for _, dn := range vl.vid2location[v].list {
if dn.GetDataCenter().Id() == NodeId(option.DataCenter) {
@@ -381,7 +382,7 @@ func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) (total, a
}
active++
info, _ := dn.GetVolumesById(v)
- if float64(info.Size) > float64(vl.volumeSizeLimit)*option.Threshold() {
+ if float64(info.Size) > float64(vl.volumeSizeLimit)*threshold {
crowded++
}
}