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

ircd::db::env: Add propagation of nice values for all file types.

This commit is contained in:
Jason Volk 2020-01-06 11:12:29 -08:00
parent 3cb48a0f00
commit 559a0dd7ac
2 changed files with 44 additions and 1 deletions

View file

@ -1217,6 +1217,18 @@ catch(const std::exception &e)
return 0;
}
int8_t
ircd::db::database::env::make_nice(const Priority &prio)
{
switch(prio)
{
case Priority::HIGH: return -5;
case Priority::LOW: return 5;
case Priority::BOTTOM: return 20;
default: return 0;
}
}
int8_t
ircd::db::database::env::make_nice(const IOPriority &prio)
{
@ -1257,6 +1269,10 @@ try
ret.cloexec = this->env_opts.set_fd_cloexec;
return ret;
}()}
,ionice
{
ctx::ionice(ctx::cur())
}
,fd
{
name, this->opts
@ -1381,6 +1397,7 @@ noexcept try
fs::sync_opts opts;
opts.metadata = false;
opts.priority = ionice;
fs::flush(fd, opts);
return Status::OK();
}
@ -1429,6 +1446,7 @@ noexcept try
#endif
fs::sync_opts opts;
opts.priority = ionice;
fs::sync(fd, opts);
return Status::OK();
}
@ -1477,6 +1495,7 @@ noexcept try
#endif
fs::sync_opts opts;
opts.priority = ionice;
fs::flush(fd, opts);
return Status::OK();
}
@ -1538,6 +1557,7 @@ noexcept try
fs::sync_opts opts;
opts.metadata = false;
opts.priority = ionice;
fs::flush(fd, offset, length, opts);
return Status::OK();
}
@ -2815,6 +2835,10 @@ try
fs::block_size(fd):
1
}
,ionice
{
ctx::ionice(ctx::cur())
}
,aio
{
// When this flag is false then AIO operations are never used for this
@ -2926,6 +2950,7 @@ noexcept try
fs::read_opts opts;
opts.offset = offset;
opts.priority = ionice;
opts.aio = this->aio;
opts.all = false;
const mutable_buffer buf
@ -3014,6 +3039,7 @@ noexcept try
fs::read_opts opts;
opts.offset = offset;
opts.priority = ionice;
opts.aio = this->aio;
opts.all = false;
const mutable_buffer buf
@ -3205,6 +3231,10 @@ try
fs::block_size(fd):
1
}
,ionice
{
ctx::ionice(ctx::cur())
}
,aio
{
// When this flag is false then AIO operations are never used for this
@ -3320,6 +3350,7 @@ const noexcept try
fs::read_opts opts;
opts.offset = offset;
opts.priority = ionice;
opts.aio = this->aio;
opts.all = !this->opts.direct;
const mutable_buffer buf
@ -3510,6 +3541,10 @@ try
fs::block_size(fd):
1
}
,ionice
{
ctx::ionice(ctx::cur())
}
,aio
{
true
@ -3614,6 +3649,7 @@ noexcept try
#endif
fs::sync_opts opts;
opts.priority = ionice;
fs::flush(fd, opts);
return Status::OK();
}
@ -3661,6 +3697,7 @@ noexcept try
#endif
fs::sync_opts opts;
opts.priority = ionice;
fs::sync(fd, opts);
return Status::OK();
}
@ -3709,6 +3746,7 @@ noexcept try
fs::sync_opts opts;
opts.metadata = false;
opts.priority = ionice;
fs::flush(fd, opts);
return Status::OK();
}
@ -3765,6 +3803,7 @@ const noexcept try
fs::read_opts opts;
opts.offset = offset;
opts.priority = ionice;
opts.aio = this->aio;
opts.all = !this->opts.direct;
const mutable_buffer buf

View file

@ -34,7 +34,8 @@ struct ircd::db::database::env final
using ThreadStatus = rocksdb::ThreadStatus;
using ThreadStatusUpdater = rocksdb::ThreadStatusUpdater;
static int8_t make_nice(const IOPriority &prio);
static int8_t make_nice(const IOPriority &);
static int8_t make_nice(const Priority &);
static ircd::log::log log;
@ -127,6 +128,7 @@ struct ircd::db::database::env::random_access_file final
fs::fd::opts opts;
fs::fd fd;
size_t _buffer_align;
int8_t ionice {0};
bool aio;
bool use_direct_io() const noexcept override;
@ -153,6 +155,7 @@ struct ircd::db::database::env::random_rw_file final
fs::fd::opts opts;
fs::fd fd;
size_t _buffer_align;
int8_t ionice {0};
bool aio;
bool use_direct_io() const noexcept override;
@ -182,6 +185,7 @@ struct ircd::db::database::env::sequential_file final
fs::fd fd;
size_t _buffer_align;
off_t offset {0};
int8_t ionice {0};
bool aio;
bool use_direct_io() const noexcept override;