mirror of https://github.com/minio/minio.git
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:
parent
9c0e8cd15b
commit
f13cfcb83e
|
@ -284,6 +284,7 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
|||
s.formatLegacy = format.Erasure.DistributionAlgo == formatErasureVersionV2DistributionAlgoV1
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -296,6 +297,7 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
|||
return s, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Success.
|
||||
return s, nil
|
||||
|
@ -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)
|
||||
|
|
|
@ -94,7 +94,7 @@ var (
|
|||
},
|
||||
config.HelpKV{
|
||||
Key: apiDisableODirect,
|
||||
Description: "set to disable O_DIRECT for reads under special conditions. NOTE: it is not recommended to disable O_DIRECT without prior testing" + defaultHelpPostfix(apiDisableODirect),
|
||||
Description: "set to disable O_DIRECT for read and writes under special conditions. NOTE: it is not recommended to disable O_DIRECT without prior testing" + defaultHelpPostfix(apiDisableODirect),
|
||||
Optional: true,
|
||||
Type: "boolean",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue