Skip to content

Commit

Permalink
remove unnecessary f.Stat() (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
catatsuy authored and cubicdaiya committed Mar 28, 2017
1 parent 275dfba commit 9a998a3
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cachectl/purge.go
Expand Up @@ -19,13 +19,7 @@ func purgePages(fpath string, fsize int64, rate float64) error {
}
defer f.Close()

fi, err := f.Stat()
if err != nil {
return err
}
size := fi.Size()

err = unix.Fadvise(int(f.Fd()), 0, int64(float64(size)*rate), unix.FADV_DONTNEED)
err = unix.Fadvise(int(f.Fd()), 0, int64(float64(fsize)*rate), unix.FADV_DONTNEED)
if err != nil {
return fmt.Errorf("failed to purge page cache for %s", fpath)
}
Expand Down

0 comments on commit 9a998a3

Please sign in to comment.