Run find command with nice+ionice to reduce cpu / io
Reduce impact of running the "find" command when system is loaded. We already use "nice" and "ionice" with the "du" command.
This commit is contained in:
parent
96b62ed83b
commit
29203d62e9
2
fs/fs.go
2
fs/fs.go
@ -601,7 +601,7 @@ func GetDirInodeUsage(dir string, timeout time.Duration) (uint64, error) {
|
||||
}
|
||||
var counter byteCounter
|
||||
var stderr bytes.Buffer
|
||||
findCmd := exec.Command("find", dir, "-xdev", "-printf", ".")
|
||||
findCmd := exec.Command("ionice", "-c3", "nice", "-n", "19", "find", dir, "-xdev", "-printf", ".")
|
||||
findCmd.Stdout, findCmd.Stderr = &counter, &stderr
|
||||
if err := findCmd.Start(); err != nil {
|
||||
return 0, fmt.Errorf("failed to exec cmd %v - %v; stderr: %v", findCmd.Args, err, stderr.String())
|
||||
|
Loading…
Reference in New Issue
Block a user