Skip to content

Commit

Permalink
io: Add DISABLE_POSIX_KERNEL_AIO knob to use EIO instead of Kernel AIO
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
vishesh authored and alexmiller-apple committed Mar 13, 2019
1 parent 608ef1f commit c32504f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fdbrpc/Net2FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions flow/Knobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions flow/Knobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class FlowKnobs : public Knobs {
int MIN_SUBMIT;

int PAGE_WRITE_CHECKSUM_HISTORY;
int DISABLE_POSIX_KERNEL_AIO;

//AsyncFileNonDurable
double MAX_PRIOR_MODIFICATION_DELAY;
Expand Down

0 comments on commit c32504f

Please sign in to comment.