0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::fs: Use posix iov in AIO interface arguments.

This commit is contained in:
Jason Volk 2018-12-18 13:40:46 -08:00
parent 77a84b18d3
commit c3cf4c02dd
3 changed files with 9 additions and 8 deletions

View file

@ -98,12 +98,12 @@ ircd::fs::aio::request::read::read(const int &fd,
size_t
ircd::fs::aio::read(const fd &fd,
const mutable_buffers &bufs,
const const_iovec_view &bufs,
const read_opts &opts)
{
aio::request::read request
{
fd, make_iov(bufs), opts
fd, bufs, opts
};
stats.cur_reads++;
@ -143,12 +143,12 @@ ircd::fs::aio::request::write::write(const int &fd,
size_t
ircd::fs::aio::write(const fd &fd,
const const_buffers &bufs,
const const_iovec_view &bufs,
const write_opts &opts)
{
aio::request::write request
{
fd, make_iov(bufs), opts
fd, bufs, opts
};
#ifndef _NDEBUG

View file

@ -17,8 +17,8 @@ namespace ircd::fs::aio
struct request;
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 &);
size_t write(const fd &, const const_iovec_view &, const write_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 &);
}

View file

@ -881,12 +881,13 @@ ircd::fs::write(const fd &fd,
const const_buffers &bufs,
const write_opts &opts)
{
const auto iov(make_iov(bufs));
#ifdef IRCD_USE_AIO
if(likely(aio::context) && opts.aio)
return aio::write(fd, bufs, opts);
return aio::write(fd, iov, opts);
#endif
const auto iov(make_iov(bufs));
return size_t(syscall(::pwritev, fd, iov.data(), iov.size(), opts.offset));
}