mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fallback O_DIRECT if not supported, do regular reads() (#13680)
This commit is contained in:
parent
3d2bc15e9a
commit
9c5d9ae376
@ -19,6 +19,7 @@ package ioutil
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/minio/minio/internal/disk"
|
||||
)
|
||||
@ -32,7 +33,12 @@ import (
|
||||
func ReadFile(name string) ([]byte, error) {
|
||||
f, err := disk.OpenFileDirectIO(name, readMode, 0666)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// fallback if there is an error to read
|
||||
// 'name' with O_DIRECT
|
||||
f, err = os.OpenFile(name, readMode, 0666)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
r := &ODirectReader{
|
||||
File: f,
|
||||
|
Loading…
Reference in New Issue
Block a user