mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-26 09:56:28 -05:00
Inline ioprio disabled fast path
- Expose the ioprio enabled flag as an atomic for relaxed inline checks - Inline SetFrom construction so disabled read/write paths avoid a function call - Move priority application into a slow helper used only when ioprio is enabled
This commit is contained in:
parent
30d59d4458
commit
5f7fa17ad8
2 changed files with 33 additions and 14 deletions
|
|
@ -32,8 +32,12 @@ enum
|
|||
IOPRIO_WHO_PROCESS = 1
|
||||
};
|
||||
|
||||
namespace ioprio
|
||||
{
|
||||
std::atomic<bool> _enabled{false};
|
||||
}
|
||||
|
||||
thread_local int ioprio::SetFrom::thread_prio = -1;
|
||||
bool _enabled = false;
|
||||
|
||||
int
|
||||
ioprio::get(const int who_)
|
||||
|
|
@ -69,22 +73,14 @@ ioprio::set(const int who_,
|
|||
void
|
||||
ioprio::enable(const bool enable_)
|
||||
{
|
||||
_enabled = enable_;
|
||||
_enabled.store(enable_,std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool
|
||||
ioprio::enabled()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
ioprio::SetFrom::SetFrom(const pid_t pid_)
|
||||
void
|
||||
ioprio::SetFrom::_slow_apply(const pid_t pid_)
|
||||
{
|
||||
int client_prio;
|
||||
|
||||
if(!_enabled)
|
||||
return;
|
||||
|
||||
client_prio = ioprio::get(pid_);
|
||||
if(client_prio < 0)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue