* [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` @ 2024-04-17 1:54 Youling Tang 2024-04-17 2:20 ` Kent Overstreet 0 siblings, 1 reply; 9+ messages in thread From: Youling Tang @ 2024-04-17 1:54 UTC (permalink / raw) To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Youling Tang From: Youling Tang <tangyouling@kylinos.cn> 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) ``` Signed-off-by: Youling Tang <tangyouling@kylinos.cn> --- fs/bcachefs/bkey_methods.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c index db336a43fc08..03c755f65430 100644 --- a/fs/bcachefs/bkey_methods.c +++ b/fs/bcachefs/bkey_methods.c @@ -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); } } -- 2.34.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 1:54 [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` Youling Tang @ 2024-04-17 2:20 ` Kent Overstreet 2024-04-17 2:50 ` Youling Tang 0 siblings, 1 reply; 9+ messages in thread From: Kent Overstreet @ 2024-04-17 2:20 UTC (permalink / raw) To: Youling Tang; +Cc: linux-bcachefs, linux-kernel, Youling Tang On Wed, Apr 17, 2024 at 09:54:48AM +0800, Youling Tang wrote: > From: Youling Tang <tangyouling@kylinos.cn> > > 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... ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 2:20 ` Kent Overstreet @ 2024-04-17 2:50 ` Youling Tang 2024-04-17 2:59 ` Kent Overstreet 0 siblings, 1 reply; 9+ messages in thread From: Youling Tang @ 2024-04-17 2:50 UTC (permalink / raw) To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Youling Tang 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@kylinos.cn> >> >> 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 2:50 ` Youling Tang @ 2024-04-17 2:59 ` Kent Overstreet 2024-04-17 3:16 ` Hongbo Li 0 siblings, 1 reply; 9+ messages in thread From: Kent Overstreet @ 2024-04-17 2:59 UTC (permalink / raw) To: Youling Tang; +Cc: linux-bcachefs, linux-kernel, Youling Tang On Wed, Apr 17, 2024 at 10:50:10AM +0800, Youling Tang wrote: > 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@kylinos.cn> > > > > > > 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? Yeah, that's better Do it off my master branch though, there's some printbuf imprevements in there. https://evilpiepirate.org/git/bcachefs.git > --- 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 2:59 ` Kent Overstreet @ 2024-04-17 3:16 ` Hongbo Li 2024-04-17 3:21 ` Hongbo Li 0 siblings, 1 reply; 9+ messages in thread From: Hongbo Li @ 2024-04-17 3:16 UTC (permalink / raw) To: Kent Overstreet, Youling Tang; +Cc: linux-bcachefs, linux-kernel, Youling Tang On 2024/4/17 10:59, Kent Overstreet wrote: > On Wed, Apr 17, 2024 at 10:50:10AM +0800, Youling Tang wrote: >> 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@kylinos.cn> >>>> >>>> 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) The flags also with the space after "=". Is it reseonable? >>> 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 > >> --- 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. > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 3:16 ` Hongbo Li @ 2024-04-17 3:21 ` Hongbo Li 2024-04-17 5:51 ` Youling Tang 0 siblings, 1 reply; 9+ messages in thread From: Hongbo Li @ 2024-04-17 3:21 UTC (permalink / raw) To: Kent Overstreet, Youling Tang; +Cc: linux-bcachefs, linux-kernel, Youling Tang On 2024/4/17 11:16, Hongbo Li wrote: > > > On 2024/4/17 10:59, Kent Overstreet wrote: >> On Wed, Apr 17, 2024 at 10:50:10AM +0800, Youling Tang wrote: >>> 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@kylinos.cn> >>>>> >>>>> 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) > The flags also with the space after "=". Is it reseonable? Sorry, I misspell. I mean whether it is reasonable. >>>> 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 >> >>> --- 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. >> > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 3:21 ` Hongbo Li @ 2024-04-17 5:51 ` Youling Tang 2024-04-17 9:49 ` Hongbo Li 0 siblings, 1 reply; 9+ messages in thread From: Youling Tang @ 2024-04-17 5:51 UTC (permalink / raw) To: Kent Overstreet; +Cc: Hongbo Li, linux-bcachefs, linux-kernel, Youling Tang Hi, Kent & Hongbo On 17/04/2024 11:21, Hongbo Li wrote: > > > On 2024/4/17 11:16, Hongbo Li wrote: >> >> >> On 2024/4/17 10:59, Kent Overstreet wrote: >>> On Wed, Apr 17, 2024 at 10:50:10AM +0800, Youling Tang wrote: >>>> 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@kylinos.cn> >>>>>> >>>>>> 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) >> The flags also with the space after "=". Is it reseonable? > Sorry, I misspell. I mean whether it is reasonable. >>>>> 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); >>> >>>> --- 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. >>> >> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 5:51 ` Youling Tang @ 2024-04-17 9:49 ` Hongbo Li 2024-04-17 10:05 ` Kent Overstreet 0 siblings, 1 reply; 9+ messages in thread From: Hongbo Li @ 2024-04-17 9:49 UTC (permalink / raw) To: Youling Tang, Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Youling Tang On 2024/4/17 13:51, Youling Tang wrote: > Hi, Kent & Hongbo > On 17/04/2024 11:21, Hongbo Li wrote: >> >> >> On 2024/4/17 11:16, Hongbo Li wrote: >>> >>> >>> On 2024/4/17 10:59, Kent Overstreet wrote: >>>> On Wed, Apr 17, 2024 at 10:50:10AM +0800, Youling Tang wrote: >>>>> 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@kylinos.cn> >>>>>>> >>>>>>> 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) >>> The flags also with the space after "=". Is it reseonable? >> Sorry, I misspell. I mean whether it is reasonable. >>>>>> 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); I think it's ok. Maybe use prt_newline(out) is better than prt_printf(out, "\n"); >>>> >>>>> --- 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. >>>> >>> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` 2024-04-17 9:49 ` Hongbo Li @ 2024-04-17 10:05 ` Kent Overstreet 0 siblings, 0 replies; 9+ messages in thread From: Kent Overstreet @ 2024-04-17 10:05 UTC (permalink / raw) To: Hongbo Li; +Cc: Youling Tang, linux-bcachefs, linux-kernel, Youling Tang On Wed, Apr 17, 2024 at 05:49:41PM +0800, Hongbo Li wrote: > > > On 2024/4/17 13:51, Youling Tang wrote: > > Hi, Kent & Hongbo > > On 17/04/2024 11:21, Hongbo Li wrote: > > > > > > > > > On 2024/4/17 11:16, Hongbo Li wrote: > > > > > > > > > > > > On 2024/4/17 10:59, Kent Overstreet wrote: > > > > > On Wed, Apr 17, 2024 at 10:50:10AM +0800, Youling Tang wrote: > > > > > > 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@kylinos.cn> > > > > > > > > > > > > > > > > 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) > > > > The flags also with the space after "=". Is it reseonable? > > > Sorry, I misspell. I mean whether it is reasonable. > > > > > > > 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); > 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-17 10:05 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-17 1:54 [PATCH] bcachefs: Align the display format of `btrees/inodes/keys` Youling Tang 2024-04-17 2:20 ` Kent Overstreet 2024-04-17 2:50 ` Youling Tang 2024-04-17 2:59 ` Kent Overstreet 2024-04-17 3:16 ` Hongbo Li 2024-04-17 3:21 ` Hongbo Li 2024-04-17 5:51 ` Youling Tang 2024-04-17 9:49 ` Hongbo Li 2024-04-17 10:05 ` Kent Overstreet
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.