From 2f36fec41ae6cac0020a2e52637161bf96699c4f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 21 Dec 2018 12:09:44 -0800 Subject: [PATCH] ircd::fs: Cleanup the duplicate support state indicators. --- include/ircd/fs/aio.h | 10 ++++--- include/ircd/fs/support.h | 5 ---- ircd/fs.cc | 60 +++++++++++++++++++-------------------- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/include/ircd/fs/aio.h b/include/ircd/fs/aio.h index a8962467d..d1d1dfcdb 100644 --- a/include/ircd/fs/aio.h +++ b/include/ircd/fs/aio.h @@ -25,12 +25,14 @@ namespace ircd::fs::aio struct kernel; struct request; - extern struct stats stats; - extern kernel *context; + extern const bool support; + extern const bool support_fsync; + extern const bool support_fdsync; extern conf::item enable; - extern const bool available_fsync; - extern const bool available_fdsync; + + extern struct stats stats; + extern kernel *context; } /// Statistics structure. diff --git a/include/ircd/fs/support.h b/include/ircd/fs/support.h index ad11f13b6..100bf9736 100644 --- a/include/ircd/fs/support.h +++ b/include/ircd/fs/support.h @@ -13,11 +13,6 @@ namespace ircd::fs::support { - // Indicator lights for AIO - extern const bool aio; // Any AIO support. - extern const bool aio_fsync; // Kernel supports CMD_FSYNC - extern const bool aio_fdsync; // Kernel supports CMD_FDSYNC - // Test if O_DIRECT supported at target path bool direct_io(const string_view &path); diff --git a/ircd/fs.cc b/ircd/fs.cc index 1c3346b88..ed6683bcf 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -389,33 +389,6 @@ catch(const std::system_error &e) throw; } -/// True if AIO is supported by this build and runtime. -decltype(ircd::fs::support::aio) -ircd::fs::support::aio -{ - #ifdef IRCD_USE_AIO - true - #else - false - #endif -}; - -/// True if IOCB_CMD_FSYNC is supported by AIO. If this is false then -/// fs::fsync_opts::async=true flag is ignored. -decltype(ircd::fs::support::aio_fsync) -ircd::fs::support::aio_fsync -{ - false //TODO: Detect kernel support -}; - -/// True if IOCB_CMD_FDSYNC is supported by AIO. If this is false then -/// fs::fsync_opts::async=true flag is ignored. -decltype(ircd::fs::support::aio_fdsync) -ircd::fs::support::aio_fdsync -{ - false //TODO: Detect kernel support -}; - /////////////////////////////////////////////////////////////////////////////// // // fs/stdin.h @@ -534,16 +507,16 @@ ircd::fs::flush(const fd &fd, int(fd), opts.metadata, opts.aio, - opts.metadata? support::aio_fdsync : support::aio_fsync + opts.metadata? aio::support_fdsync : aio::support_fsync }; #ifdef IRCD_USE_AIO if(aio::context && opts.aio) { - if(!opts.metadata && support::aio_fdsync) + if(!opts.metadata && aio::support_fdsync) return aio::fdsync(fd, opts); - if(support::aio_fsync) + if(aio::support_fsync) return aio::fsync(fd, opts); } #endif @@ -987,6 +960,33 @@ ircd::fs::write(const fd &fd, // fs/aio.h // +/// True if AIO is supported by this build and runtime. +decltype(ircd::fs::aio::support) +ircd::fs::aio::support +{ + #ifdef IRCD_USE_AIO + true + #else + false + #endif +}; + +/// True if IOCB_CMD_FSYNC is supported by AIO. If this is false then +/// fs::fsync_opts::async=true flag is ignored. +decltype(ircd::fs::aio::support_fsync) +ircd::fs::aio::support_fsync +{ + false //TODO: get this info from system +}; + +/// True if IOCB_CMD_FDSYNC is supported by AIO. If this is false then +/// fs::fsync_opts::async=true flag is ignored. +decltype(ircd::fs::aio::support_fdsync) +ircd::fs::aio::support_fdsync +{ + false //TODO: get this info from system +}; + /// Conf item to control whether AIO is enabled or bypassed. decltype(ircd::fs::aio::enable) ircd::fs::aio::enable