use O_DIRECT for all ReadFileStream (#13324)

This PR also removes #13312 to ensure
that we can use a better mechanism to
handle page-cache, using O_DIRECT
even for Range GETs.
This commit is contained in:
Harshavardhana
2021-09-29 16:40:28 -07:00
committed by GitHub
parent 1d9e91e00f
commit d00ff3c453
10 changed files with 198 additions and 220 deletions

View File

@@ -41,14 +41,7 @@ func Fdatasync(f *os.File) error {
return syscall.Fdatasync(int(f.Fd()))
}
// fdavise advice constants
const (
FadvSequential = unix.FADV_SEQUENTIAL
FadvNoReuse = unix.FADV_NOREUSE
)
// Fadvise implements possibility of choosing
// offset: 0, length: 0
func Fadvise(f *os.File, advice int) error {
return unix.Fadvise(int(f.Fd()), 0, 0, advice)
// FadviseDontNeed invalidates page-cache
func FadviseDontNeed(f *os.File) error {
return unix.Fadvise(int(f.Fd()), 0, 0, unix.FADV_DONTNEED)
}

View File

@@ -30,14 +30,7 @@ func Fdatasync(f *os.File) error {
return syscall.Fsync(int(f.Fd()))
}
// fdavise advice constants
const (
FadvSequential = 0
FadvNoReuse = 0
)
// Fadvise implements possibility of choosing
// offset: 0, length: 0
func Fadvise(f *os.File, advice int) error {
// FadviseDontNeed is a no-op
func FadviseDontNeed(f *os.File) error {
return nil
}

View File

@@ -29,14 +29,7 @@ func Fdatasync(f *os.File) error {
return nil
}
// fdavise advice constants
const (
FadvSequential = 0
FadvNoReuse = 0
)
// Fadvise implements possibility of choosing
// offset: 0, length: 0
func Fadvise(f *os.File, advice int) error {
// FadviseDontNeed is a no-op
func FadviseDontNeed(f *os.File) error {
return nil
}