]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0009-blk-cgroup-always-terminate-io.stat-lines.patch
rebase patches on top of Ubuntu-5.15.0-29.30
[pve-kernel.git] / patches / kernel / 0009-blk-cgroup-always-terminate-io.stat-lines.patch
CommitLineData
51eaefb4
TL
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Wolfgang Bumiller <w.bumiller@proxmox.com>
75d6cb45 3Date: Tue, 11 Jan 2022 09:31:59 +0100
51eaefb4
TL
4Subject: [PATCH] blk-cgroup: always terminate io.stat lines
5
6With the removal of seq_get_buf in blkcg_print_one_stat, we
7cannot make adding the newline conditional on there being
8relevant stats because the name was already written out
9unconditionally.
10Otherwise we may end up with multiple device names in one
11line which is confusing and doesn't follow the nested-keyed
12file format.
13
14Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
15Fixes: 252c651a4c85 ("blk-cgroup: stop using seq_get_buf")
16Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17---
18 block/blk-cgroup.c | 9 ++-------
19 block/blk-iocost.c | 5 ++---
75d6cb45 20 block/blk-iolatency.c | 8 +++-----
51eaefb4 21 include/linux/blk-cgroup.h | 2 +-
75d6cb45 22 4 files changed, 8 insertions(+), 16 deletions(-)
51eaefb4
TL
23
24diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
6ef2b41a 25index 07a2524e6efd..fd09c20a5543 100644
51eaefb4
TL
26--- a/block/blk-cgroup.c
27+++ b/block/blk-cgroup.c
28@@ -887,7 +887,6 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
29 {
30 struct blkg_iostat_set *bis = &blkg->iostat;
31 u64 rbytes, wbytes, rios, wios, dbytes, dios;
32- bool has_stats = false;
33 const char *dname;
34 unsigned seq;
35 int i;
36@@ -913,14 +912,12 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
37 } while (u64_stats_fetch_retry(&bis->sync, seq));
38
39 if (rbytes || wbytes || rios || wios) {
40- has_stats = true;
41 seq_printf(s, "rbytes=%llu wbytes=%llu rios=%llu wios=%llu dbytes=%llu dios=%llu",
42 rbytes, wbytes, rios, wios,
43 dbytes, dios);
44 }
45
46 if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
47- has_stats = true;
48 seq_printf(s, " use_delay=%d delay_nsec=%llu",
49 atomic_read(&blkg->use_delay),
50 atomic64_read(&blkg->delay_nsec));
51@@ -932,12 +929,10 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
52 if (!blkg->pd[i] || !pol->pd_stat_fn)
53 continue;
54
55- if (pol->pd_stat_fn(blkg->pd[i], s))
56- has_stats = true;
57+ pol->pd_stat_fn(blkg->pd[i], s);
58 }
59
60- if (has_stats)
61- seq_printf(s, "\n");
62+ seq_puts(s, "\n");
63 }
64
65 static int blkcg_print_stat(struct seq_file *sf, void *v)
66diff --git a/block/blk-iocost.c b/block/blk-iocost.c
67index eb7b0d6bd11f..381c28f9561e 100644
68--- a/block/blk-iocost.c
69+++ b/block/blk-iocost.c
70@@ -2995,13 +2995,13 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
71 kfree(iocg);
72 }
73
74-static bool ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
75+static void ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
76 {
77 struct ioc_gq *iocg = pd_to_iocg(pd);
78 struct ioc *ioc = iocg->ioc;
79
80 if (!ioc->enabled)
81- return false;
82+ return;
83
84 if (iocg->level == 0) {
85 unsigned vp10k = DIV64_U64_ROUND_CLOSEST(
86@@ -3017,7 +3017,6 @@ static bool ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
87 iocg->last_stat.wait_us,
88 iocg->last_stat.indebt_us,
89 iocg->last_stat.indelay_us);
90- return true;
91 }
92
93 static u64 ioc_weight_prfill(struct seq_file *sf, struct blkg_policy_data *pd,
94diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
75d6cb45 95index c0545f9da549..d33460f3d43d 100644
51eaefb4
TL
96--- a/block/blk-iolatency.c
97+++ b/block/blk-iolatency.c
75d6cb45
TL
98@@ -890,7 +890,7 @@ static int iolatency_print_limit(struct seq_file *sf, void *v)
99 return 0;
100 }
101
102-static bool iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s)
103+static void iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s)
104 {
105 struct latency_stat stat;
106 int cpu;
51eaefb4
TL
107@@ -913,17 +913,16 @@ static bool iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s)
108 (unsigned long long)stat.ps.missed,
109 (unsigned long long)stat.ps.total,
110 iolat->rq_depth.max_depth);
111- return true;
112 }
113
114-static bool iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
115+static void iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
116 {
117 struct iolatency_grp *iolat = pd_to_lat(pd);
118 unsigned long long avg_lat;
119 unsigned long long cur_win;
120
121 if (!blkcg_debug_stats)
122- return false;
123+ return;
124
125 if (iolat->ssd)
126 return iolatency_ssd_stat(iolat, s);
127@@ -936,7 +935,6 @@ static bool iolatency_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
128 else
129 seq_printf(s, " depth=%u avg_lat=%llu win=%llu",
130 iolat->rq_depth.max_depth, avg_lat, cur_win);
131- return true;
132 }
133
134 static struct blkg_policy_data *iolatency_pd_alloc(gfp_t gfp,
135diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
6ef2b41a 136index bc5c04d711bb..618359e3beca 100644
51eaefb4
TL
137--- a/include/linux/blk-cgroup.h
138+++ b/include/linux/blk-cgroup.h
6ef2b41a 139@@ -153,7 +153,7 @@ typedef void (blkcg_pol_online_pd_fn)(struct blkg_policy_data *pd);
51eaefb4
TL
140 typedef void (blkcg_pol_offline_pd_fn)(struct blkg_policy_data *pd);
141 typedef void (blkcg_pol_free_pd_fn)(struct blkg_policy_data *pd);
142 typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkg_policy_data *pd);
143-typedef bool (blkcg_pol_stat_pd_fn)(struct blkg_policy_data *pd,
144+typedef void (blkcg_pol_stat_pd_fn)(struct blkg_policy_data *pd,
145 struct seq_file *s);
146
147 struct blkcg_policy {