mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
ioprio: normalize io priority values in configuration
Let's always say IOPRIO_CLASS_BE when IOPRIO_CALSS_NONE is set.
This commit is contained in:
@@ -20,3 +20,8 @@ int ioprio_parse_priority(const char *s, int *ret);
|
||||
/* IOPRIO_CLASS_NONE with any prio value is another way to say IOPRIO_CLASS_BE with level 4. Encode that in a
|
||||
* proper macro. */
|
||||
#define IOPRIO_DEFAULT_CLASS_AND_PRIO ioprio_prio_value(IOPRIO_CLASS_BE, 4)
|
||||
|
||||
static inline int ioprio_normalize(int v) {
|
||||
/* Converts IOPRIO_CLASS_NONE to what it actually means */
|
||||
return ioprio_prio_class(v) == IOPRIO_CLASS_NONE ? IOPRIO_DEFAULT_CLASS_AND_PRIO : v;
|
||||
}
|
||||
|
||||
@@ -2811,7 +2811,7 @@ int bus_exec_context_set_transient_property(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
c->ioprio = ioprio_prio_value(q, ioprio_prio_data(c->ioprio));
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(q, ioprio_prio_data(c->ioprio)));
|
||||
c->ioprio_set = true;
|
||||
|
||||
unit_write_settingf(u, flags, name, "IOSchedulingClass=%s", s);
|
||||
@@ -2830,7 +2830,7 @@ int bus_exec_context_set_transient_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid IO scheduling priority: %i", p);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
c->ioprio = ioprio_prio_value(ioprio_prio_class(c->ioprio), p);
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(ioprio_prio_class(c->ioprio), p));
|
||||
c->ioprio_set = true;
|
||||
|
||||
unit_write_settingf(u, flags, name, "IOSchedulingPriority=%i", p);
|
||||
|
||||
@@ -1427,7 +1427,7 @@ int config_parse_exec_io_class(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
c->ioprio = ioprio_prio_value(x, ioprio_prio_data(c->ioprio));
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(x, ioprio_prio_data(c->ioprio)));
|
||||
c->ioprio_set = true;
|
||||
|
||||
return 0;
|
||||
@@ -1464,7 +1464,7 @@ int config_parse_exec_io_priority(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
c->ioprio = ioprio_prio_value(ioprio_prio_class(c->ioprio), i);
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(ioprio_prio_class(c->ioprio), i));
|
||||
c->ioprio_set = true;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user