]> www.infradead.org Git - users/hch/misc.git/commitdiff
bcachefs: Move tabstop setup to bch2_dev_usage_to_text()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 4 Sep 2024 21:51:16 +0000 (17:51 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Sep 2024 15:39:48 +0000 (11:39 -0400)
No reason for it not to be where it's needed.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_foreground.c
fs/bcachefs/buckets.c

index bf8fb9cd650bb71eb6f28b77ff68bd03d96fba38..d0e0b56892e39f86fc00a1936cf3864d110e94eb 100644 (file)
@@ -1729,13 +1729,6 @@ void bch2_dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
        for (unsigned i = 0; i < ARRAY_SIZE(c->open_buckets); i++)
                nr[c->open_buckets[i].data_type]++;
 
-       printbuf_tabstops_reset(out);
-       printbuf_tabstop_push(out, 12);
-       printbuf_tabstop_push(out, 16);
-       printbuf_tabstop_push(out, 16);
-       printbuf_tabstop_push(out, 16);
-       printbuf_tabstop_push(out, 16);
-
        bch2_dev_usage_to_text(out, ca, &stats);
 
        prt_newline(out);
index 4a0f55dc78c4e7281f97016efd4ce7812c4279e6..4abd22d7e3f84b692d077de41461fdfc239e5c21 100644 (file)
@@ -75,6 +75,15 @@ void bch2_dev_usage_to_text(struct printbuf *out,
                            struct bch_dev *ca,
                            struct bch_dev_usage *usage)
 {
+       if (out->nr_tabstops < 5) {
+               printbuf_tabstops_reset(out);
+               printbuf_tabstop_push(out, 12);
+               printbuf_tabstop_push(out, 16);
+               printbuf_tabstop_push(out, 16);
+               printbuf_tabstop_push(out, 16);
+               printbuf_tabstop_push(out, 16);
+       }
+
        prt_printf(out, "\tbuckets\rsectors\rfragmented\r\n");
 
        for (unsigned i = 0; i < BCH_DATA_NR; i++) {