mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::db: Add read options for 'aio' and 'all' to file env classes.
This commit is contained in:
parent
bb3a68a95e
commit
541b020a19
3 changed files with 25 additions and 2 deletions
|
@ -27,6 +27,7 @@ struct ircd::db::database::env::random_access_file final
|
|||
fs::fd::opts opts;
|
||||
fs::fd fd;
|
||||
size_t _buffer_align;
|
||||
bool aio;
|
||||
|
||||
bool use_direct_io() const noexcept override;
|
||||
size_t GetRequiredBufferAlignment() const noexcept override;
|
||||
|
|
|
@ -27,6 +27,7 @@ struct ircd::db::database::env::random_rw_file final
|
|||
fs::fd::opts opts;
|
||||
fs::fd fd;
|
||||
size_t _buffer_align;
|
||||
bool aio;
|
||||
|
||||
bool use_direct_io() const noexcept override;
|
||||
size_t GetRequiredBufferAlignment() const noexcept override;
|
||||
|
|
25
ircd/db.cc
25
ircd/db.cc
|
@ -6385,6 +6385,7 @@ noexcept try
|
|||
fs::read_opts opts;
|
||||
opts.offset = offset;
|
||||
opts.aio = this->aio;
|
||||
opts.all = !this->opts.direct;
|
||||
const mutable_buffer buf
|
||||
{
|
||||
scratch, length
|
||||
|
@ -6472,6 +6473,7 @@ noexcept try
|
|||
fs::read_opts opts;
|
||||
opts.offset = offset;
|
||||
opts.aio = this->aio;
|
||||
opts.all = !this->opts.direct;
|
||||
const mutable_buffer buf
|
||||
{
|
||||
scratch, length
|
||||
|
@ -6662,6 +6664,13 @@ try
|
|||
{
|
||||
fs::block_size(fd)
|
||||
}
|
||||
,aio
|
||||
{
|
||||
// When this flag is false then AIO operations are never used for this
|
||||
// file; if true, AIO may be used if available and/or other conditions.
|
||||
// Currently the /proc filesystem doesn't like AIO.
|
||||
!startswith(name, "/proc/")
|
||||
}
|
||||
{
|
||||
#ifdef RB_DEBUG_DB_ENV
|
||||
log::debug
|
||||
|
@ -6765,6 +6774,10 @@ const noexcept try
|
|||
};
|
||||
#endif
|
||||
|
||||
fs::read_opts opts;
|
||||
opts.offset = offset;
|
||||
opts.aio = this->aio;
|
||||
opts.all = !this->opts.direct;
|
||||
const mutable_buffer buf
|
||||
{
|
||||
scratch, length
|
||||
|
@ -6772,7 +6785,7 @@ const noexcept try
|
|||
|
||||
const auto read
|
||||
{
|
||||
fs::read(fd, buf, offset)
|
||||
fs::read(fd, buf, opts)
|
||||
};
|
||||
|
||||
*result = slice(read);
|
||||
|
@ -6953,6 +6966,10 @@ try
|
|||
{
|
||||
fs::block_size(fd)
|
||||
}
|
||||
,aio
|
||||
{
|
||||
true
|
||||
}
|
||||
{
|
||||
#ifdef RB_DEBUG_DB_ENV
|
||||
log::debug
|
||||
|
@ -7202,6 +7219,10 @@ const noexcept try
|
|||
};
|
||||
#endif
|
||||
|
||||
fs::read_opts opts;
|
||||
opts.offset = offset;
|
||||
opts.aio = this->aio;
|
||||
opts.all = !this->opts.direct;
|
||||
const mutable_buffer buf
|
||||
{
|
||||
scratch, length
|
||||
|
@ -7209,7 +7230,7 @@ const noexcept try
|
|||
|
||||
const auto read
|
||||
{
|
||||
fs::read(fd, buf, offset)
|
||||
fs::read(fd, buf, opts)
|
||||
};
|
||||
|
||||
*result = slice(read);
|
||||
|
|
Loading…
Reference in a new issue