Remove minimum inodes reqd check (#4747)

master
Nitish Tiwari 8 years ago committed by Dee Koder
parent f7889e1af7
commit fcc61fa46a
  1. 4
      cmd/object-api-datatypes.go
  2. 25
      cmd/posix.go
  3. 8
      cmd/posix_test.go
  4. 5
      cmd/web-handlers_test.go
  5. 9
      cmd/xl-v1.go
  6. 12
      pkg/disk/disk.go
  7. 8
      pkg/disk/stat_bsd.go
  8. 8
      pkg/disk/stat_linux.go
  9. 8
      pkg/disk/stat_openbsd.go
  10. 8
      pkg/disk/stat_windows.go

@ -34,9 +34,9 @@ const (
// StorageInfo - represents total capacity of underlying storage. // StorageInfo - represents total capacity of underlying storage.
type StorageInfo struct { type StorageInfo struct {
// Total disk space. // Total disk space.
Total int64 Total uint64
// Free available disk space. // Free available disk space.
Free int64 Free uint64
// Backend type. // Backend type.
Backend struct { Backend struct {
// Represents various backend types, currently on FS and Erasure. // Represents various backend types, currently on FS and Erasure.

@ -37,8 +37,6 @@ import (
const ( const (
diskMinFreeSpace = 1 * humanize.GiByte // Min 1GiB free space. diskMinFreeSpace = 1 * humanize.GiByte // Min 1GiB free space.
diskMinTotalSpace = diskMinFreeSpace // Min 1GiB total space. diskMinTotalSpace = diskMinFreeSpace // Min 1GiB total space.
diskMinFreeInodes = 10000 // Min 10000 free inodes.
diskMinTotalInodes = diskMinFreeInodes // Min 10000 total inodes.
maxAllowedIOError = 5 maxAllowedIOError = 5
) )
@ -177,18 +175,6 @@ func checkDiskMinTotal(di disk.Info) (err error) {
if int64(totalDiskSpace) <= diskMinTotalSpace { if int64(totalDiskSpace) <= diskMinTotalSpace {
return errDiskFull 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 return nil
} }
@ -200,17 +186,6 @@ func checkDiskMinFree(di disk.Info) error {
return errDiskFull 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. // Success.
return nil return nil
} }

@ -1686,14 +1686,14 @@ func TestCheckDiskTotalMin(t *testing.T) {
}, },
err: nil, 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{ diskInfo: disk.Info{
Total: diskMinTotalSpace * 3, Total: diskMinTotalSpace * 3,
FSType: "XFS", FSType: "XFS",
Files: 9999, Files: 9999,
}, },
err: errDiskFull, err: nil,
}, },
// Test 3 - when fstype is btrfs and total inodes is empty. // Test 3 - when fstype is btrfs and total inodes is empty.
{ {
@ -1737,7 +1737,7 @@ func TestCheckDiskFreeMin(t *testing.T) {
}, },
err: nil, 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{ diskInfo: disk.Info{
Free: diskMinTotalSpace * 3, Free: diskMinTotalSpace * 3,
@ -1745,7 +1745,7 @@ func TestCheckDiskFreeMin(t *testing.T) {
Files: 9999, Files: 9999,
Ffree: 9999, Ffree: 9999,
}, },
err: errDiskFull, err: nil,
}, },
// Test 3 - when fstype is btrfs and total inodes are empty. // Test 3 - when fstype is btrfs and total inodes are empty.
{ {

@ -1594,8 +1594,9 @@ func TestWebObjectLayerFaultyDisks(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Failed %v", err) t.Fatalf("Failed %v", err)
} }
if storageInfoReply.StorageInfo.Total != -1 || storageInfoReply.StorageInfo.Free != -1 { // if Total size is 0 it indicates faulty disk.
t.Fatalf("Should get negative values of Total and Free since disks are faulty ") if storageInfoReply.StorageInfo.Total != 0 {
t.Fatalf("Should get zero Total size since disks are faulty ")
} }
// Test authorization of Web.Download // Test authorization of Web.Download

@ -231,10 +231,11 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
// Sort so that the first element is the smallest. // Sort so that the first element is the smallest.
validDisksInfo := sortValidDisksInfo(disksInfo) validDisksInfo := sortValidDisksInfo(disksInfo)
// If there are no valid disks, set total and free disks to 0
if len(validDisksInfo) == 0 { if len(validDisksInfo) == 0 {
return StorageInfo{ return StorageInfo{
Total: -1, Total: 0,
Free: -1, Free: 0,
} }
} }
@ -242,8 +243,8 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
// Free as the total aggregated values. Total capacity is always // Free as the total aggregated values. Total capacity is always
// the multiple of smallest disk among the disk list. // the multiple of smallest disk among the disk list.
storageInfo := StorageInfo{ storageInfo := StorageInfo{
Total: validDisksInfo[0].Total * int64(onlineDisks) / 2, Total: validDisksInfo[0].Total * uint64(onlineDisks) / 2,
Free: validDisksInfo[0].Free * int64(onlineDisks) / 2, Free: validDisksInfo[0].Free * uint64(onlineDisks) / 2,
} }
storageInfo.Backend.Type = Erasure storageInfo.Backend.Type = Erasure

@ -19,12 +19,14 @@ package disk
// Info stat fs struct is container which holds following values // Info stat fs struct is container which holds following values
// Total - total size of the volume / disk // Total - total size of the volume / disk
// Free - free 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 { type Info struct {
Total int64 Total uint64
Free int64 Free uint64
Files int64 Files uint64
Ffree int64 Ffree uint64
FSType string FSType string
} }

@ -30,10 +30,10 @@ func GetInfo(path string) (info Info, err error) {
return Info{}, err return Info{}, err
} }
info = Info{} info = Info{}
info.Total = int64(s.Bsize) * int64(s.Blocks) info.Total = uint64(s.Bsize) * uint64(s.Blocks)
info.Free = int64(s.Bsize) * int64(s.Bavail) info.Free = uint64(s.Bsize) * uint64(s.Bavail)
info.Files = int64(s.Files) info.Files = uint64(s.Files)
info.Ffree = int64(s.Ffree) info.Ffree = uint64(s.Ffree)
info.FSType = getFSType(s.Fstypename) info.FSType = getFSType(s.Fstypename)
return info, nil return info, nil
} }

