[PATCH] bcachefs: Fix missing spaces in journal_entry_dev_usage_to_text
From: Youling Tang
Date: Thu Apr 18 2024 - 04:32:04 EST
From: Youling Tang <tangyouling@xxxxxxxxxx>
Fixed missing spaces displayed in journal_entry_dev_usage_to_text
while adjusting the display format to improve readability.
before:
```
# bcachefs list_journal -a -t alloc:1:0 /dev/sdb
...
dev_usage: dev=0free: buckets=233180 sectors=0 fragmented=0sb: buckets=13 sectors=6152 fragmented=504journal: buckets=1847 sectors=945664 fragmented=0btree: buckets=20 sectors=10240 fragmented=0user: buckets=1419 sectors=726513 fragmented=15cached: buckets=0 sectors=0 fragmented=0parity: buckets=0 sectors=0 fragmented=0stripe: buckets=0 sectors=0 fragmented=0need_gc_gens: buckets=0 sectors=0 fragmented=0need_discard: buckets=1 sectors=0 fragmented=0
```
after:
```
# bcachefs list_journal -a -t alloc:1:0 /dev/sdb
...
dev_usage: dev=0
free: buckets=233180 sectors=0 fragmented=0
sb: buckets=13 sectors=6152 fragmented=504
journal: buckets=1847 sectors=945664 fragmented=0
btree: buckets=20 sectors=10240 fragmented=0
user: buckets=1419 sectors=726513 fragmented=15
cached: buckets=0 sectors=0 fragmented=0
parity: buckets=0 sectors=0 fragmented=0
stripe: buckets=0 sectors=0 fragmented=0
need_gc_gens: buckets=0 sectors=0 fragmented=0
need_discard: buckets=1 sectors=0 fragmented=0
```
Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxx>
---
- Note: Test only by modifying bcachefs-tools.
fs/bcachefs/journal_io.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index e726d9f560a0..58501ef758b3 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -706,13 +706,16 @@ static void journal_entry_dev_usage_to_text(struct printbuf *out, struct bch_fs
prt_printf(out, "dev=%u", le32_to_cpu(u->dev));
+ printbuf_indent_add(out, 2);
for (i = 0; i < nr_types; i++) {
+ prt_newline(out);
bch2_prt_data_type(out, i);
prt_printf(out, ": buckets=%llu sectors=%llu fragmented=%llu",
le64_to_cpu(u->d[i].buckets),
le64_to_cpu(u->d[i].sectors),
le64_to_cpu(u->d[i].fragmented));
}
+ printbuf_indent_sub(out, 2);
}
static int journal_entry_log_validate(struct bch_fs *c,
--
2.34.1