linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8 PART2] btrfs-progs: add quiet option
@ 2020-06-08  6:38 Anand Jain
  2020-06-08  6:38 ` [PATCH 1/8] btrfs-progs: quota rescan: " Anand Jain
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

The part-1 patchset [1] 'btrfs-progs: global verbose and quiet option'
[1]
https://patchwork.kernel.org/project/linux-btrfs/list/?series=207709

provided a global structure to communicate the verbose and quiet options
down to the individual sub-commands where the actual printf happens.
So each of the sub-command could enable the verbose or quiet option as
needed.
But some of the sub-commands already had the verbose and quiet options
locally at the sub-command level. So the aim of part-1 of this series
was to merge the local verbose and quiet option with the global verbose
and quiet, which it did successfully.

In this series, part-2, adds the global quiet option to the found
chatty sub-commands. So each of the sub-commands outputs were 
individually checked and brought those logs under the global quiet
option. As this process is nondeterministic (unless like in part-1 where
sub-commands with -v or -q were checked) so there might have few logs
left behind and those can be fixed as moved along.

The whole series can be fetched from [2], which is based on latest devel
branch, last commit: c1d6d654a3f9 (btrfs-progs: docs: update balance).

[2]
https://github.com/asj/btrfs-progs.git verbose

Anand Jain (8):
  btrfs-progs: quota rescan: add quiet option
  btrfs-progs: subvolume create: add quiet option
  btrfs-progs: subvolume delete: add quiet option
  btrfs-progs: balance start: add quiet option
  btrfs-progs: balance resume: add quiet option
  btrfs-progs: subvolume snapshot: add quiet option
  btrfs-progs: scrub start|resume: use global quiet option
  btrfs-progs: scrub cancel: add quiet option

 cmds/balance.c   | 17 +++++++++++------
 cmds/quota.c     |  4 +++-
 cmds/scrub.c     | 25 +++++++++++++++----------
 cmds/subvolume.c | 24 +++++++++++++++---------
 4 files changed, 44 insertions(+), 26 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/8] btrfs-progs: quota rescan: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-10  8:30   ` David Sterba
  2020-06-08  6:38 ` [PATCH 2/8] btrfs-progs: subvolume create: " Anand Jain
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) quota rescan command.
Does the job quietly. For example:
  btrfs --quiet quota rescan

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

diff --git a/cmds/quota.c b/cmds/quota.c
index 075fc79816ad..4a68f9db081b 100644
--- a/cmds/quota.c
+++ b/cmds/quota.c
@@ -108,6 +108,8 @@ static const char * const cmd_quota_rescan_usage[] = {
 	"",
 	"-s   show status of a running rescan operation",
 	"-w   wait for rescan operation to finish (can be already in progress)",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
@@ -172,7 +174,7 @@ static int cmd_quota_rescan(const struct cmd_struct *cmd, int argc, char **argv)
 	}
 
 	if (ret == 0) {
-		printf("quota rescan started\n");
+		pr_verbose(-1, "quota rescan started\n");
 		fflush(stdout);
 	} else if (ret < 0 && (!wait_for_completion || e != EINPROGRESS)) {
 		error("quota rescan failed: %m");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/8] btrfs-progs: subvolume create: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
  2020-06-08  6:38 ` [PATCH 1/8] btrfs-progs: quota rescan: " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-08  6:38 ` [PATCH 3/8] btrfs-progs: subvolume delete: " Anand Jain
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) subvolume create command.
Does the job quietly. For example:
   btrfs --quiet subvolume create <path>

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

diff --git a/cmds/subvolume.c b/cmds/subvolume.c
index 279c75d0669a..ed3a3ab48ec7 100644
--- a/cmds/subvolume.c
+++ b/cmds/subvolume.c
@@ -88,6 +88,8 @@ static const char * const cmd_subvol_create_usage[] = {
 	"",
 	"-i <qgroupid>  add the newly created subvolume to a qgroup. This",
 	"               option can be given multiple times.",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
@@ -169,7 +171,7 @@ static int cmd_subvol_create(const struct cmd_struct *cmd,
 	if (fddst < 0)
 		goto out;
 
-	printf("Create subvolume '%s/%s'\n", dstdir, newname);
+	pr_verbose(-1, "Create subvolume '%s/%s'\n", dstdir, newname);
 	if (inherit) {
 		struct btrfs_ioctl_vol_args_v2	args;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/8] btrfs-progs: subvolume delete: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
  2020-06-08  6:38 ` [PATCH 1/8] btrfs-progs: quota rescan: " Anand Jain
  2020-06-08  6:38 ` [PATCH 2/8] btrfs-progs: subvolume create: " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-08  6:38 ` [PATCH 4/8] btrfs-progs: balance start: " Anand Jain
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) subvolume delete command.
Does the job quietly. For example:
	btrfs --quiet subvolume delete <path>

Also, fix a line with over 80 char with proper indentation.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/subvolume.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmds/subvolume.c b/cmds/subvolume.c
index ed3a3ab48ec7..9c8fe35a2aae 100644
--- a/cmds/subvolume.c
+++ b/cmds/subvolume.c
@@ -359,14 +359,14 @@ again:
 		goto out;
 	}
 
