io: Add DISABLE_POSIX_KERNEL_AIO knob to use EIO instead of Kernel AIO
- Some Linux filesystems don't support O_DIRECT which is required by Kernel AIO to function properly. Instead of using O_SYNC, EIO is much better options in terms of performance penalty. - Some systems may not support AIO at all. Eg. Windows Subsystem for Linux. FIXES #842 RELATED #274
This commit is contained in:
parent
608ef1f21f
commit
c32504f705
|
@ -58,7 +58,12 @@ Future< Reference<class IAsyncFile> > Net2FileSystem::open( std::string filename
|
|||
|
||||
Future<Reference<IAsyncFile>> f;
|
||||
#ifdef __linux__
|
||||
if ( (flags & IAsyncFile::OPEN_UNBUFFERED) && !(flags & IAsyncFile::OPEN_NO_AIO) )
|
||||
// In the vast majority of cases, we wish to use Kernel AIO. However, some systems
|
||||
// dont properly support don’t properly support kernel async I/O without O_DIRECT
|
||||
// or AIO at all. In such cases, DISABLE_POSIX_KERNEL_AIO knob can be enabled to fallback to
|
||||
// EIO instead of Kernel AIO.
|
||||
if ((flags & IAsyncFile::OPEN_UNBUFFERED) && !(flags & IAsyncFile::OPEN_NO_AIO) &&
|
||||
!FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO)
|
||||
f = AsyncFileKAIO::open(filename, flags, mode, NULL);
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -79,6 +79,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
|
|||
init( MIN_SUBMIT, 10 );
|
||||
|
||||
init( PAGE_WRITE_CHECKSUM_HISTORY, 0 ); if( randomize && BUGGIFY ) PAGE_WRITE_CHECKSUM_HISTORY = 10000000;
|
||||
init( DISABLE_POSIX_KERNEL_AIO, 0 );
|
||||
|
||||
//AsyncFileNonDurable
|
||||
init( MAX_PRIOR_MODIFICATION_DELAY, 1.0 ); if( randomize && BUGGIFY ) MAX_PRIOR_MODIFICATION_DELAY = 10.0;
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
int MIN_SUBMIT;
|
||||
|
||||
int PAGE_WRITE_CHECKSUM_HISTORY;
|
||||
int DISABLE_POSIX_KERNEL_AIO;
|
||||
|
||||
//AsyncFileNonDurable
|
||||
double MAX_PRIOR_MODIFICATION_DELAY;
|
||||
|
|
Loading…
Reference in New Issue