0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-20 08:51:18 +01:00

ircd::aio: Switch to PREADV/PWRITEV iovector operations.

This commit is contained in:
Jason Volk 2018-10-31 16:29:20 -07:00
parent 5dcc7cd93b
commit 88be871149
2 changed files with 26 additions and 6 deletions

View file

@ -77,12 +77,20 @@ ircd::fs::aio::request::read::read(const int &fd,
const mutable_buffer &buf,
const read_opts &opts)
:request{fd}
,iov
{
// struct iovec
{
buffer::data(buf),
buffer::size(buf)
},
}
{
aio_reqprio = opts.priority;
aio_lio_opcode = IOCB_CMD_PREAD;
aio_lio_opcode = IOCB_CMD_PREADV;
aio_buf = uintptr_t(buffer::data(buf));
aio_nbytes = buffer::size(buf);
aio_buf = uintptr_t(iov.data());
aio_nbytes = iov.size();
aio_offset = opts.offset;
}
@ -117,12 +125,20 @@ ircd::fs::aio::request::write::write(const int &fd,
const const_buffer &buf,
const write_opts &opts)
:request{fd}
,iov
{{
// struct iovec
{
const_cast<char *>(buffer::data(buf)),
buffer::size(buf)
},
}}
{
aio_reqprio = opts.priority;
aio_lio_opcode = IOCB_CMD_PWRITE;
aio_lio_opcode = IOCB_CMD_PWRITEV;
aio_buf = uintptr_t(buffer::data(buf));
aio_nbytes = buffer::size(buf);
aio_buf = uintptr_t(iov.data());
aio_nbytes = iov.size();
aio_offset = opts.offset;
}

View file

@ -85,6 +85,8 @@ struct ircd::fs::aio::request
struct ircd::fs::aio::request::read
:request
{
std::array<struct iovec, 1> iov;
read(const int &fd, const mutable_buffer &, const read_opts &);
};
@ -92,6 +94,8 @@ struct ircd::fs::aio::request::read
struct ircd::fs::aio::request::write
:request
{
std::array<struct iovec, 1> iov;
write(const int &fd, const const_buffer &, const write_opts &);
};