-	printf("Delete subvolume (%s): ",
-		commit_mode == COMMIT_EACH || (commit_mode == COMMIT_AFTER && cnt + 1 == argc)
+	pr_verbose(-1, "Delete subvolume (%s): ",
+commit_mode == COMMIT_EACH || (commit_mode == COMMIT_AFTER && cnt + 1 == argc)
 		? "commit" : "no-commit");
 
 	if (subvolid == 0)
-		printf("'%s/%s'\n", dname, vname);
+		pr_verbose(-1, "'%s/%s'\n", dname, vname);
 	else
-		printf("'%s'\n", full_subvolpath);
+		pr_verbose(-1, "'%s'\n", full_subvolpath);
 
 	if (subvolid == 0)
 		err = btrfs_util_delete_subvolume_fd(fd, vname, 0);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/8] btrfs-progs: balance start: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
                   ` (2 preceding siblings ...)
  2020-06-08  6:38 ` [PATCH 3/8] btrfs-progs: subvolume delete: " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-08  6:38 ` [PATCH 5/8] btrfs-progs: balance resume: " Anand Jain
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) balance start command.
Does the job quietly. For example:
	btrfs -q balance start --full-balance <path>

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

diff --git a/cmds/balance.c b/cmds/balance.c
index b35d90dc362a..154f54c3e3a6 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -470,9 +470,10 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
 	} else if (ret > 0) {
 		error("balance: %s", btrfs_err_str(ret));
 	} else {
-		printf("Done, had to relocate %llu out of %llu chunks\n",
-		       (unsigned long long)args->stat.completed,
-		       (unsigned long long)args->stat.considered);
+		pr_verbose(-1,
+			   "Done, had to relocate %llu out of %llu chunks\n",
+			   (unsigned long long)args->stat.completed,
+			   (unsigned long long)args->stat.considered);
 	}
 
 out:
@@ -501,6 +502,7 @@ static const char * const cmd_balance_start_usage[] = {
 	"               run the balance as a background process",
 	HELPINFO_INSERT_GLOBALS,
 	HELPINFO_INSERT_VERBOSE,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/8] btrfs-progs: balance resume: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
                   ` (3 preceding siblings ...)
  2020-06-08  6:38 ` [PATCH 4/8] btrfs-progs: balance start: " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-08  6:38 ` [PATCH 6/8] btrfs-progs: subvolume snapshot: " Anand Jain
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) balance resume command.
Does the job quietly. For example:
	btrfs -q balance resume <path>

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

