Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Su Yue <damenly.su@gmail.com>
Cc: dsterba@suse.cz, Sidong Yang <realwakka@gmail.com>,
	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:18:48 +0100	[thread overview]
Message-ID: <20201216171848.GH6430@twin.jikos.cz> (raw)
In-Reply-To: <CABnRu57w3aw=jPBbpSNYfyRKxs1z7onwWzqjg+=r6jQjwNYUXw@mail.gmail.com>

On Wed, Dec 16, 2020 at 02:30:04PM +0800, Su Yue wrote:
> On Sat, Dec 12, 2020 at 3:04 AM David Sterba <dsterba@suse.cz> wrote:
> >
> > On Fri, Dec 11, 2020 at 06:30:25PM +0100, David Sterba wrote:
> > > On Fri, Dec 11, 2020 at 04:48:12PM +0000, Sidong Yang wrote:
> > > > Example json format:
> > > >
> > > > {
> > > >   "__header": {
> > > >     "version": "1"
> > > >   },
> > > >   "device-stats": [
> > > >     {
> > > >       "device": "/dev/vdb",
> > > >       "devid": "1",
> > > >       "write_io_errs": "0",
> > > >       "read_io_errs": "0",
> > > >       "flush_io_errs": "0",
> > > >       "corruption_errs": "0",
> > > >       "generation_errs": "0"
> > > >     }
> > > >   ],
> > >      ^
> > >
> > > I've verified that the comma is really there, it's not a valid json so
> > > there's a bug in the formatter. To verify that the output is valid you
> > > can use eg. 'jq', simply pipe the output of the commadn there.
> > >
> > >   $ ./btrfs --format json dev stats /mnt | jq
> > >   parse error: Expected another key-value pair at line 16, column 1
> >
> > I've pushed the updated plain text formatting to devel, so the only
> > remaining bug is the above extra comma.
> 
> Another format bug(one extra newline):
> ========================================
> ➜  btrfs-progs git:(314d96c8)  btrfs device stats /mnt
> [/dev/mapper/test-1].write_io_errs    0
> [/dev/mapper/test-1].read_io_errs     0
> [/dev/mapper/test-1].flush_io_errs    0
> [/dev/mapper/test-1].corruption_errs  0
> [/dev/mapper/test-1].generation_errs  0
> 
> ➜  btrfs-progs git:(314d96c8)
> ========================================
> The new line is printed by the change:
> '+       fmt_end(&fctx);'
> 
> and fstests/btrfs/006 fails:
> ================================================================================
> btrfs/006 1s ... - output mismatch (see
> /root/xfstests-dev/results//btrfs/006.out.bad)
>     --- tests/btrfs/006.out     2020-12-16 03:40:19.632039261 +0000
>     +++ /root/xfstests-dev/results//btrfs/006.out.bad   2020-12-16
> 06:25:56.424424113 +0000
>     @@ -15,12 +15,14 @@
> 
>      == Sync filesystem
>      == Show device stats by mountpoint
>     + 1
>      <NUMDEVS> [SCRATCH_DEV].corruption_errs <NUM>
>      <NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
>      <NUMDEVS> [SCRATCH_DEV].generation_errs <NUM>
>     ...
>     (Run 'diff -u /root/xfstests-dev/tests/btrfs/006.out
> /root/xfstests-dev/results//btrfs/006.out.bad'  to see the entire
> diff)
> Ran: btrfs/006
> Failures: btrfs/006
> Failed 1 of 1 tests
> ================================================================================
> 
> The new line made filter produce the '+1'.

I noticed the newline but did not think it would break fstests, so it
needs to be removed.

  parent reply	other threads:[~2020-12-16 17:21 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
2020-12-16 17:18         ` David Sterba [this message]
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=20201216171848.GH6430@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