mirror of https://github.com/minio/minio.git
Remove minimum inodes reqd check (#4747)
This commit is contained in:
parent
f7889e1af7
commit
fcc61fa46a
|
@ -34,9 +34,9 @@ const (
|
|||
// StorageInfo - represents total capacity of underlying storage.
|
||||
type StorageInfo struct {
|
||||
// Total disk space.
|
||||
Total int64
|
||||
Total uint64
|
||||
// Free available disk space.
|
||||
Free int64
|
||||
Free uint64
|
||||
// Backend type.
|
||||
Backend struct {
|
||||
// Represents various backend types, currently on FS and Erasure.
|
||||
|
|
31
cmd/posix.go
31
cmd/posix.go
|
@ -35,11 +35,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
diskMinFreeSpace = 1 * humanize.GiByte // Min 1GiB free space.
|
||||
diskMinTotalSpace = diskMinFreeSpace // Min 1GiB total space.
|
||||
diskMinFreeInodes = 10000 // Min 10000 free inodes.
|
||||
diskMinTotalInodes = diskMinFreeInodes // Min 10000 total inodes.
|
||||
maxAllowedIOError = 5
|
||||
diskMinFreeSpace = 1 * humanize.GiByte // Min 1GiB free space.
|
||||
diskMinTotalSpace = diskMinFreeSpace // Min 1GiB total space.
|
||||
maxAllowedIOError = 5
|
||||
)
|
||||
|
||||
// posix - implements StorageAPI interface.
|
||||
|
@ -177,18 +175,6 @@ func checkDiskMinTotal(di disk.Info) (err error) {
|
|||
if int64(totalDiskSpace) <= diskMinTotalSpace {
|
||||
return errDiskFull
|
||||
}
|
||||
|
||||
// Some filesystems do not implement a way to provide total inodes available, instead
|
||||
// inodes are allocated based on available disk space. For example CephDISK, StoreNext CVDISK,
|
||||
// AzureFile driver. Allow for the available disk to be separately validated and we will
|
||||
// validate inodes only if total inodes are provided by the underlying filesystem.
|
||||
if di.Files != 0 && di.FSType != "NFS" {
|
||||
totalFiles := int64(di.Files)
|
||||
if totalFiles <= diskMinTotalInodes {
|
||||
return errDiskFull
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -200,17 +186,6 @@ func checkDiskMinFree(di disk.Info) error {
|
|||
return errDiskFull
|
||||
}
|
||||
|
||||
// Some filesystems do not implement a way to provide total inodes available, instead inodes
|
||||
// are allocated based on available disk space. For example CephDISK, StoreNext CVDISK, AzureFile driver.
|
||||
// Allow for the available disk to be separately validate and we will validate inodes only if
|
||||
// total inodes are provided by the underlying filesystem.
|
||||
if di.Files != 0 && di.FSType != "NFS" {
|
||||
availableFiles := int64(di.Ffree)
|
||||
if availableFiles <= diskMinFreeInodes {
|
||||
return errDiskFull
|
||||
}
|
||||
}
|
||||
|
||||
// Success.
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1686,14 +1686,14 @@ func TestCheckDiskTotalMin(t *testing.T) {
|
|||
},
|
||||
err: nil,
|
||||
},
|
||||
// Test 2 - when fstype is xfs and total inodes are small.
|
||||
// Test 2 - when fstype is xfs and total inodes are less than 10k.
|
||||
{
|
||||
diskInfo: disk.Info{
|
||||
Total: diskMinTotalSpace * 3,
|
||||
FSType: "XFS",
|
||||
Files: 9999,
|
||||
},
|
||||
err: errDiskFull,
|
||||
err: nil,
|
||||
},
|
||||
// Test 3 - when fstype is btrfs and total inodes is empty.
|
||||
{
|
||||
|
@ -1737,7 +1737,7 @@ func TestCheckDiskFreeMin(t *testing.T) {
|
|||
},
|
||||
err: nil,
|
||||
},
|
||||
// Test 2 - when fstype is xfs and total inodes are small.
|
||||
// Test 2 - when fstype is xfs and total inodes are less than 10k.
|
||||
{
|
||||
diskInfo: disk.Info{
|
||||
Free: diskMinTotalSpace * 3,
|
||||
|
@ -1745,7 +1745,7 @@ func TestCheckDiskFreeMin(t *testing.T) {
|
|||
Files: 9999,
|
||||
Ffree: 9999,
|
||||
},
|
||||
err: errDiskFull,
|
||||
err: nil,
|
||||
},
|
||||
// Test 3 - when fstype is btrfs and total inodes are empty.
|
||||
{
|
||||
|
|
|
@ -1594,8 +1594,9 @@ func TestWebObjectLayerFaultyDisks(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("Failed %v", err)
|
||||
}
|
||||
if storageInfoReply.StorageInfo.Total != -1 || storageInfoReply.StorageInfo.Free != -1 {
|
||||
t.Fatalf("Should get negative values of Total and Free since disks are faulty ")
|
||||
// if Total size is 0 it indicates faulty disk.
|
||||
if storageInfoReply.StorageInfo.Total != 0 {
|
||||
t.Fatalf("Should get zero Total size since disks are faulty ")
|
||||
}
|
||||
|
||||
// Test authorization of Web.Download
|
||||
|
|
|
@ -231,10 +231,11 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
|
|||
|
||||
// Sort so that the first element is the smallest.
|
||||
validDisksInfo := sortValidDisksInfo(disksInfo)
|
||||
// If there are no valid disks, set total and free disks to 0
|
||||
if len(validDisksInfo) == 0 {
|
||||
return StorageInfo{
|
||||
Total: -1,
|
||||
Free: -1,
|
||||
Total: 0,
|
||||
Free: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,8 +243,8 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
|
|||
// Free as the total aggregated values. Total capacity is always
|
||||
// the multiple of smallest disk among the disk list.
|
||||
storageInfo := StorageInfo{
|
||||
Total: validDisksInfo[0].Total * int64(onlineDisks) / 2,
|
||||
Free: validDisksInfo[0].Free * int64(onlineDisks) / 2,
|
||||
Total: validDisksInfo[0].Total * uint64(onlineDisks) / 2,
|
||||
Free: validDisksInfo[0].Free * uint64(onlineDisks) / 2,
|
||||
}
|
||||
|
||||
storageInfo.Backend.Type = Erasure
|
||||
|
|
|
@ -19,12 +19,14 @@ package disk
|
|||
// Info stat fs struct is container which holds following values
|
||||
// Total - total size of the volume / disk
|
||||
// Free - free size of the volume / disk
|
||||
// Type - file system type string
|
||||
// Files - total inodes available
|
||||
// Ffree - free inodes available
|
||||
// FSType - file system type
|
||||
type Info struct {
|
||||
Total int64
|
||||
Free int64
|
||||
Files int64
|
||||
Ffree int64
|
||||
Total uint64
|
||||
Free uint64
|
||||
Files uint64
|
||||
Ffree uint64
|
||||
FSType string
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ func GetInfo(path string) (info Info, err error) {
|
|||
return Info{}, err
|
||||
}
|
||||
info = Info{}
|
||||
info.Total = int64(s.Bsize) * int64(s.Blocks)
|
||||
info.Free = int64(s.Bsize) * int64(s.Bavail)
|
||||
info.Files = int64(s.Files)
|
||||
info.Ffree = int64(s.Ffree)
|
||||
info.Total = uint64(s.Bsize) * uint64(s.Blocks)
|
||||
info.Free = uint64(s.Bsize) * uint64(s.Bavail)
|
||||
info.Files = uint64(s.Files)
|
||||
info.Ffree = uint64(s.Ffree)
|
||||
info.FSType = getFSType(s.Fstypename)
|
||||
return info, nil
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ func GetInfo(path string) (info Info, err error) {
|
|||
return Info{}, err
|
||||
}
|
||||
info = Info{}
|
||||
info.Total = int64(s.Bsize) * int64(s.Blocks)
|
||||
info.Free = int64(s.Bsize) * int64(s.Bavail)
|
||||
info.Files = int64(s.Files)
|
||||
info.Ffree = int64(s.Ffree)
|
||||
info.Total = uint64(s.Bsize) * uint64(s.Blocks)
|
||||
info.Free = uint64(s.Bsize) * uint64(s.Bavail)
|
||||
info.Files = uint64(s.Files)
|
||||
info.Ffree = uint64(s.Ffree)
|
||||
info.FSType = getFSType(int64(s.Type))
|
||||
return info, nil
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ func GetInfo(path string) (info Info, err error) {
|
|||
return Info{}, err
|
||||
}
|
||||
info = Info{}
|
||||
info.Total = int64(s.F_bsize) * int64(s.F_blocks)
|
||||
info.Free = int64(s.F_bsize) * int64(s.F_bavail)
|
||||
info.Files = int64(s.F_files)
|
||||
info.Ffree = int64(s.F_ffree)
|
||||
info.Total = uint64(s.F_bsize) * uint64(s.F_blocks)
|
||||
info.Free = uint64(s.F_bsize) * uint64(s.F_bavail)
|
||||
info.Files = uint64(s.F_files)
|
||||
info.Ffree = uint64(s.F_ffree)
|
||||
info.FSType = getFSType(s.F_fstypename)
|
||||
return info, nil
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ func GetInfo(path string) (info Info, err error) {
|
|||
uintptr(unsafe.Pointer(&lpTotalNumberOfBytes)),
|
||||
uintptr(unsafe.Pointer(&lpTotalNumberOfFreeBytes)))
|
||||
info = Info{}
|
||||
info.Total = int64(lpTotalNumberOfBytes)
|
||||
info.Free = int64(lpFreeBytesAvailable)
|
||||
info.Total = uint64(lpTotalNumberOfBytes)
|
||||
info.Free = uint64(lpFreeBytesAvailable)
|
||||
info.FSType = getFSType(path)
|
||||
|
||||
// Return values of GetDiskFreeSpace()
|
||||
|
@ -88,8 +88,8 @@ func GetInfo(path string) (info Info, err error) {
|
|||
uintptr(unsafe.Pointer(&lpNumberOfFreeClusters)),
|
||||
uintptr(unsafe.Pointer(&lpTotalNumberOfClusters)))
|
||||
|
||||
info.Files = int64(lpTotalNumberOfClusters)
|
||||
info.Ffree = int64(lpNumberOfFreeClusters)
|
||||
info.Files = uint64(lpTotalNumberOfClusters)
|
||||
info.Ffree = uint64(lpNumberOfFreeClusters)
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue