summaryrefslogtreecommitdiff
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 52aa0540ccaf..b8ec47dcce42 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -877,8 +877,6 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
bool has_stats = false;
const char *dname;
unsigned seq;
- char *buf;
- size_t size = seq_get_buf(s, &buf), off = 0;
int i;
if (!blkg->online)
@@ -888,13 +886,7 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
if (!dname)
return;
- /*
- * Hooray string manipulation, count is the size written NOT
- * INCLUDING THE \0, so size is now count+1 less than what we
- * had before, but we want to start writing the next bit from
- * the \0 so we only add count to buf.
- */
- off += scnprintf(buf+off, size-off, "%s ", dname);
+ seq_printf(s, "%s ", dname);
do {
seq = u64_stats_fetch_begin(&bis->sync);
@@ -909,40 +901,30 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
if (rbytes || wbytes || rios || wios) {
has_stats = true;
- off += scnprintf(buf+off, size-off,
- "rbytes=%llu wbytes=%llu rios=%llu wios=%llu dbytes=%llu dios=%llu",
+ 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;
- off += scnprintf(buf+off, size-off, " use_delay=%d delay_nsec=%llu",
+ seq_printf(s, " use_delay=%d delay_nsec=%llu",
atomic_read(&blkg->use_delay),
atomic64_read(&blkg->delay_nsec));
}
for (i = 0; i < BLKCG_MAX_POLS; i++) {
struct blkcg_policy *pol = blkcg_policy[i];
- size_t written;
if (!blkg->pd[i] || !pol->pd_stat_fn)
continue;
- written = pol->pd_stat_fn(blkg->pd[i], buf+off, size-off);
- if (written)
+ if (pol->pd_stat_fn(blkg->pd[i], s))
has_stats = true;
- off += written;
}
- if (has_stats) {
- if (off < size - 1) {
- off += scnprintf(buf+off, size-off, "\n");
- seq_commit(s, off);
- } else {
- seq_commit(s, -1);
- }
- }
+ if (has_stats)
+ seq_printf(s, "\n");
}
static int blkcg_print_stat(struct seq_file *sf, void *v)