diff --git a/construct/construct.cc b/construct/construct.cc index a4affe7cf..22dd2bf5c 100644 --- a/construct/construct.cc +++ b/construct/construct.cc @@ -57,6 +57,7 @@ lgetopt opts[] = { "checkdb", &ircd::checkdb, lgetopt::BOOL, "Perform complete checks of databases when opening" }, { "pitrecdb", &ircd::pitrecdb, lgetopt::BOOL, "Allow Point-In-Time-Recover if DB reports corruption after crash" }, { "nojs", &ircd::nojs, lgetopt::BOOL, "Disable SpiderMonkey JS subsystem from initializing. (noop when not available)." }, + { "nodirect", &ircd::nodirect, lgetopt::BOOL, "Disable direct IO (O_DIRECT) for unsupporting filesystems." }, { nullptr, nullptr, lgetopt::STRING, nullptr }, }; diff --git a/include/ircd/ircd.h b/include/ircd/ircd.h index 105c2de3d..bf59e1b0a 100644 --- a/include/ircd/ircd.h +++ b/include/ircd/ircd.h @@ -26,6 +26,7 @@ namespace ircd extern bool checkdb; ///< Perform checks on database opens extern bool pitrecdb; ///< Allow Point-In-Time Recovery if DB corrupt. extern bool nojs; ///< Option to not init js subsystem. + extern bool nodirect; ///< Option to not use direct IO (O_DIRECT). } #include "string_view.h" diff --git a/ircd/db.cc b/ircd/db.cc index 5f990a3bc..a94f545ee 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -772,7 +772,7 @@ try opts.allow_concurrent_memtable_write = false; opts.enable_write_thread_adaptive_yield = false; opts.enable_pipelined_write = false; - opts.use_direct_reads = true; + opts.use_direct_reads = !ircd::nodirect; opts.write_thread_max_yield_usec = 0; opts.write_thread_slow_yield_usec = 0; opts.use_direct_io_for_flush_and_compaction = false; diff --git a/ircd/ircd.cc b/ircd/ircd.cc index 014a7e0bc..55dc2ed46 100644 --- a/ircd/ircd.cc +++ b/ircd/ircd.cc @@ -19,6 +19,7 @@ namespace ircd bool checkdb; // check databases when opening bool pitrecdb; // point-in-time recovery for db bool nojs; // no ircd::js system init. + bool nodirect; // no use of O_DIRECT. std::string _hostname; // user's supplied param boost::asio::io_context *ios; // user's io service