Skip to content

Commit

Permalink
Merge pull request open-falcon-archive#11 from n4mine/master
Browse files Browse the repository at this point in the history
fix: inode free在一些文件系统上计算错误
  • Loading branch information
UlricQin authored Jun 15, 2017
2 parents 3af975e + 3c5f102 commit d5bf087
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions dfstat_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package nux
import (
"bufio"
"bytes"
"github.com/toolkits/file"
"io"
"io/ioutil"
"math"
"strings"
"syscall"

"github.com/toolkits/file"
)

// return: [][$fs_spec, $fs_file, $fs_vfstype]
Expand Down Expand Up @@ -104,8 +106,13 @@ func BuildDeviceUsage(_fsSpec, _fsFile, _fsVfstype string) (*DeviceUsage, error)

// inodes
ret.InodesAll = fs.Files
ret.InodesFree = fs.Ffree
ret.InodesUsed = fs.Files - fs.Ffree
if fs.Ffree == math.MaxUint64 {
ret.InodesFree = 0
ret.InodesUsed = 0
} else {
ret.InodesFree = fs.Ffree
ret.InodesUsed = fs.Files - fs.Ffree
}
if fs.Files == 0 {
ret.InodesUsedPercent = 0
ret.InodesFreePercent = 0
Expand Down

0 comments on commit d5bf087

Please sign in to comment.