diff --git a/cmds/balance.c b/cmds/balance.c
index 154f54c3e3a6..cf22aa13533b 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -769,6 +769,8 @@ static DEFINE_SIMPLE_COMMAND(balance_cancel, "cancel");
 static const char * const cmd_balance_resume_usage[] = {
 	"btrfs balance resume <path>",
 	"Resume interrupted balance",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
@@ -817,9 +819,10 @@ static int cmd_balance_resume(const struct cmd_struct *cmd,
 			ret = 1;
 		}
 	} else {
-		printf("Done, had to relocate %llu out of %llu chunks\n",
-		       (unsigned long long)args.stat.completed,
-		       (unsigned long long)args.stat.considered);
+		pr_verbose(-1,
+			   "Done, had to relocate %llu out of %llu chunks\n",
+			   (unsigned long long)args.stat.completed,
+			   (unsigned long long)args.stat.considered);
 	}
 
 	close_file_or_dir(fd, dirstream);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/8] btrfs-progs: subvolume snapshot: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
                   ` (4 preceding siblings ...)
  2020-06-08  6:38 ` [PATCH 5/8] btrfs-progs: balance resume: " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-08  6:38 ` [PATCH 7/8] btrfs-progs: scrub start|resume: use global " Anand Jain
  2020-06-08  6:38 ` [PATCH 8/8] btrfs-progs: scrub cancel: add " Anand Jain
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) subvolume snapshot command.
Does the job quietly. For example:
	btrfs -q subvolume snapshot <src> <dest>

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/subvolume.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/cmds/subvolume.c b/cmds/subvolume.c
index 9c8fe35a2aae..dbfa40d1549a 100644
--- a/cmds/subvolume.c
+++ b/cmds/subvolume.c
@@ -669,6 +669,8 @@ static const char * const cmd_subvol_snapshot_usage[] = {
 	"-r             create a readonly snapshot",
 	"-i <qgroupid>  add the newly created snapshot to a qgroup. This",
 	"               option can be given multiple times.",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
@@ -783,11 +785,13 @@ static int cmd_subvol_snapshot(const struct cmd_struct *cmd,
 
 	if (readonly) {
 		args.flags |= BTRFS_SUBVOL_RDONLY;
-		printf("Create a readonly snapshot of '%s' in '%s/%s'\n",
-		       subvol, dstdir, newname);
+		pr_verbose(-1,
+			   "Create a readonly snapshot of '%s' in '%s/%s'\n",
+			   subvol, dstdir, newname);
 	} else {
-		printf("Create a snapshot of '%s' in '%s/%s'\n",
-		       subvol, dstdir, newname);
+		pr_verbose(-1,
+			   "Create a snapshot of '%s' in '%s/%s'\n",
+			   subvol, dstdir, newname);
 	}
 
 	args.fd = fd;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/8] btrfs-progs: scrub start|resume: use global quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
                   ` (5 preceding siblings ...)
  2020-06-08  6:38 ` [PATCH 6/8] btrfs-progs: subvolume snapshot: " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  2020-06-08  6:38 ` [PATCH 8/8] btrfs-progs: scrub cancel: add " Anand Jain
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Transpire global --quiet option down to the btrfs scrub start|resume
sub-command.

Now either/both of the following quiet options work.
	btrfs -q scrub start <path>
and
	btrfs scrub start -q <path>

	btrfs -q scrub resume <path>
and
	btrfs scrub resume -q <path>

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/scrub.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/cmds/scrub.c b/cmds/scrub.c
index 9fe598222f0f..e3b6427b47ae 100644
--- a/cmds/scrub.c
+++ b/cmds/scrub.c
@@ -1141,7 +1141,7 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
 	int do_background = 1;
 	int do_wait = 0;
 	int do_print = 0;
-	int do_quiet = 0;
+	int do_quiet = !bconf.verbose; /*Read the global quiet option if set*/
 	int do_record = 1;
 	int readonly = 0;
 	int do_stats_per_dev = 0;
@@ -1184,7 +1184,8 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
 			do_stats_per_dev = 1;
 			break;
 		case 'q':
-			do_quiet = 1;
+			bconf_be_quiet();
+			do_quiet = !bconf.verbose;
 			break;
 		case 'r':
 			readonly = 1;
@@ -1330,9 +1331,8 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
 	}
 
 	if (!n_start && !n_resume) {
-		if (!do_quiet)
-			printf("scrub: nothing to resume for %s, fsid %s\n",
-			       path, fsid);
+		pr_verbose(-1, "scrub: nothing to resume for %s, fsid %s\n",
+			   path, fsid);
 		nothing_to_resume = 1;
 		goto out;
 	}
