linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Steven Davies <btrfs@steev.me.uk>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [RFC PATCH] btrfs-progs: Quiet mode for btrfs-receive
Date: Tue, 5 Mar 2019 13:41:57 +0100	[thread overview]
Message-ID: <20190305124157.GW31119@twin.jikos.cz> (raw)
In-Reply-To: <7573fc8cc0e99d8815f1616d9503c2b6@steev.me.uk>

On Wed, Feb 20, 2019 at 09:16:04AM +0000, Steven Davies wrote:
> Provide an option in `btrfs receive` to suppress the informational
> messages when writing files.

Thank, looks ok to me, the 'receive' command already has the verbosity
option so it makes sense to have both.

> Signed-off-by: Steven Davies <btrfs@steev.me.uk>
> ---
>   cmds-receive.c | 67 ++++++++++++++++++++++++++++++--------------------
>   1 file changed, 40 insertions(+), 27 deletions(-)
> 
> diff --git a/cmds-receive.c b/cmds-receive.c
> index 3888149a..96411bac 100644
> --- a/cmds-receive.c
> +++ b/cmds-receive.c
> @@ -52,7 +52,11 @@
>   #include "send-dump.h"
>   #include "help.h"
> 
> -static int g_verbose = 0;
> +/*
> + * Default is 1 for historical reasons, changing may break scripts that 
> expect
> + * the 'At subvol' message.
> + */
> +static int g_verbose = 1;
> 
>   struct btrfs_receive
>   {
> @@ -194,12 +198,14 @@ static int process_subvol(const char *path, const 
> u8 *uuid, u64 ctransid,
>                  goto out;
>          }
> 
> -       fprintf(stderr, "At subvol %s\n", path);
> +       if (g_verbose) {
> +               fprintf(stdout, "At subvol %s\n", path);
> +       }

This changes stderr to stdout.

> 
>          memcpy(rctx->cur_subvol.received_uuid, uuid, BTRFS_UUID_SIZE);
>          rctx->cur_subvol.stransid = ctransid;
> 
> -       if (g_verbose) {
> +       if (g_verbose >= 2) {
>                  uuid_unparse((u8*)rctx->cur_subvol.received_uuid, 
> uuid_str);
>                  fprintf(stderr, "receiving subvol %s uuid=%s, 
> stransid=%llu\n",
>                                  path, uuid_str,
> @@ -263,12 +269,14 @@ static int process_snapshot(const char *path, 
> const u8 *uuid, u64 ctransid,
>                  goto out;
>          }
> 
> -       fprintf(stdout, "At snapshot %s\n", path);
> +       if (g_verbose) {
> +               fprintf(stderr, "At snapshot %s\n", path);

And this stdout -> stderr.

That's inconsistent in the original code too, that may need some care to
fix. The stderr is used for all the verbosity levels and it's been like
that since the beginning. I doubt that it has a good reason and that
everybody does 'btrfs receive 2>&1' anyway, but we can never be sure
with that.

So for sake of backward compatibility I'll fix it to keep using the same
output streams and add to devel. Thanks.

      reply	other threads:[~2019-03-05 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20  9:16 [RFC PATCH] btrfs-progs: Quiet mode for btrfs-receive Steven Davies
2019-03-05 12:41 ` David Sterba [this message]

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=20190305124157.GW31119@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=btrfs@steev.me.uk \
    --cc=linux-btrfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).