0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 22:18:54 +02:00

ircd::aio: Various cleanup.

This commit is contained in:
Jason Volk 2018-08-20 22:45:06 -07:00
parent 32285d5dac
commit 35a0f1ea51
2 changed files with 21 additions and 11 deletions

View file

@ -164,6 +164,12 @@ ircd::fs::prefetch__aio(const fd &fd,
// aio
//
decltype(ircd::fs::aio::MAX_EVENTS)
ircd::fs::aio::MAX_EVENTS
{
512
};
//
// aio::aio
//
@ -313,7 +319,11 @@ noexcept try
request.retval = std::max(event.res, -1LL);
request.errcode = event.res >= -1? event.res2 : std::abs(event.res);
if(likely(request.waiter && request.waiter != ctx::current))
// Notify the waiting context. Note that we are on the main async stack
// but it is safe to notify from here. The waiter may be null if it left.
assert(!request.waiter || request.waiter != ctx::current);
assert(ctx::current == nullptr);
if(likely(request.waiter))
ctx::notify(*request.waiter);
/*

View file

@ -14,6 +14,15 @@
#include <linux/aio_abi.h>
#include <ircd/asio.h>
namespace ircd::fs
{
void prefetch__aio(const fd &, const size_t &, const read_opts &);
const_buffer write__aio(const fd &, const const_buffer &, const write_opts &);
const_buffer read__aio(const fd &, const mutable_buffer &, const read_opts &);
void fdsync__aio(const fd &, const fsync_opts &);
void fsync__aio(const fd &, const fsync_opts &);
}
/// AIO context instance. Right now this is a singleton with an extern
/// instance at fs::aioctx.
struct ircd::fs::aio
@ -21,7 +30,7 @@ struct ircd::fs::aio
struct request;
/// Maximum number of events we can submit to kernel
static constexpr const size_t &MAX_EVENTS {512};
static const size_t MAX_EVENTS;
/// Internal semaphore for synchronization of this object
ctx::dock dock;
@ -74,15 +83,6 @@ struct ircd::fs::aio::request
~request() noexcept;
};
namespace ircd::fs
{
void prefetch__aio(const fd &, const size_t &, const read_opts &);
const_buffer write__aio(const fd &, const const_buffer &, const write_opts &);
const_buffer read__aio(const fd &, const mutable_buffer &, const read_opts &);
void fdsync__aio(const fd &, const fsync_opts &);
void fsync__aio(const fd &, const fsync_opts &);
}
/// Read request control block
struct ircd::fs::aio::request::read
:request