Skip to contentSkip to conversation

bcachefs: Align the display format of `btrees/inodes/keys`

PATCH Superseded Youling Tang 3 participants 9 messages Apr 17, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: Align the display format of `btrees/inodes/keys`

From: Youling Tang <[email protected]>

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)
```
---
 fs/bcachefs/bkey_methods.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/bcachefs/bkey_methods.c +2 -1
index db336a43fc08..03c755f65430 100644
@@ -306,7 +306,8 @@ void bch2_bkey_val_to_text(struct printbuf *out, struct bch_fs *c,
 	bch2_bkey_to_text(out, k.k);
 
 	if (bkey_val_bytes(k.k)) {
-		prt_printf(out, ": ");
+		prt_printf(out, ":");
+		prt_newline(out);
 		bch2_val_to_text(out, c, k);
 	}
 }
Signature · 1 line
2.34.1
#1 lore raw
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

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

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...

#2 lore raw

Hi, Kent

Quoted 10 lines · Kent Overstreet
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

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

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?

fs/bcachefs/inode.c +0 -0
@@ -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.

#3 lore raw
Quoted 18 lines · Youling Tang

Hi, Kent

Quoted 16 lines · Kent Overstreet
Quoted 15 lines · Youling Tang

From: Youling Tang <[email protected]>

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)
Quoted 6 lines
Quoted 1 line

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?

Yeah, that's better

Do it off my master branch though, there's some printbuf imprevements in there.

https://evilpiepirate.org/git/bcachefs.git

Quoted 16 lines
fs/bcachefs/inode.c +2 -0
@@ -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.

#4 lore raw
Quoted 13 lines · Kent Overstreet
Quoted 12 lines · Youling Tang

Hi, Kent

Quoted 10 lines · Kent Overstreet
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

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

After patch:
```
#cat btrees/inodes/keys
u64s 17 type inode_v3 0:4096:U32_MAX len 0 ver 0:

     mode=40755
     flags= (16300000)

The flags also with the space after "=". Is it reseonable?

Quoted 31 lines
Quoted 6 lines
Quoted 1 line

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?

Yeah, that's better

Do it off my master branch though, there's some printbuf imprevements in there.

https://evilpiepirate.org/git/bcachefs.git

Quoted 16 lines
fs/bcachefs/inode.c +2 -0
@@ -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.

#5 lore raw
Quoted 16 lines · Hongbo Li
Quoted 13 lines · Kent Overstreet
Quoted 12 lines · Youling Tang

Hi, Kent

Quoted 10 lines · Kent Overstreet
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

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

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

The flags also with the space after "=". Is it reseonable?

Sorry, I misspell. I mean whether it is reasonable.

Quoted 32 lines
Quoted 31 lines
Quoted 6 lines
Quoted 1 line

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?

Yeah, that's better

Do it off my master branch though, there's some printbuf imprevements in there.

https://evilpiepirate.org/git/bcachefs.git

Quoted 16 lines
fs/bcachefs/inode.c +2 -0
@@ -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.

#6 lore raw

Hi, Kent & Hongbo

Quoted 19 lines · Hongbo Li
Quoted 16 lines · Hongbo Li
Quoted 13 lines · Kent Overstreet
Quoted 12 lines · Youling Tang

Hi, Kent

Quoted 10 lines · Kent Overstreet
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

```
   #cat btrees/inodes/keys
   u64s 17 type inode_v3 0:4096:U32_MAX len 0 ver 0: mode=40755
     flags= (16300000)
```
Quoted 21 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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

The flags also with the space after "=". Is it reseonable?

Sorry, I misspell. I mean whether it is reasonable.

Quoted 13 lines
Quoted 13 lines
Quoted 6 lines
Quoted 1 line

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?

Yeah, that's better

Do it off my master branch though, there's some printbuf imprevements in there.

https://evilpiepirate.org/git/bcachefs.git

I will make the following changes based on the master branch,

--- a/fs/bcachefs/inode.c

+++ b/fs/bcachefs/inode.c
@@ -534,12 +534,13 @@ 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_printf(out, "\n");
        printbuf_indent_add(out, 2);
        prt_printf(out, "mode=%o\n", inode->bi_mode);

        prt_str(out, "flags=");
        prt_bitflags(out, bch2_inode_flag_strs, inode->bi_flags & ((1U << 20) - 1)); -       prt_printf(out, " (%x)\n", inode->bi_flags);
