mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
ircd::fs::aio: Fix bitrot assertion; simplify aio related.
This commit is contained in:
parent
84d4b091fe
commit
588b0aa9bc
3 changed files with 16 additions and 48 deletions
25
ircd/fs.cc
25
ircd/fs.cc
|
@ -137,7 +137,6 @@ ircd::fs::support_rwf_write_life
|
||||||
//
|
//
|
||||||
|
|
||||||
ircd::fs::init::init()
|
ircd::fs::init::init()
|
||||||
:_aio_{}
|
|
||||||
{
|
{
|
||||||
debug_support();
|
debug_support();
|
||||||
debug_paths();
|
debug_paths();
|
||||||
|
@ -483,10 +482,10 @@ ircd::fs::flush(const fd &fd,
|
||||||
#ifdef IRCD_USE_AIO
|
#ifdef IRCD_USE_AIO
|
||||||
if(aio::system && opts.aio)
|
if(aio::system && opts.aio)
|
||||||
{
|
{
|
||||||
if(!opts.metadata && aio::support_fdsync)
|
if(aio::support_fdsync && !opts.metadata)
|
||||||
return aio::fdsync(fd, opts);
|
return aio::fsync(fd, opts);
|
||||||
|
|
||||||
if(aio::support_fsync)
|
if(aio::support_fsync && opts.metadata)
|
||||||
return aio::fsync(fd, opts);
|
return aio::fsync(fd, opts);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1116,7 +1115,7 @@ ircd::fs::write(const fd &fd,
|
||||||
assert(opts.op == op::WRITE);
|
assert(opts.op == op::WRITE);
|
||||||
|
|
||||||
#ifdef IRCD_USE_AIO
|
#ifdef IRCD_USE_AIO
|
||||||
if(likely(aio::system) && opts.aio)
|
if(aio::system && opts.aio)
|
||||||
return aio::write(fd, iov, opts);
|
return aio::write(fd, iov, opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1335,7 +1334,10 @@ ircd::fs::reflect(const ready &ready)
|
||||||
|
|
||||||
decltype(ircd::fs::aio::support)
|
decltype(ircd::fs::aio::support)
|
||||||
extern __attribute__((weak))
|
extern __attribute__((weak))
|
||||||
ircd::fs::aio::support;
|
ircd::fs::aio::support
|
||||||
|
{
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
decltype(ircd::fs::aio::support_fsync)
|
decltype(ircd::fs::aio::support_fsync)
|
||||||
extern __attribute__((weak))
|
extern __attribute__((weak))
|
||||||
|
@ -1355,7 +1357,10 @@ ircd::fs::aio::support_fdsync
|
||||||
|
|
||||||
decltype(ircd::fs::aio::MAX_EVENTS)
|
decltype(ircd::fs::aio::MAX_EVENTS)
|
||||||
extern __attribute__((weak))
|
extern __attribute__((weak))
|
||||||
ircd::fs::aio::MAX_EVENTS;
|
ircd::fs::aio::MAX_EVENTS
|
||||||
|
{
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
decltype(ircd::fs::aio::MAX_REQPRIO)
|
decltype(ircd::fs::aio::MAX_REQPRIO)
|
||||||
extern __attribute__((weak))
|
extern __attribute__((weak))
|
||||||
|
@ -1404,10 +1409,10 @@ ircd::fs::aio::system;
|
||||||
#ifndef IRCD_USE_AIO
|
#ifndef IRCD_USE_AIO
|
||||||
ircd::fs::aio::init::init()
|
ircd::fs::aio::init::init()
|
||||||
{
|
{
|
||||||
assert(!context);
|
assert(!system);
|
||||||
log::warning
|
log::warning
|
||||||
{
|
{
|
||||||
log, "No support for asynchronous local filesystem IO..."
|
log, "No support for asynchronous local filesystem IO with AIO..."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1416,7 +1421,7 @@ ircd::fs::aio::init::init()
|
||||||
ircd::fs::aio::init::~init()
|
ircd::fs::aio::init::~init()
|
||||||
noexcept
|
noexcept
|
||||||
{
|
{
|
||||||
assert(!context);
|
assert(!system);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ ircd::fs::aio::request::fsync::fsync(const int &fd,
|
||||||
:request{fd, &opts}
|
:request{fd, &opts}
|
||||||
{
|
{
|
||||||
assert(opts.op == op::SYNC);
|
assert(opts.op == op::SYNC);
|
||||||
aio_lio_opcode = IOCB_CMD_FSYNC;
|
aio_lio_opcode = opts.metadata? IOCB_CMD_FSYNC : IOCB_CMD_FDSYNC;
|
||||||
|
|
||||||
aio_buf = 0;
|
aio_buf = 0;
|
||||||
aio_nbytes = 0;
|
aio_nbytes = 0;
|
||||||
|
@ -147,34 +147,6 @@ ircd::fs::aio::fsync(const fd &fd,
|
||||||
request();
|
request();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// request::fdsync
|
|
||||||
//
|
|
||||||
|
|
||||||
ircd::fs::aio::request::fdsync::fdsync(const int &fd,
|
|
||||||
const sync_opts &opts)
|
|
||||||
:request{fd, &opts}
|
|
||||||
{
|
|
||||||
assert(opts.op == op::SYNC);
|
|
||||||
aio_lio_opcode = IOCB_CMD_FDSYNC;
|
|
||||||
|
|
||||||
aio_buf = 0;
|
|
||||||
aio_nbytes = 0;
|
|
||||||
aio_offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ircd::fs::aio::fdsync(const fd &fd,
|
|
||||||
const sync_opts &opts)
|
|
||||||
{
|
|
||||||
aio::request::fdsync request
|
|
||||||
{
|
|
||||||
fd, opts
|
|
||||||
};
|
|
||||||
|
|
||||||
request();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// request::read
|
// request::read
|
||||||
//
|
//
|
||||||
|
|
|
@ -29,7 +29,6 @@ namespace ircd::fs::aio
|
||||||
|
|
||||||
size_t write(const fd &, const const_iovec_view &, const write_opts &);
|
size_t write(const fd &, const const_iovec_view &, const write_opts &);
|
||||||
size_t read(const fd &, const const_iovec_view &, const read_opts &);
|
size_t read(const fd &, const const_iovec_view &, const read_opts &);
|
||||||
void fdsync(const fd &, const sync_opts &);
|
|
||||||
void fsync(const fd &, const sync_opts &);
|
void fsync(const fd &, const sync_opts &);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +120,6 @@ struct ircd::fs::aio::request
|
||||||
{
|
{
|
||||||
struct read;
|
struct read;
|
||||||
struct write;
|
struct write;
|
||||||
struct fdsync;
|
|
||||||
struct fsync;
|
struct fsync;
|
||||||
|
|
||||||
ssize_t retval {-2L};
|
ssize_t retval {-2L};
|
||||||
|
@ -155,13 +153,6 @@ struct ircd::fs::aio::request::write
|
||||||
write(const int &fd, const const_iovec_view &, const write_opts &);
|
write(const int &fd, const const_iovec_view &, const write_opts &);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// fdsync request control block
|
|
||||||
struct ircd::fs::aio::request::fdsync
|
|
||||||
:request
|
|
||||||
{
|
|
||||||
fdsync(const int &fd, const sync_opts &);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// fsync request control block
|
/// fsync request control block
|
||||||
struct ircd::fs::aio::request::fsync
|
struct ircd::fs::aio::request::fsync
|
||||||
:request
|
:request
|
||||||
|
|
Loading…
Reference in a new issue