From 9d423f84d8d1c1d4eee1f5addc73e95174da49ce Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 13 Dec 2018 16:54:09 -0800 Subject: [PATCH] ircd:;fs: Rename various fsync/sync related. --- include/ircd/fs/fs.h | 2 +- include/ircd/fs/{fsync.h => sync.h} | 16 ++++++++-------- ircd/aio.cc | 8 ++++---- ircd/aio.h | 8 ++++---- ircd/db.cc | 12 ++++++------ ircd/fs.cc | 16 ++++++++-------- 6 files changed, 31 insertions(+), 31 deletions(-) rename include/ircd/fs/{fsync.h => sync.h} (74%) diff --git a/include/ircd/fs/fs.h b/include/ircd/fs/fs.h index 8456d549e..2420f2c78 100644 --- a/include/ircd/fs/fs.h +++ b/include/ircd/fs/fs.h @@ -86,7 +86,7 @@ enum ircd::fs::index #include "aio.h" #include "read.h" #include "write.h" -#include "fsync.h" +#include "sync.h" #include "stdin.h" #include "support.h" diff --git a/include/ircd/fs/fsync.h b/include/ircd/fs/sync.h similarity index 74% rename from include/ircd/fs/fsync.h rename to include/ircd/fs/sync.h index 4ca9c492a..43dad75dd 100644 --- a/include/ircd/fs/fsync.h +++ b/include/ircd/fs/sync.h @@ -9,27 +9,27 @@ // full license for this software is available in the LICENSE file. #pragma once -#define HAVE_IRCD_FS_FSYNC_H +#define HAVE_IRCD_FS_SYNC_H namespace ircd::fs { - struct fsync_opts extern const fsync_opts_default; + struct sync_opts extern const sync_opts_default; - void fdsync(const fd &, const fsync_opts & = fsync_opts_default); - void fsync(const fd &, const fsync_opts & = fsync_opts_default); - void sync(const fd &, const fsync_opts & = fsync_opts_default); + void fdsync(const fd &, const sync_opts & = sync_opts_default); + void fsync(const fd &, const sync_opts & = sync_opts_default); + void sync(const fd &, const sync_opts & = sync_opts_default); } /// Options for a write operation -struct ircd::fs::fsync_opts +struct ircd::fs::sync_opts { - fsync_opts() = default; + sync_opts() = default; /// Determines whether this operation is conducted via AIO. If not, a /// direct syscall is made. Using AIO will only block one ircd::ctx while /// a direct syscall will block the thread (all contexts). If AIO is not /// available or enabled setting this has no effect. - bool async {true}; + bool synchronous {false}; /// Request priority. This value is ignored by the kernel for the /// operations provided by this interface. It is still provided for diff --git a/ircd/aio.cc b/ircd/aio.cc index 206d254a7..5ce15acb9 100644 --- a/ircd/aio.cc +++ b/ircd/aio.cc @@ -28,7 +28,7 @@ namespace ircd::fs::aio // ircd::fs::aio::request::fsync::fsync(const int &fd, - const fsync_opts &opts) + const sync_opts &opts) :request{fd} { aio_reqprio = reqprio(opts.priority); @@ -41,7 +41,7 @@ ircd::fs::aio::request::fsync::fsync(const int &fd, void ircd::fs::aio::fsync(const fd &fd, - const fsync_opts &opts) + const sync_opts &opts) { aio::request::fsync request { @@ -56,7 +56,7 @@ ircd::fs::aio::fsync(const fd &fd, // ircd::fs::aio::request::fdsync::fdsync(const int &fd, - const fsync_opts &opts) + const sync_opts &opts) :request{fd} { aio_reqprio = reqprio(opts.priority); @@ -69,7 +69,7 @@ ircd::fs::aio::request::fdsync::fdsync(const int &fd, void ircd::fs::aio::fdsync(const fd &fd, - const fsync_opts &opts) + const sync_opts &opts) { aio::request::fdsync request { diff --git a/ircd/aio.h b/ircd/aio.h index 1966ad486..cdd80b483 100644 --- a/ircd/aio.h +++ b/ircd/aio.h @@ -19,8 +19,8 @@ namespace ircd::fs::aio void prefetch(const fd &, const size_t &, const read_opts &); size_t write(const fd &, const const_buffers &, const write_opts &); size_t read(const fd &, const mutable_buffers &, const read_opts &); - void fdsync(const fd &, const fsync_opts &); - void fsync(const fd &, const fsync_opts &); + void fdsync(const fd &, const sync_opts &); + void fsync(const fd &, const sync_opts &); } /// AIO context instance from the kernel. Right now this is a singleton with @@ -101,12 +101,12 @@ struct ircd::fs::aio::request::write struct ircd::fs::aio::request::fdsync :request { - fdsync(const int &fd, const fsync_opts &); + fdsync(const int &fd, const sync_opts &); }; /// fsync request control block struct ircd::fs::aio::request::fsync :request { - fsync(const int &fd, const fsync_opts &); + fsync(const int &fd, const sync_opts &); }; diff --git a/ircd/db.cc b/ircd/db.cc index dc6360a1a..3b8414720 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -4754,7 +4754,7 @@ noexcept try }; #endif - fs::fsync_opts opts; + fs::sync_opts opts; fs::fdsync(fd, opts); return Status::OK(); } @@ -4801,7 +4801,7 @@ noexcept try }; #endif - fs::fsync_opts opts; + fs::sync_opts opts; fs::sync(fd, opts); return Status::OK(); } @@ -4846,7 +4846,7 @@ noexcept try }; #endif - fs::fsync_opts opts; + fs::sync_opts opts; fs::fsync(fd, opts); return Status::OK(); } @@ -6983,7 +6983,7 @@ noexcept try }; #endif - fs::fsync_opts opts; + fs::sync_opts opts; fs::fsync(fd, opts); return Status::OK(); } @@ -7030,7 +7030,7 @@ noexcept try }; #endif - fs::fsync_opts opts; + fs::sync_opts opts; fs::sync(fd, opts); return Status::OK(); } @@ -7077,7 +7077,7 @@ noexcept try }; #endif - fs::fsync_opts opts; + fs::sync_opts opts; fs::fdsync(fd, opts); return Status::OK(); } diff --git a/ircd/fs.cc b/ircd/fs.cc index 5928b1d2a..da31128f8 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -512,15 +512,15 @@ ircd::fs::stdin::tty::write(const string_view &buf) /////////////////////////////////////////////////////////////////////////////// // -// fs/fsync.h +// fs/sync.h // -ircd::fs::fsync_opts -const ircd::fs::fsync_opts_default; +ircd::fs::sync_opts +const ircd::fs::sync_opts_default; void ircd::fs::sync(const fd &fd, - const fsync_opts &opts) + const sync_opts &opts) { #ifdef __linux__ syscall(::syncfs, fd); @@ -531,10 +531,10 @@ ircd::fs::sync(const fd &fd, void ircd::fs::fsync(const fd &fd, - const fsync_opts &opts) + const sync_opts &opts) { #ifdef IRCD_USE_AIO - if(aio::context && opts.async && support::aio_fsync) + if(aio::context && !opts.synchronous && support::aio_fsync) return aio::fsync(fd, opts); #endif @@ -543,10 +543,10 @@ ircd::fs::fsync(const fd &fd, void ircd::fs::fdsync(const fd &fd, - const fsync_opts &opts) + const sync_opts &opts) { #ifdef IRCD_USE_AIO - if(aio::context && opts.async && support::aio_fdsync) + if(aio::context && !opts.synchronous && support::aio_fdsync) return aio::fdsync(fd, opts); #endif