linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [RFC PATCH 1/3] btrfs-progs: send: let option quiet overrule verbose
Date: Thu, 24 Oct 2019 14:28:23 +0800	[thread overview]
Message-ID: <20191024062825.13097-2-anand.jain@oracle.com> (raw)
In-Reply-To: <20191024062825.13097-1-anand.jain@oracle.com>

btrfs send has both -q|--quiet and -v|--verbose options, now the test
here is, which option shall take the precedence if in case both of them
are specified.

Per current implementation it really depends on the order of the options
as shown below

Without fix:
---- btrfs send -q /btrfs/ss2 -f /tmp/t -----
---- btrfs send -q -v /btrfs/ss2 -f /tmp/t -----
At subvol /btrfs/ss2
---- btrfs send -q -vv /btrfs/ss2 -f /tmp/t -----
At subvol /btrfs/ss2
BTRFS_IOC_SEND returned 0
joining genl thread
---- btrfs send -v -q /btrfs/ss2 -f /tmp/t -----
---- btrfs send -vv -q /btrfs/ss2 -f /tmp/t -----
---- btrfs send -v -q -v /btrfs/ss2 -f /tmp/t -----
At subvol /btrfs/ss2

If the effectiveness of the output depends on the chronological order
of the options -q and -v specified in the command line, then its rather
confusing at times.

So fix it by making the option -q|--quiet to overrule the -v|--verbose
option if when both of them are specified.

So with the fix:
---- btrfs send -q /btrfs/ss2 -f /tmp/t -----
---- btrfs send -q -v /btrfs/ss2 -f /tmp/t -----
---- btrfs send -q -vv /btrfs/ss2 -f /tmp/t -----
---- btrfs send -v -q /btrfs/ss2 -f /tmp/t -----
---- btrfs send -vv -q /btrfs/ss2 -f /tmp/t -----
---- btrfs send -v -q -v /btrfs/ss2 -f /tmp/t -----

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/send.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmds/send.c b/cmds/send.c
index 7ce6c3273857..4bf2be7db4d0 100644
--- a/cmds/send.c
+++ b/cmds/send.c
@@ -477,6 +477,7 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv)
 	int full_send = 1;
 	int new_end_cmd_semantic = 0;
 	u64 send_flags = 0;
+	bool quiet = false;
 
 	memset(&send, 0, sizeof(send));
 	send.dump_fd = fileno(stdout);
@@ -500,7 +501,7 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv)
 			g_verbose++;
 			break;
 		case 'q':
-			g_verbose = 0;
+			quiet = true;
 			break;
 		case 'e':
 			new_end_cmd_semantic = 1;
@@ -584,6 +585,9 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv)
 	if (check_argc_min(argc - optind, 1))
 		return 1;
 
+	if (quiet)
+		g_verbose = 0;
+
 	if (outname[0]) {
 		int tmpfd;
 
-- 
2.23.0


  reply	other threads:[~2019-10-24  6:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24  6:28 [RFC PATCH 0/3] btrfs-progs: make quiet to overrule verbose Anand Jain
2019-10-24  6:28 ` Anand Jain [this message]
2019-10-24  6:28 ` [RFC PATCH 2/3] btrfs-progs: receive: let option quiet " Anand Jain
2019-10-24  6:28 ` [RFC PATCH 3/3] btrfs-progs: receive: make quiet really quiet Anand Jain
2019-10-24 15:41 ` [RFC PATCH 0/3] btrfs-progs: make quiet to overrule verbose David Sterba
2019-10-24 23:51   ` Anand Jain
2019-10-25  1:56     ` Anand Jain
2019-10-25 16:35       ` David Sterba
2019-10-26  1:01         ` Anand Jain
2019-10-29 19:42           ` Anand Jain
2019-11-01 15:18             ` David Sterba
2019-11-04  6:26               ` Anand Jain

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=20191024062825.13097-2-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --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).