0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 14:08:56 +02:00

ircd::fs: Cleanup the duplicate support state indicators.

This commit is contained in:
Jason Volk 2018-12-21 12:09:44 -08:00
parent f9ee616a9a
commit 2f36fec41a
3 changed files with 36 additions and 39 deletions

View file

@ -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<bool> enable;
extern const bool available_fsync;
extern const bool available_fdsync;
extern struct stats stats;
extern kernel *context;
}
/// Statistics structure.

View file

@ -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);

View file

@ -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