github.com/koko1123/flow-go-1@v0.29.6/ledger/complete/wal/fadvise.go (about) 1 //go:build !linux 2 // +build !linux 3 4 package wal 5 6 // fadviseNoLinuxPageCache does nothing if GOOS != "linux". 7 // Otherwise, fadviseNoLinuxPageCache advises Linux to evict 8 // a file from Linux page cache. This calls unix.Fadvise which 9 // in turn calls posix_fadvise with POSIX_FADV_DONTNEED. 10 // CAUTION: If fsync=true, this will call unix.Fsync which 11 // can cause performance hit especially when used inside a loop. 12 func fadviseNoLinuxPageCache(fd uintptr, fsync bool) error { 13 return nil 14 } 15 16 // fadviseNoLinuxPageCache does nothing if GOOS != "linux". 17 // Otherwise, fadviseSegmentNoLinuxPageCache advises Linux to evict 18 // file segment from Linux page cache. This calls unix.Fadvise 19 // which in turn calls posix_fadvise with POSIX_FADV_DONTNEED. 20 // If GOOS != "linux" then this function does nothing. 21 // CAUTION: If fsync=true, this will call unix.Fsync which 22 // can cause performance hit especially when used inside a loop. 23 // 24 //nolint:unused,deadcode 25 func fadviseSegmentNoLinuxPageCache(fd uintptr, off, len int64, fsync bool) error { 26 return nil 27 }