when o_direct is disabled do not attempt fadvise call (#14230)

This commit is contained in:
Harshavardhana 2022-02-02 08:54:52 -08:00 committed by GitHub
parent 67d07e895c
commit 24657859a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1715,7 +1715,11 @@ func (s *xlStorage) ReadFileStream(ctx context.Context, volume, path string, off
}{Reader: io.LimitReader(or, length), Closer: closeWrapper(func() error {
if !alignment || offset+length%xioutil.DirectioAlignSize != 0 {
// invalidate page-cache for unaligned reads.
disk.FadviseDontNeed(file)
if !globalAPIConfig.isDisableODirect() {
// skip removing from page-cache only
// if O_DIRECT was disabled.
disk.FadviseDontNeed(file)
}
}
return or.Close()
})}