From 7ad0e20e4857d242e0f11a8ec3b9b4c6637fdb69 Mon Sep 17 00:00:00 2001 From: mpilman Date: Tue, 15 Oct 2019 11:16:37 -0700 Subject: [PATCH] Added knob to disable O_DIRECT --- fdbrpc/AsyncFileEIO.actor.h | 2 +- fdbrpc/Net2FileSystem.cpp | 2 +- flow/Knobs.cpp | 1 + flow/Knobs.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fdbrpc/AsyncFileEIO.actor.h b/fdbrpc/AsyncFileEIO.actor.h index cc6755fe63..b4791a1a43 100644 --- a/fdbrpc/AsyncFileEIO.actor.h +++ b/fdbrpc/AsyncFileEIO.actor.h @@ -248,7 +248,7 @@ private: if( flags & OPEN_READWRITE ) oflags |= O_RDWR; if( flags & OPEN_ATOMIC_WRITE_AND_CREATE ) oflags |= O_TRUNC; #if defined(__linux__) - if ( flags & OPEN_UNBUFFERED ) oflags |= O_DIRECT; + if ( flags & OPEN_UNBUFFERED && !FLOW_KNOBS->DISABLE_ODIRECT ) oflags |= O_DIRECT; #endif return oflags; } diff --git a/fdbrpc/Net2FileSystem.cpp b/fdbrpc/Net2FileSystem.cpp index 48267acb63..867bcf6799 100644 --- a/fdbrpc/Net2FileSystem.cpp +++ b/fdbrpc/Net2FileSystem.cpp @@ -63,7 +63,7 @@ Future< Reference > Net2FileSystem::open( std::string filename // 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) + !FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO && !FLOW_KNOBS->DISABLE_ODIRECT) f = AsyncFileKAIO::open(filename, flags, mode, NULL); else #endif diff --git a/flow/Knobs.cpp b/flow/Knobs.cpp index 9149285246..3911480daf 100644 --- a/flow/Knobs.cpp +++ b/flow/Knobs.cpp @@ -87,6 +87,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) { //AsyncFileEIO init( EIO_MAX_PARALLELISM, 4 ); + init( DISABLE_ODIRECT, 0 ); //AsyncFileKAIO init( MAX_OUTSTANDING, 64 ); diff --git a/flow/Knobs.h b/flow/Knobs.h index eb79e95663..d7f49bd4c9 100644 --- a/flow/Knobs.h +++ b/flow/Knobs.h @@ -107,6 +107,7 @@ public: //AsyncFileEIO int EIO_MAX_PARALLELISM; + int DISABLE_ODIRECT; //AsyncFileKAIO int MAX_OUTSTANDING;