Skip to content

Commit

Permalink
disk: If could not get Inodes, return empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Aug 27, 2016
1 parent a8e24d7 commit 08a6ab6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions disk/disk_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ func Usage(path string) (*UsageStat, error) {
InodesFree: (uint64(stat.Ffree)),
}

// if could not get InodesTotal, return empty
if ret.InodesTotal < ret.InodesFree {
return ret, nil
}
ret.InodesUsed = (ret.InodesTotal - ret.InodesFree)
ret.InodesUsedPercent = (float64(ret.InodesUsed) / float64(ret.InodesTotal)) * 100.0
ret.Used = (uint64(stat.Blocks) - uint64(stat.Bfree)) * uint64(bsize)
Expand Down

0 comments on commit 08a6ab6

Please sign in to comment.