mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
allow disabling O_DIRECT for write ops (#17751)
on really slow systems, O_DIRECT simply kills the drives allow for a way to disable them.
This commit is contained in:
@@ -284,16 +284,18 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
||||
s.formatLegacy = format.Erasure.DistributionAlgo == formatErasureVersionV2DistributionAlgoV1
|
||||
}
|
||||
|
||||
// Return an error if ODirect is not supported
|
||||
// unless it is a single erasure disk mode
|
||||
if err := s.checkODirectDiskSupport(); err == nil {
|
||||
s.oDirect = true
|
||||
} else {
|
||||
// Allow if unsupported platform or single disk.
|
||||
if errors.Is(err, errUnsupportedDisk) && globalIsErasureSD || !disk.ODirectPlatform {
|
||||
s.oDirect = false
|
||||
if !globalAPIConfig.isDisableODirect() {
|
||||
// Return an error if ODirect is not supported
|
||||
// unless it is a single erasure disk mode
|
||||
if err := s.checkODirectDiskSupport(); err == nil {
|
||||
s.oDirect = true
|
||||
} else {
|
||||
return s, err
|
||||
// Allow if unsupported platform or single disk.
|
||||
if errors.Is(err, errUnsupportedDisk) && globalIsErasureSD || !disk.ODirectPlatform {
|
||||
s.oDirect = false
|
||||
} else {
|
||||
return s, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1896,7 +1898,8 @@ func (s *xlStorage) writeAllDirect(ctx context.Context, filePath string, fileSiz
|
||||
return osErrToFileErr(err)
|
||||
}
|
||||
|
||||
odirectEnabled := s.oDirect
|
||||
odirectEnabled := !globalAPIConfig.isDisableODirect() && s.oDirect
|
||||
|
||||
var w *os.File
|
||||
if odirectEnabled {
|
||||
w, err = OpenFileDirectIO(filePath, flags, 0o666)
|
||||
|
||||
Reference in New Issue
Block a user