Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys`

From: Youling Tang
Date: Tue Apr 16 2024 - 22:50:50 EST


Hi, Kent
On 17/04/2024 10:20, Kent Overstreet wrote:
On Wed, Apr 17, 2024 at 09:54:48AM +0800, Youling Tang wrote:
From: Youling Tang <tangyouling@xxxxxxxxxx>

Before patch:
```
#cat btrees/inodes/keys
u64s 17 type inode_v3 0:4096:U32_MAX len 0 ver 0: mode=40755
flags= (16300000)
```

After patch:
```
#cat btrees/inodes/keys
u64s 17 type inode_v3 0:4096:U32_MAX len 0 ver 0:
mode=40755
flags= (16300000)
This would print a newline for keys that don't have a value...
The original intention was to make the display of the printed content in
'__bch2_inode_unpacked_to_text ()' consistent, without considering other callbacks.

Or just modify it in the following way?
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -534,6 +534,8 @@ int bch2_inode_v3_invalid(struct bch_fs *c, struct bkey_s_c k,
 static void __bch2_inode_unpacked_to_text(struct printbuf *out,
struct bch_inode_unpacked *inode)
 {
+       prt_newline(out);
+
        printbuf_indent_add(out, 2);
        prt_printf(out, "mode=%o", inode->bi_mode);
        prt_newline(out);


Thanks,
Youling.