From 29203d62e97ca8193fe56c01a1edad10d1da53ff Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 8 May 2018 15:59:50 -0400 Subject: [PATCH] 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. --- fs/fs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fs.go b/fs/fs.go index c219f033..996f8577 100644 --- a/fs/fs.go +++ b/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())