aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-10-20 16:11:29 -0700
committerGitHub <noreply@github.com>2025-10-20 16:11:29 -0700
commitffd43218f62b024580bb2a70dc86c36ef5501e0f (patch)
tree4f8f419e62c5e3dd610a96c04b2bc1818dc05379 /weed/storage/disk_location.go
parent3e8cc5a90668ad934a6f86a4e93783f2b7bb1364 (diff)
downloadseaweedfs-ffd43218f62b024580bb2a70dc86c36ef5501e0f.tar.xz
seaweedfs-ffd43218f62b024580bb2a70dc86c36ef5501e0f.zip
create new volumes on less occupied disk locations (#7349)
* create new volumes on less occupied disk locations * add unit tests * address comments * fixes
Diffstat (limited to 'weed/storage/disk_location.go')
-rw-r--r--weed/storage/disk_location.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go
index 02f5f5923..aac824318 100644
--- a/weed/storage/disk_location.go
+++ b/weed/storage/disk_location.go
@@ -386,6 +386,19 @@ func (l *DiskLocation) VolumesLen() int {
return len(l.volumes)
}
+func (l *DiskLocation) LocalVolumesLen() int {
+ l.volumesLock.RLock()
+ defer l.volumesLock.RUnlock()
+
+ count := 0
+ for _, v := range l.volumes {
+ if !v.HasRemoteFile() {
+ count++
+ }
+ }
+ return count
+}
+
func (l *DiskLocation) SetStopping() {
l.volumesLock.Lock()
for _, v := range l.volumes {