2022-01-11 10:13:17 +03:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
2022-01-11 11:46:44 +03:00
|
|
|
Date: Tue, 11 Jan 2022 09:31:59 +0100
|
2022-01-11 10:13:17 +03:00
|
|
|
Subject: [PATCH] blk-cgroup: always terminate io.stat lines
|
|
|
|
|
|
|
|
With the removal of seq_get_buf in blkcg_print_one_stat, we
|
|
|
|
cannot make adding the newline conditional on there being
|
|
|
|
relevant stats because the name was already written out
|
|
|
|
unconditionally.
|
|
|
|
Otherwise we may end up with multiple device names in one
|
|
|
|
line which is confusing and doesn't follow the nested-keyed
|
|
|
|
file format.
|
|
|
|
|
|
|
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
|
|
|
Fixes: 252c651a4c85 ("blk-cgroup: stop using seq_get_buf")
|
|
|
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
|
|
---
|
|
|
|
block/blk-cgroup.c | 9 ++-------
|
|
|
|
block/blk-iocost.c | 5 ++---
|
2022-01-11 11:46:44 +03:00
|
|
|
block/blk-iolatency.c | 8 +++-----
|
2022-01-11 10:13:17 +03:00
|
|
|
include/linux/blk-cgroup.h | 2 +-
|
2022-01-11 11:46:44 +03:00
|
|
|
4 files changed, 8 insertions(+), 16 deletions(-)
|
2022-01-11 10:13:17 +03:00
|
|
|
|
|
|
|
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
|
2024-06-10 17:55:23 +03:00
|
|
|
index fd81a7370864..4677829e4ae3 100644
|
2022-01-11 10:13:17 +03:00
|
|
|
--- a/block/blk-cgroup.c
|
|
|
|
+++ b/block/blk-cgroup.c
|
2024-03-29 17:21:30 +03:00
|
|
|
@@ -900,7 +900,6 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
|
2022-01-11 10:13:17 +03:00
|
|
|
{
|
|
|
|
struct blkg_iostat_set *bis = &blkg->iostat;
|
|
|
|
u64 rbytes, wbytes, rios, wios, dbytes, dios;
|
|
|
|
- bool has_stats = false;
|
|
|
|
const char *dname;
|
|
|
|
unsigned seq;
|
|
|
|
int i;
|
2024-03-29 17:21:30 +03:00
|
|
|
@@ -926,14 +925,12 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
|
2022-01-11 10:13:17 +03:00
|
|
|
} while (u64_stats_fetch_retry(&bis->sync, seq));
|
|
|
|
|
|
|
|
if (rbytes || wbytes || rios || wios) {
|
|
|
|
- has_stats = true;
|
|
|
|
seq_printf(s, "rbytes=%llu wbytes=%llu rios=%llu wios=%llu dbytes=%llu dios=%llu",
|
|
|
|
rbytes, wbytes, rios, wios,
|
|
|
|
dbytes, dios);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
|
|
|
|
- has_stats = true;
|
|
|
|
seq_printf(s, " use_delay=%d delay_nsec=%llu",
|
|
|
|
atomic_read(&blkg->use_delay),
|
|
|
|
atomic64_read(&blkg->delay_nsec));
|
2024-03-29 17:21:30 +03:00
|
|
|
@@ -945,12 +942,10 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
|
2022-01-11 10:13:17 +03:00
|
|
|
if (!blkg->pd[i] || !pol->pd_stat_fn)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
- if (pol->pd_stat_fn(blkg->pd[i], s))
|
|
|
|
- has_stats = true;
|
|
|
|
+ pol->pd_stat_fn(blkg->pd[i], s);
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (has_stats)
|
|
|
|
- seq_printf(s, "\n");
|
|
|
|
+ seq_puts(s, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static int blkcg_print_stat(struct seq_file *sf, void *v)
|
|
|
|
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
|
2024-06-10 17:55:23 +03:00
|
|
|
index 645a589edda8..b0846da38eda 100644
|
2022-01-11 10:13:17 +03:00
|
|
|
--- a/block/blk-iocost.c
|
|
|
|
+++ b/block/blk-iocost.c
|
2024-03-29 17:21:30 +03:00
|
|
|
@@ -3028,13 +3028,13 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
|
2022-01-11 10:13:17 +03:00
|
|
|
kfree(iocg);
|
|
|
|
}
|
|
|
|
|
|
|
|
-static bool ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
|
|
|
+static void ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
|
|
|
{
|
|
|
|
struct ioc_gq *iocg = pd_to_iocg(pd);
|
|
|
|
struct ioc *ioc = iocg->ioc;
|
|
|
|
|
|
|
|
if (!ioc->enabled)
|
|
|
|
- return false;
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
if (iocg->level == 0) {
|
|
|
|
unsigned vp10k = DIV64_U64_ROUND_CLOSEST(
|
2024-03-29 17:21:30 +03:00
|
|
|
@@ -3050,7 +3050,6 @@ static bool ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
2022-01-11 10:13:17 +03:00
|
|
|
iocg->last_stat.wait_us,
|
|
|
|
iocg->last_stat.indebt_us,
|
|
|
|
iocg->last_stat.indelay_us);
|
|
|
|
- return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static u64 ioc_weight_prfill(struct seq_file *sf, struct blkg_policy_data *pd,
|
|
|
|
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
|
2024-06-10 17:55:23 +03:00
|
|
|
index bdef8395af6e..a5f13743a280 100644
|
2022-01-11 10:13:17 +03:00
|
|
|
--- a/block/blk-iolatency.c
|
|
|
|
+++ b/block/blk-iolatency.c
|
2022-10-13 11:28:51 +03:00
|
|
|
@@ -906,7 +906,7 @@ static int iolatency_print_limit(struct seq_file *sf, void *v)
|
2022-01-11 11:46:44 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static bool iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s)
|
|
|
|
+static void iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s)
|
|
|
|
{
|
|
|
|
struct latency_stat stat;
|
|
|
|
int cpu;
|
2022-10-13 11:28:51 +03:00
|
|
|
@@ -929,17 +929,16 @@ static bool iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s)
|
2022-01-11 10:13:17 +03:00
|
|
|
(unsigned long long)stat.ps.missed,
|
|
|
|
(unsigned long long)stat.ps.total,
|
|
|
|
iolat->rq_depth.max_depth);
|
|
|
|
- return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static bool iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
|
|
|
+static void iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
|
|
|
{
|
|
|
|
struct iolatency_grp *iolat = pd_to_lat(pd);
|
|
|
|
unsigned long long avg_lat;
|
|
|
|
unsigned long long cur_win;
|
|
|
|
|
|
|
|
if (!blkcg_debug_stats)
|
|
|
|
- return false;
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
if (iolat->ssd)
|
|
|
|
return iolatency_ssd_stat(iolat, s);
|
2022-10-13 11:28:51 +03:00
|
|
|
@@ -952,7 +951,6 @@ static bool iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
2022-01-11 10:13:17 +03:00
|
|
|
else
|
|
|
|
seq_printf(s, " depth=%u avg_lat=%llu win=%llu",
|
|
|
|
iolat->rq_depth.max_depth, avg_lat, cur_win);
|
|
|
|
- return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct blkg_policy_data *iolatency_pd_alloc(gfp_t gfp,
|
|
|
|
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
|
2024-06-10 17:55:23 +03:00
|
|
|
index bc5c04d711bb..618359e3beca 100644
|
2022-01-11 10:13:17 +03:00
|
|
|
--- a/include/linux/blk-cgroup.h
|
|
|
|
+++ b/include/linux/blk-cgroup.h
|
2022-05-04 13:31:19 +03:00
|
|
|
@@ -153,7 +153,7 @@ typedef void (blkcg_pol_online_pd_fn)(struct blkg_policy_data *pd);
|
2022-01-11 10:13:17 +03:00
|
|
|
typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd);
|
|
|
|
typedef void (blkcg_pol_free_pd_fn)(struct blkg_policy_data *pd);
|
|
|
|
typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkg_policy_data *pd);
|
|
|
|
-typedef bool (blkcg_pol_stat_pd_fn)(struct blkg_policy_data *pd,
|
|
|
|
+typedef void (blkcg_pol_stat_pd_fn)(struct blkg_policy_data *pd,
|
|
|
|
struct seq_file *s);
|
|
|
|
|
|
|
|
struct blkcg_policy {
|