linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Btrfs-progs: subvolume deletion commit mode update
@ 2014-12-10 15:06 David Sterba
  2014-12-10 15:06 ` [PATCH 1/3] btrfs-progs: let subvol delete print commit mode inline David Sterba
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Sterba @ 2014-12-10 15:06 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Minor change in the output of 'subvolume delete' command, the commit mode is
printed inline with the subvolume and the global message is moved under the
newly added 'verbose' option.

David Sterba (3):
  btrfs-progs: let subvol delete print commit mode inline
  btrfs-progs: subvol delete: add verbosity option
  btrfs-progs: subvol delete: rename variable to match the option name

 cmds-subvolume.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

-- 
2.1.3


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

* [PATCH 1/3] btrfs-progs: let subvol delete print commit mode inline
  2014-12-10 15:06 [PATCH 0/3] Btrfs-progs: subvolume deletion commit mode update David Sterba
@ 2014-12-10 15:06 ` David Sterba
  2014-12-10 15:06 ` [PATCH 2/3] btrfs-progs: subvol delete: add verbosity option David Sterba
  2014-12-10 15:06 ` [PATCH 3/3] btrfs-progs: subvol delete: rename variable to match the option name David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2014-12-10 15:06 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

There are options to specify if the subvolume deletion should wait for
commit after each subvol or at the end. This is reported at the
beginning and considered as a noise. We'd like to report the mode for
each subvolume instead.

http://www.mail-archive.com/linux-btrfs%40vger.kernel.org/msg34617.html

Reported-by: Marc MERLIN <marc@merlins.org
Signed-off-by: David Sterba <dsterba@suse.cz>
---
 cmds-subvolume.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 53eec467251d..4e452f4f4eb7 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -303,7 +303,9 @@ again:
 		goto out;
 	}
 
-	printf("Delete subvolume '%s/%s'\n", dname, vname);
+	printf("Delete subvolume (%s): '%s/%s'\n",
+		sync_mode == 2 || (sync_mode == 1 && cnt + 1 == argc)
+		? "commit" : "no-commit", dname, vname);
 	strncpy_null(args.name, vname);
 	res = ioctl(fd, BTRFS_IOC_SNAP_DESTROY, &args);
 	e = errno;
-- 
2.1.3


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