+       prt_printf(out, "(%x)\n", inode->bi_flags);

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 17 lines
fs/bcachefs/inode.c +2 -0
@@ -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.

#7 lore raw
Quoted 52 lines · Youling Tang

Hi, Kent & Hongbo

Quoted 19 lines · Hongbo Li
Quoted 16 lines · Hongbo Li
Quoted 13 lines · Kent Overstreet
Quoted 12 lines · Youling Tang

Hi, Kent

Quoted 10 lines · Kent Overstreet
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

```
   #cat btrees/inodes/keys
   u64s 17 type inode_v3 0:4096:U32_MAX len 0 ver 0: mode=40755
     flags= (16300000)
```
Quoted 21 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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

The flags also with the space after "=". Is it reseonable?

Sorry, I misspell. I mean whether it is reasonable.

Quoted 13 lines
Quoted 13 lines
Quoted 6 lines
Quoted 1 line

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?

Yeah, that's better

Do it off my master branch though, there's some printbuf imprevements in there.

https://evilpiepirate.org/git/bcachefs.git

I will make the following changes based on the master branch,

--- a/fs/bcachefs/inode.c

+++ b/fs/bcachefs/inode.c

(quoted diff) +0 -0
@@ -534,12 +534,13 @@ 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)

Review int bch2_inode_v3_invalid(struct bch_fs *c, struct · line 546

Quoted 10 lines
(quoted diff) +2 -1
  {
+       prt_printf(out, "\n");
         printbuf_indent_add(out, 2);
         prt_printf(out, "mode=%o\n", inode->bi_mode);
 
         prt_str(out, "flags=");
         prt_bitflags(out, bch2_inode_flag_strs, inode->bi_flags & ((1U 
 << 20) - 1));
-       prt_printf(out, " (%x)\n", inode->bi_flags);
+       prt_printf(out, "(%x)\n", inode->bi_flags);

I think it's ok. Maybe use prt_newline(out) is better than prt_printf(out, "\n");

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 17 lines
fs/bcachefs/inode.c +2 -0
@@ -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.

#8 lore raw
Quoted 63 lines · Hongbo Li
Quoted 60 lines · Youling Tang

Hi, Kent & Hongbo

Quoted 19 lines · Hongbo Li
Quoted 16 lines · Hongbo Li
Quoted 13 lines · Kent Overstreet
Quoted 12 lines · Youling Tang

Hi, Kent

Quoted 10 lines · Kent Overstreet
Quoted 9 lines · Youling Tang

From: Youling Tang <[email protected]>

Before patch:

```
   #cat btrees/inodes/keys
   u64s 17 type inode_v3 0:4096:U32_MAX len 0 ver 0: mode=40755
     flags= (16300000)
```
Quoted 24 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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

The flags also with the space after "=". Is it reseonable?

Sorry, I misspell. I mean whether it is reasonable.

Quoted 16 lines
Quoted 16 lines
Quoted 8 lines
Quoted 1 line

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?

Yeah, that's better

Do it off my master branch though, there's some printbuf imprevements in
there.

https://evilpiepirate.org/git/bcachefs.git

I will make the following changes based on the master branch,

--- a/fs/bcachefs/inode.c

+++ b/fs/bcachefs/inode.c

(quoted diff) +1 -0
@@ -534,12 +534,13 @@ 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_printf(out, "\n");
         printbuf_indent_add(out, 2);
         prt_printf(out, "mode=%o\n", inode->bi_mode);
 
Quoted 7 lines

Review int bch2_inode_v3_invalid(struct bch_fs *c, struct · line 546

Quoted 5 lines
(quoted diff) +1 -1
         prt_str(out, "flags=");
         prt_bitflags(out, bch2_inode_flag_strs, inode->bi_flags & ((1U
 << 20) - 1));
-       prt_printf(out, " (%x)\n", inode->bi_flags);
+       prt_printf(out, "(%x)\n", inode->bi_flags);

I think it's ok. Maybe use prt_newline(out) is better than prt_printf(out, "\n");

prt_printf("\n") is the same as prt_newline() now