mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-16 02:42:23 +08:00
Net2FileSystem: Add guards to honor DISABLE_POSIX_KERNEL_AIO
- Adds some asserts in KAIO to ensure that when knob is set, we don't end up using KAIO in any case. - Fixes a bug where we initialize AsyncFileKAIO on Linux builds even when KAIO is disabled. This can cause problems in systems such as Windows Subsystem for Linux where KAIO is not supported. FIXES #2382
This commit is contained in:
parent
a6fe8c1d1f
commit
1901f49b97
@ -97,6 +97,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Future<Reference<IAsyncFile>> open( std::string filename, int flags, int mode, void* ignore ) {
|
static Future<Reference<IAsyncFile>> open( std::string filename, int flags, int mode, void* ignore ) {
|
||||||
|
ASSERT( !FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO );
|
||||||
ASSERT( flags & OPEN_UNBUFFERED );
|
ASSERT( flags & OPEN_UNBUFFERED );
|
||||||
|
|
||||||
if (flags & OPEN_LOCK)
|
if (flags & OPEN_LOCK)
|
||||||
@ -153,6 +154,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void init( Reference<IEventFD> ev, double ioTimeout ) {
|
static void init( Reference<IEventFD> ev, double ioTimeout ) {
|
||||||
|
ASSERT( !FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO );
|
||||||
if( !g_network->isSimulated() ) {
|
if( !g_network->isSimulated() ) {
|
||||||
ctx.countAIOSubmit.init(LiteralStringRef("AsyncFile.CountAIOSubmit"));
|
ctx.countAIOSubmit.init(LiteralStringRef("AsyncFile.CountAIOSubmit"));
|
||||||
ctx.countAIOCollect.init(LiteralStringRef("AsyncFile.CountAIOCollect"));
|
ctx.countAIOCollect.init(LiteralStringRef("AsyncFile.CountAIOCollect"));
|
||||||
@ -578,7 +580,7 @@ private:
|
|||||||
static Context ctx;
|
static Context ctx;
|
||||||
|
|
||||||
explicit AsyncFileKAIO(int fd, int flags, std::string const& filename) : fd(fd), flags(flags), filename(filename), failed(false) {
|
explicit AsyncFileKAIO(int fd, int flags, std::string const& filename) : fd(fd), flags(flags), filename(filename), failed(false) {
|
||||||
|
ASSERT( !FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO );
|
||||||
if( !g_network->isSimulated() ) {
|
if( !g_network->isSimulated() ) {
|
||||||
countFileLogicalWrites.init(LiteralStringRef("AsyncFile.CountFileLogicalWrites"), filename);
|
countFileLogicalWrites.init(LiteralStringRef("AsyncFile.CountFileLogicalWrites"), filename);
|
||||||
countFileLogicalReads.init( LiteralStringRef("AsyncFile.CountFileLogicalReads"), filename);
|
countFileLogicalReads.init( LiteralStringRef("AsyncFile.CountFileLogicalReads"), filename);
|
||||||
|
@ -93,6 +93,9 @@ Net2FileSystem::Net2FileSystem(double ioTimeout, std::string fileSystemPath)
|
|||||||
{
|
{
|
||||||
Net2AsyncFile::init();
|
Net2AsyncFile::init();
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
if (FLOW_KNOBS->DISABLE_POSIX_KERNEL_AIO)
|
||||||
|
return;
|
||||||
|
|
||||||
AsyncFileKAIO::init( Reference<IEventFD>(N2::ASIOReactor::getEventFD()), ioTimeout );
|
AsyncFileKAIO::init( Reference<IEventFD>(N2::ASIOReactor::getEventFD()), ioTimeout );
|
||||||
|
|
||||||
if (fileSystemPath.empty()) {
|
if (fileSystemPath.empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user