linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Lass <bevan@bi-co.net>
To: linux-btrfs@vger.kernel.org
Cc: Michael Lass <bevan@bi-co.net>
Subject: [PATCH] btrfs-progs: qgroup: allow passing options to qgroup remove
Date: Sun,  2 Feb 2020 15:45:42 +0100	[thread overview]
Message-ID: <20200202144542.98625-1-bevan@bi-co.net> (raw)

According to the documentation, btrfs qgroup remove takes the same
options as qgroup assign, i.e., --rescan and --no-rescan. However,
currently no options are accepted. Activate option handling also for
qgroup remove, so that automatic rescan can be disabled by the user.

Signed-off-by: Michael Lass <bevan@bi-co.net>
---
 cmds/qgroup.c | 55 +++++++++++++++++++++++++--------------------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/cmds/qgroup.c b/cmds/qgroup.c
index 6bfb4949..fef3374d 100644
--- a/cmds/qgroup.c
+++ b/cmds/qgroup.c
@@ -45,34 +45,30 @@ static int _cmd_qgroup_assign(const struct cmd_struct *cmd, int assign,
 	struct btrfs_ioctl_qgroup_assign_args args;
 	DIR *dirstream = NULL;
 
-	if (assign) {
-		optind = 0;
-		while (1) {
-			enum { GETOPT_VAL_RESCAN = 256, GETOPT_VAL_NO_RESCAN };
-			static const struct option long_options[] = {
-				{ "rescan", no_argument, NULL,
-					GETOPT_VAL_RESCAN },
-				{ "no-rescan", no_argument, NULL,
-					GETOPT_VAL_NO_RESCAN },
-				{ NULL, 0, NULL, 0 }
-			};
-			int c = getopt_long(argc, argv, "", long_options, NULL);
-
-			if (c < 0)
-				break;
-			switch (c) {
-			case GETOPT_VAL_RESCAN:
-				rescan = true;
-				break;
-			case GETOPT_VAL_NO_RESCAN:
-				rescan = false;
-				break;
-			default:
-				usage_unknown_option(cmd, argv);
-			}
+	optind = 0;
+	while (1) {
+		enum { GETOPT_VAL_RESCAN = 256, GETOPT_VAL_NO_RESCAN };
+		static const struct option long_options[] = {
+			{ "rescan", no_argument, NULL,
+				GETOPT_VAL_RESCAN },
+			{ "no-rescan", no_argument, NULL,
+				GETOPT_VAL_NO_RESCAN },
+			{ NULL, 0, NULL, 0 }
+		};
+		int c = getopt_long(argc, argv, "", long_options, NULL);
+
+		if (c < 0)
+			break;
+		switch (c) {
+		case GETOPT_VAL_RESCAN:
+			rescan = true;
+			break;
+		case GETOPT_VAL_NO_RESCAN:
+			rescan = false;
+			break;
+		default:
+			usage_unknown_option(cmd, argv);
 		}
-	} else {
-		clean_args_no_options(cmd, argc, argv);
 	}
 
 	if (check_argc_exact(argc - optind, 3))
@@ -180,8 +176,11 @@ static int cmd_qgroup_assign(const struct cmd_struct *cmd,
 static DEFINE_SIMPLE_COMMAND(qgroup_assign, "assign");
 
 static const char * const cmd_qgroup_remove_usage[] = {
-	"btrfs qgroup remove <src> <dst> <path>",
+	"btrfs qgroup remove [options] <src> <dst> <path>",
 	"Remove a child qgroup SRC from DST.",
+	"",
+	"--rescan       schedule qutoa rescan if needed",
+	"--no-rescan    don't schedule quota rescan",
 	NULL
 };
 
-- 
2.25.0


             reply	other threads:[~2020-02-02 14:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-02 14:45 Michael Lass [this message]
2020-03-04 14:36 ` [PATCH] btrfs-progs: qgroup: allow passing options to qgroup remove 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=20200202144542.98625-1-bevan@bi-co.net \
    --to=bevan@bi-co.net \
    --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).