0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::fs: Remove internal alignment paddings.

This commit is contained in:
Jason Volk 2018-11-01 22:23:04 -07:00
parent a62469a9d6
commit 8db063bfc4
3 changed files with 2 additions and 41 deletions

View file

@ -47,13 +47,6 @@ struct ircd::fs::write_opts
/// the host system later ignores the offset due to the file's openmode.
off_t offset {0};
/// Alignment requirement value. This value may take on several meanings
/// and should remain zero for most users. Most users should conduct their
/// own alignment of userspace buffer addresses and sizes and file offsets.
/// Currently for append() this will zero-extend a write to the alignment
/// leading to a file which may be larger than the user expects with gaps.
size_t alignment {0};
/// Request priority. Higher value request will take priority over lower
/// value. Lowest value is zero. Negative value will receive a contextual
/// value internally (generally just zero). Default is -1.

View file

@ -15,8 +15,6 @@
namespace ircd::fs
{
extern char _zero_pads_[4096];
static size_t _zero_pads_required(const size_t &buf_size, const size_t &alignment);
static int reqprio(int);
}
@ -139,10 +137,6 @@ ircd::fs::aio::request::write::write(const int &fd,
const_cast<char *>(buffer::data(buf)),
buffer::size(buf)
},
{
_zero_pads_,
_zero_pads_required(buffer::size(buf), opts.alignment)
},
}}
{
aio_reqprio = reqprio(opts.priority);
@ -192,32 +186,6 @@ ircd::fs::prefetch__aio(const fd &fd,
// internal util
//
decltype(ircd::fs::_zero_pads_)
__attribute__((aligned(512)))
ircd::fs::_zero_pads_
{
0
};
size_t
ircd::fs::_zero_pads_required(const size_t &buf_size,
const size_t &alignment)
{
if(!alignment || buf_size == alignment)
return 0;
if(unlikely(alignment > sizeof(_zero_pads_)))
throw error
{
make_error_code(std::errc::invalid_argument),
"Alignment %zu exceeds maximum of %zu",
alignment,
sizeof(_zero_pads_)
};
return alignment - (buf_size % alignment);
}
int
ircd::fs::reqprio(int input)
{

View file

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