From: David Sterba <dsterba@suse.cz>
To: Su Yue <damenly.su@gmail.com>
Cc: Sidong Yang <realwakka@gmail.com>,
dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 2/2] btrfs-progs: device stats: add json output format
Date: Wed, 16 Dec 2020 18:21:23 +0100 [thread overview]
Message-ID: <20201216172123.GI6430@twin.jikos.cz> (raw)
In-Reply-To: <CABnRu55J04cu2sbc_f4gR_bOw3_sSMvu1Bs-sGyFhJ=cCRdMuA@mail.gmail.com>
On Wed, Dec 16, 2020 at 08:52:08PM +0800, Su Yue wrote:
> > > The new line made filter produce the '+1'.
> >
> > Thanks for testing this patch.
> > I checked the fmt_end() and there is an additional newline.
> > I think that fmt_end() should be used for formatting. so it seems that
>
> Yes, it's for the purpose of formatting.
>
> > the only way to fix this problem is to remove the code that inserts a
> > newline in fmt_end(). I searched the code that use the function and
> > there is no code that used this function but this patch. Do you have any
> > ideas?
> >
> I'm OK about removing the "putchar('\n');". It's just a tiny format issue so no
> bother to do extra works.
The way the json formatting works the newline must be printed from
there. The problematic requirement is delayed insertion of the "," when
there are more objects on the same level. But we don't know that until
the next object is processed.
Mixing the textual and json output for the stats makes it a bit more
complicated as it prints the newline for each row unconditionally,
breaking the assumption of the formatter.
next prev parent reply other threads:[~2020-12-16 17:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 16:48 [PATCH v3 1/2] btrfs-progs: common: extend fmt_print_start_group handles unnamed group Sidong Yang
2020-12-11 16:48 ` [PATCH v3 2/2] btrfs-progs: device stats: add json output format Sidong Yang
2020-12-11 17:30 ` David Sterba
2020-12-11 17:46 ` David Sterba
2020-12-11 18:09 ` Sidong Yang
2020-12-16 17:23 ` David Sterba
2020-12-16 17:41 ` David Sterba
2020-12-16 6:30 ` Su Yue
2020-12-16 10:52 ` Sidong Yang
2020-12-16 12:52 ` Su Yue
2020-12-16 17:21 ` David Sterba [this message]
2020-12-16 17:18 ` David Sterba
2020-12-11 17:31 ` [PATCH v3 1/2] btrfs-progs: common: extend fmt_print_start_group handles unnamed group David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201216172123.GI6430@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=damenly.su@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=realwakka@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox