mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
pick disks which are common maximally used (#10600)
further optimization to ensure that good disks are always used for listing, other than healing we only use disks that are maximally used.
This commit is contained in:
@@ -25,10 +25,8 @@ package disk
|
||||
type Info struct {
|
||||
Total uint64
|
||||
Free uint64
|
||||
Used uint64
|
||||
Files uint64
|
||||
Ffree uint64
|
||||
FSType string
|
||||
|
||||
// Usage is calculated per tenant.
|
||||
Usage uint64
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package disk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -37,5 +38,9 @@ func GetInfo(path string) (info Info, err error) {
|
||||
Ffree: uint64(s.Ffree),
|
||||
FSType: getFSType(s.Fstypename[:]),
|
||||
}
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -45,5 +45,6 @@ func GetInfo(path string) (info Info, err error) {
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -76,5 +76,6 @@ func GetInfo(path string) (info Info, err error) {
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -76,5 +76,6 @@ func GetInfo(path string) (info Info, err error) {
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package disk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -36,5 +38,9 @@ func GetInfo(path string) (info Info, err error) {
|
||||
Ffree: uint64(s.Ffree),
|
||||
FSType: string(s.Fstypename[:]),
|
||||
}
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package disk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
@@ -37,5 +38,9 @@ func GetInfo(path string) (info Info, err error) {
|
||||
Ffree: uint64(s.F_ffree),
|
||||
FSType: getFSType(s.F_fstypename[:]),
|
||||
}
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package disk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -36,5 +38,9 @@ func GetInfo(path string) (info Info, err error) {
|
||||
Ffree: uint64(s.Ffree),
|
||||
FSType: getFSType(s.Fstr[:]),
|
||||
}
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package disk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
@@ -90,5 +91,9 @@ func GetInfo(path string) (info Info, err error) {
|
||||
info.Files = uint64(lpTotalNumberOfClusters)
|
||||
info.Ffree = uint64(lpNumberOfFreeClusters)
|
||||
|
||||
if info.Free > info.Total {
|
||||
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
|
||||
}
|
||||
info.Used = info.Total - info.Free
|
||||
return info, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user