* [PATCH 2/3] btrfs-progs: subvol delete: add verbosity option
  2014-12-10 15:06 [PATCH 0/3] Btrfs-progs: subvolume deletion commit mode update David Sterba
  2014-12-10 15:06 ` [PATCH 1/3] btrfs-progs: let subvol delete print commit mode inline David Sterba
@ 2014-12-10 15:06 ` David Sterba
  2014-12-10 15:06 ` [PATCH 3/3] btrfs-progs: subvol delete: rename variable to match the option name David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2014-12-10 15:06 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Add an the option -v and use it for the transaction commit mode message.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 cmds-subvolume.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 4e452f4f4eb7..b14f86e06cb4 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -66,7 +66,7 @@ static int cmd_subvol_create(int argc, char **argv)
 
 	optind = 1;
 	while (1) {
-		int c = getopt(argc, argv, "c:i:");
+		int c = getopt(argc, argv, "c:i:v");
 		if (c < 0)
 			break;
 
@@ -217,6 +217,7 @@ static int cmd_subvol_delete(int argc, char **argv)
 	char	*dupvname = NULL;
 	char	*path;
 	DIR	*dirstream = NULL;
+	int verbose = 0;
 	int sync_mode = 0;
 	struct option long_options[] = {
 		{"commit-after", no_argument, NULL, 'c'},  /* sync mode 1 */
@@ -239,6 +240,9 @@ static int cmd_subvol_delete(int argc, char **argv)
 		case 'C':
 			sync_mode = 2;
 			break;
+		case 'v':
+			verbose++;
+			break;
 		default:
 			usage(cmd_subvol_delete_usage);
 		}
@@ -247,9 +251,11 @@ static int cmd_subvol_delete(int argc, char **argv)
 	if (check_argc_min(argc - optind, 1))
 		usage(cmd_subvol_delete_usage);
 
-	printf("Transaction commit: %s\n",
-		!sync_mode ? "none (default)" :
-		sync_mode == 1 ? "at the end" : "after each");
+	if (verbose > 0) {
+		printf("Transaction commit: %s\n",
+			!sync_mode ? "none (default)" :
+			sync_mode == 1 ? "at the end" : "after each");
+	}
 
 	cnt = optind;
 
-- 
2.1.3


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

* [PATCH 3/3] btrfs-progs: subvol delete: rename variable to match the option name
  2014-12-10 15:06 [PATCH 0/3] Btrfs-progs: subvolume deletion commit mode update David Sterba
  2014-12-10 15:06 ` [PATCH 1/3] btrfs-progs: let subvol delete print commit mode inline David Sterba
  2014-12-10 15:06 ` [PATCH 2/3] btrfs-progs: subvol delete: add verbosity option David Sterba
@ 2014-12-10 15:06 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2014-12-10 15:06 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 cmds-subvolume.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index b14f86e06cb4..15d4b975a916 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -218,10 +218,10 @@ static int cmd_subvol_delete(int argc, char **argv)
 	char	*path;
 	DIR	*dirstream = NULL;
 	int verbose = 0;
-	int sync_mode = 0;
+	int commit_mode = 0;
 	struct option long_options[] = {
-		{"commit-after", no_argument, NULL, 'c'},  /* sync mode 1 */
-		{"commit-each", no_argument, NULL, 'C'},  /* sync mode 2 */
+		{"commit-after", no_argument, NULL, 'c'},  /* commit mode 1 */
+		{"commit-each", no_argument, NULL, 'C'},  /* commit mode 2 */
 		{NULL, 0, NULL, 0}
 	};
 
@@ -235,10 +235,10 @@ static int cmd_subvol_delete(int argc, char **argv)
 
 		switch(c) {
 		case 'c':
-			sync_mode = 1;
+			commit_mode = 1;
 			break;
 		case 'C':
-			sync_mode = 2;
+			commit_mode = 2;
 			break;
 		case 'v':
 			verbose++;
@@ -253,8 +253,8 @@ static int cmd_subvol_delete(int argc, char **argv)
 
 	if (verbose > 0) {
 		printf("Transaction commit: %s\n",
-			!sync_mode ? "none (default)" :
-			sync_mode == 1 ? "at the end" : "after each");
+			!commit_mode ? "none (default)" :
+			commit_mode == 1 ? "at the end" : "after each");
 	}
 
 	cnt = optind;
@@ -310,7 +310,7 @@ again:
 	}
 
 	printf("Delete subvolume (%s): '%s/%s'\n",
-		sync_mode == 2 || (sync_mode == 1 && cnt + 1 == argc)
+		commit_mode == 2 || (commit_mode == 1 && cnt + 1 == argc)
 		? "commit" : "no-commit", dname, vname);
 	strncpy_null(args.name, vname);
 	res = ioctl(fd, BTRFS_IOC_SNAP_DESTROY, &args);
@@ -323,7 +323,7 @@ again:
 		goto out;
 	}
 
-	if (sync_mode == 1) {
+	if (commit_mode == 1) {
 		res = wait_for_commit(fd);
 		if (res < 0) {
 			fprintf(stderr,
@@ -347,7 +347,7 @@ out:
 		goto again;
 	}
 
-	if (sync_mode == 2 && fd != -1) {
+	if (commit_mode == 2 && fd != -1) {
 		res = wait_for_commit(fd);
 		if (res < 0) {
 			fprintf(stderr,
-- 
2.1.3


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

end of thread, other threads:[~2014-12-10 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 15:06 [PATCH 0/3] Btrfs-progs: subvolume deletion commit mode update David Sterba
2014-12-10 15:06 ` [PATCH 1/3] btrfs-progs: let subvol delete print commit mode inline David Sterba
2014-12-10 15:06 ` [PATCH 2/3] btrfs-progs: subvol delete: add verbosity option David Sterba
2014-12-10 15:06 ` [PATCH 3/3] btrfs-progs: subvol delete: rename variable to match the option name David Sterba

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