@ -30,10 +30,10 @@ func GetInfo(path string) (info Info, err error) {
return Info{}, err return Info{}, err
} }
info = Info{} info = Info{}
info.Total = int64(s.Bsize) * int64(s.Blocks) info.Total = uint64(s.Bsize) * uint64(s.Blocks)
info.Free = int64(s.Bsize) * int64(s.Bavail) info.Free = uint64(s.Bsize) * uint64(s.Bavail)
info.Files = int64(s.Files) info.Files = uint64(s.Files)
info.Ffree = int64(s.Ffree) info.Ffree = uint64(s.Ffree)
info.FSType = getFSType(int64(s.Type)) info.FSType = getFSType(int64(s.Type))
return info, nil return info, nil
} }

@ -30,10 +30,10 @@ func GetInfo(path string) (info Info, err error) {
return Info{}, err return Info{}, err
} }
info = Info{} info = Info{}
info.Total = int64(s.F_bsize) * int64(s.F_blocks) info.Total = uint64(s.F_bsize) * uint64(s.F_blocks)
info.Free = int64(s.F_bsize) * int64(s.F_bavail) info.Free = uint64(s.F_bsize) * uint64(s.F_bavail)
info.Files = int64(s.F_files) info.Files = uint64(s.F_files)
info.Ffree = int64(s.F_ffree) info.Ffree = uint64(s.F_ffree)
info.FSType = getFSType(s.F_fstypename) info.FSType = getFSType(s.F_fstypename)
return info, nil return info, nil
} }

@ -64,8 +64,8 @@ func GetInfo(path string) (info Info, err error) {
uintptr(unsafe.Pointer(&lpTotalNumberOfBytes)), uintptr(unsafe.Pointer(&lpTotalNumberOfBytes)),
uintptr(unsafe.Pointer(&lpTotalNumberOfFreeBytes))) uintptr(unsafe.Pointer(&lpTotalNumberOfFreeBytes)))
info = Info{} info = Info{}
info.Total = int64(lpTotalNumberOfBytes) info.Total = uint64(lpTotalNumberOfBytes)
info.Free = int64(lpFreeBytesAvailable) info.Free = uint64(lpFreeBytesAvailable)
info.FSType = getFSType(path) info.FSType = getFSType(path)
// Return values of GetDiskFreeSpace() // Return values of GetDiskFreeSpace()
@ -88,8 +88,8 @@ func GetInfo(path string) (info Info, err error) {
uintptr(unsafe.Pointer(&lpNumberOfFreeClusters)), uintptr(unsafe.Pointer(&lpNumberOfFreeClusters)),
uintptr(unsafe.Pointer(&lpTotalNumberOfClusters))) uintptr(unsafe.Pointer(&lpTotalNumberOfClusters)))
info.Files = int64(lpTotalNumberOfClusters) info.Files = uint64(lpTotalNumberOfClusters)
info.Ffree = int64(lpNumberOfFreeClusters) info.Ffree = uint64(lpNumberOfFreeClusters)
return info, nil return info, nil
} }

Loading…
Cancel
Save