diff options
Diffstat (limited to 'weed/storage/store.go')
| -rw-r--r-- | weed/storage/store.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/storage/store.go b/weed/storage/store.go index 2d9707571..77cd6c824 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -202,6 +202,17 @@ func (s *Store) addVolume(vid needle.VolumeId, collection string, needleMapKind // hasFreeDiskLocation checks if a disk location has free space func (s *Store) hasFreeDiskLocation(location *DiskLocation) bool { + // Check if disk space is low first + if location.isDiskSpaceLow { + return false + } + + // If MaxVolumeCount is 0, it means unlimited volumes are allowed + if location.MaxVolumeCount == 0 { + return true + } + + // Check if current volume count is below the maximum return int64(location.VolumesLen()) < int64(location.MaxVolumeCount) } |