@@ -1403,10 +1403,9 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
 		if (pid) {
 			int stat;
 			scrub_handle_sigint_parent();
-			if (!do_quiet)
-				printf("scrub %s on %s, fsid %s (pid=%d)\n",
-				       n_start ? "started" : "resumed",
-				       path, fsid, pid);
+			pr_verbose(-1, "scrub %s on %s, fsid %s (pid=%d)\n",
+				   n_start ? "started" : "resumed",
+				   path, fsid, pid);
 			if (!do_wait) {
 				err = 0;
 				goto out;
@@ -1611,6 +1610,8 @@ static const char * const cmd_scrub_start_usage[] = {
 	"-n     set ioprio classdata (see ionice(1) manpage)",
 	"-f     force starting new scrub even if a scrub is already running",
 	"       this is useful when scrub stats record file is damaged",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
@@ -1678,6 +1679,8 @@ static const char * const cmd_scrub_resume_usage[] = {
 	"-R     raw print mode, print full data instead of summary",
 	"-c     set ioprio class (see ionice(1) manpage)",
 	"-n     set ioprio classdata (see ionice(1) manpage)",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/8] btrfs-progs: scrub cancel: add quiet option
  2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
                   ` (6 preceding siblings ...)
  2020-06-08  6:38 ` [PATCH 7/8] btrfs-progs: scrub start|resume: use global " Anand Jain
@ 2020-06-08  6:38 ` Anand Jain
  7 siblings, 0 replies; 12+ messages in thread
From: Anand Jain @ 2020-06-08  6:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Enable the quiet option to the btrfs(8) scrub cancel command.
Does the job quietly. For example:
	btrfs -q scrub cancel <mnt>

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

diff --git a/cmds/scrub.c b/cmds/scrub.c
index e3b6427b47ae..3256f20121ae 100644
--- a/cmds/scrub.c
+++ b/cmds/scrub.c
@@ -1624,6 +1624,8 @@ static DEFINE_SIMPLE_COMMAND(scrub_start, "start");
 static const char * const cmd_scrub_cancel_usage[] = {
 	"btrfs scrub cancel <path>|<device>",
 	"Cancel a running scrub",
+	HELPINFO_INSERT_GLOBALS,
+	HELPINFO_INSERT_QUIET,
 	NULL
 };
 
@@ -1660,7 +1662,7 @@ static int cmd_scrub_cancel(const struct cmd_struct *cmd, int argc, char **argv)
 	}
 
 	ret = 0;
-	printf("scrub cancelled\n");
+	pr_verbose(-1, "scrub cancelled\n");
 
 out:
 	close_file_or_dir(fdmnt, dirstream);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/8] btrfs-progs: quota rescan: add quiet option
  2020-06-08  6:38 ` [PATCH 1/8] btrfs-progs: quota rescan: " Anand Jain
@ 2020-06-10  8:30   ` David Sterba
  2020-06-11 13:16     ` Anand Jain
  0 siblings, 1 reply; 12+ messages in thread
From: David Sterba @ 2020-06-10  8:30 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

On Mon, Jun 08, 2020 at 02:38:44PM +0800, Anand Jain wrote:
> Enable the quiet option to the btrfs(8) quota rescan command.
> Does the job quietly. For example:
>   btrfs --quiet quota rescan
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  cmds/quota.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/cmds/quota.c b/cmds/quota.c
> index 075fc79816ad..4a68f9db081b 100644
> --- a/cmds/quota.c
> +++ b/cmds/quota.c
> @@ -108,6 +108,8 @@ static const char * const cmd_quota_rescan_usage[] = {
>  	"",
>  	"-s   show status of a running rescan operation",
>  	"-w   wait for rescan operation to finish (can be already in progress)",
> +	HELPINFO_INSERT_GLOBALS,
> +	HELPINFO_INSERT_QUIET,
>  	NULL
>  };
>  
> @@ -172,7 +174,7 @@ static int cmd_quota_rescan(const struct cmd_struct *cmd, int argc, char **argv)
>  	}
>  
>  	if (ret == 0) {
> -		printf("quota rescan started\n");
> +		pr_verbose(-1, "quota rescan started\n");

That the raw value -1 is used here is not nice, I assume it means print
unless there was another setting of the verbosity (nothing if -q,
otherwise yes).

>  		fflush(stdout);
>  	} else if (ret < 0 && (!wait_for_completion || e != EINPROGRESS)) {
>  		error("quota rescan failed: %m");
> -- 
> 2.25.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/8] btrfs-progs: quota rescan: add quiet option
  2020-06-10  8:30   ` David Sterba
@ 2020-06-11 13:16     ` Anand Jain
  2020-06-11 14:10       ` David Sterba
  0 siblings, 1 reply; 12+ messages in thread
From: Anand Jain @ 2020-06-11 13:16 UTC (permalink / raw)
  To: dsterba, linux-btrfs

On 10/6/20 4:30 pm, David Sterba wrote:
> On Mon, Jun 08, 2020 at 02:38:44PM +0800, Anand Jain wrote:
>> Enable the quiet option to the btrfs(8) quota rescan command.
>> Does the job quietly. For example:
>>    btrfs --quiet quota rescan
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   cmds/quota.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmds/quota.c b/cmds/quota.c
>> index 075fc79816ad..4a68f9db081b 100644
>> --- a/cmds/quota.c
>> +++ b/cmds/quota.c
>> @@ -108,6 +108,8 @@ static const char * const cmd_quota_rescan_usage[] = {
>>   	"",
>>   	"-s   show status of a running rescan operation",
>>   	"-w   wait for rescan operation to finish (can be already in progress)",
>> +	HELPINFO_INSERT_GLOBALS,
>> +	HELPINFO_INSERT_QUIET,
>>   	NULL
>>   };
>>   
>> @@ -172,7 +174,7 @@ static int cmd_quota_rescan(const struct cmd_struct *cmd, int argc, char **argv)
>>   	}
>>   
>>   	if (ret == 0) {
>> -		printf("quota rescan started\n");
>> +		pr_verbose(-1, "quota rescan started\n");
> 
> That the raw value -1 is used here is not nice, I assume it means print
> unless there was another setting of the verbosity (nothing if -q,
> otherwise yes).

  Yes that's right. In v3 I have defined -1 as

  #define MUST_LOG  -1

  I ran out of ideas to name it more sensibly, open to suggestions.


> 
>>   		fflush(stdout);
>>   	} else if (ret < 0 && (!wait_for_completion || e != EINPROGRESS)) {
>>   		error("quota rescan failed: %m");
>> -- 
>> 2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/8] btrfs-progs: quota rescan: add quiet option
  2020-06-11 13:16     ` Anand Jain
@ 2020-06-11 14:10       ` David Sterba
  0 siblings, 0 replies; 12+ messages in thread
From: David Sterba @ 2020-06-11 14:10 UTC (permalink / raw)
  To: Anand Jain; +Cc: dsterba, linux-btrfs

On Thu, Jun 11, 2020 at 09:16:37PM +0800, Anand Jain wrote:
> On 10/6/20 4:30 pm, David Sterba wrote:
> > On Mon, Jun 08, 2020 at 02:38:44PM +0800, Anand Jain wrote:
> >> Enable the quiet option to the btrfs(8) quota rescan command.
> >> Does the job quietly. For example:
> >>    btrfs --quiet quota rescan
> >>
> >> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> >> ---
> >>   cmds/quota.c | 4 +++-
> >>   1 file changed, 3 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/cmds/quota.c b/cmds/quota.c
> >> index 075fc79816ad..4a68f9db081b 100644
> >> --- a/cmds/quota.c
> >> +++ b/cmds/quota.c
> >> @@ -108,6 +108,8 @@ static const char * const cmd_quota_rescan_usage[] = {
> >>   	"",
> >>   	"-s   show status of a running rescan operation",
> >>   	"-w   wait for rescan operation to finish (can be already in progress)",
> >> +	HELPINFO_INSERT_GLOBALS,
> >> +	HELPINFO_INSERT_QUIET,
> >>   	NULL
> >>   };
> >>   
> >> @@ -172,7 +174,7 @@ static int cmd_quota_rescan(const struct cmd_struct *cmd, int argc, char **argv)
> >>   	}
> >>   
> >>   	if (ret == 0) {
> >> -		printf("quota rescan started\n");
> >> +		pr_verbose(-1, "quota rescan started\n");
> > 
> > That the raw value -1 is used here is not nice, I assume it means print
> > unless there was another setting of the verbosity (nothing if -q,
> > otherwise yes).
> 
>   Yes that's right. In v3 I have defined -1 as
> 
>   #define MUST_LOG  -1
> 
>   I ran out of ideas to name it more sensibly, open to suggestions.

Ok, sounds reasonable to me. It can be documented and used only for the
messages that must be printed due to backward compatibility.

I have merged the first part to devel, so please send this patchset once
you have it ready.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-06-11 14:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08  6:38 [PATCH 0/8 PART2] btrfs-progs: add quiet option Anand Jain
2020-06-08  6:38 ` [PATCH 1/8] btrfs-progs: quota rescan: " Anand Jain
2020-06-10  8:30   ` David Sterba
2020-06-11 13:16     ` Anand Jain
2020-06-11 14:10       ` David Sterba
2020-06-08  6:38 ` [PATCH 2/8] btrfs-progs: subvolume create: " Anand Jain
2020-06-08  6:38 ` [PATCH 3/8] btrfs-progs: subvolume delete: " Anand Jain
2020-06-08  6:38 ` [PATCH 4/8] btrfs-progs: balance start: " Anand Jain
2020-06-08  6:38 ` [PATCH 5/8] btrfs-progs: balance resume: " Anand Jain
2020-06-08  6:38 ` [PATCH 6/8] btrfs-progs: subvolume snapshot: " Anand Jain
2020-06-08  6:38 ` [PATCH 7/8] btrfs-progs: scrub start|resume: use global " Anand Jain
2020-06-08  6:38 ` [PATCH 8/8] btrfs-progs: scrub cancel: add " Anand Jain

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).