1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-28 05:57:33 +03:00

core/cgroup: drop allow_cache parameter in unit_get_io_accounting()

The name of the parameter is misleading and it does not save us much
work because it is not used during regular unit property queries.
It is only used during unit_log_resources(), and the cgroup is already
dead by that point so it won't be read anyway.

(cherry picked from commit a0020ad84bb092fc72cde7dca5784a0a4e613fd7)
This commit is contained in:
Ivan Shapovalov 2024-09-20 17:02:13 +02:00 committed by Luca Boccassi
parent 2cd8079efa
commit a0d60f5621
4 changed files with 3 additions and 7 deletions

View File

@ -4863,7 +4863,6 @@ static int unit_get_io_accounting_raw(
int unit_get_io_accounting(
Unit *u,
CGroupIOAccountingMetric metric,
bool allow_cache,
uint64_t *ret) {
uint64_t raw[_CGROUP_IO_ACCOUNTING_METRIC_MAX];
@ -4878,9 +4877,6 @@ int unit_get_io_accounting(
if (!crt)
return -ENODATA;
if (allow_cache && crt->io_accounting_last[metric] != UINT64_MAX)
goto done;
r = unit_get_io_accounting_raw(u, crt, raw);
if (r == -ENODATA && crt->io_accounting_last[metric] != UINT64_MAX)
goto done;

View File

@ -482,7 +482,7 @@ int unit_get_memory_current(Unit *u, uint64_t *ret);
int unit_get_memory_accounting(Unit *u, CGroupMemoryAccountingMetric metric, uint64_t *ret);
int unit_get_tasks_current(Unit *u, uint64_t *ret);
int unit_get_cpu_usage(Unit *u, nsec_t *ret);
int unit_get_io_accounting(Unit *u, CGroupIOAccountingMetric metric, bool allow_cache, uint64_t *ret);
int unit_get_io_accounting(Unit *u, CGroupIOAccountingMetric metric, uint64_t *ret);
int unit_get_ip_accounting(Unit *u, CGroupIPAccountingMetric metric, uint64_t *ret);
int unit_get_effective_limit(Unit *u, CGroupLimitType type, uint64_t *ret);

View File

@ -1438,7 +1438,7 @@ static int property_get_io_counter(
assert(property);
assert_se((metric = cgroup_io_accounting_metric_from_string(property)) >= 0);
(void) unit_get_io_accounting(u, metric, /* allow_cache= */ false, &value);
(void) unit_get_io_accounting(u, metric, &value);
return sd_bus_message_append(reply, "t", value);
}

View File

@ -2390,7 +2390,7 @@ static int unit_log_resources(Unit *u) {
assert(io_fields[k].journal_field);
(void) unit_get_io_accounting(u, k, k > 0, &value);
(void) unit_get_io_accounting(u, k, &value);
if (value == UINT64_MAX)
continue;