Skip to contentSkip to conversation

enhance btrfs qgroup show command

PATCH In review Miao Xie 5 participants 18 messages Dec 6, 2012 – Sep 24, 2013 1 message not in the archive Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

cover enhance btrfs qgroup show command

The patchset enhanced btrfs qgroup show command.

Firstly, we restructure show_qgroups, make it easy to add new features.

And then we add '-p' '-c', '-l',and '-e' options to print the parent qgroup id, child qgroup id, max referenced size and max exclusive size of qgroup respectively, add '-F' and '-f' option to list qgroups that impact the given path.

Besides that, the users may want to sort qgroups according to some items. For this case, we introduce '--sort' option. With this option, we can sort the qgroup by qgroupid, rfer, excl, max_rfer and max_excl.

And finally, Since there are so many columns can be output, the users may be confused about the output result, so i add '-t' option to print the result as a table.

We can pull this patchset from the URL

git://github.com/miaoxie/btrfs-progs.git qgroup

Thanks
Miao
---
Wang Shilong (9):
Btrfs-progs: restructure show_qgroups
Btrfs-progs: introduces '-p' option to print the ID of the parent qgroups
Btrfs-progs: introduces '-c' option to print the ID of the child qgroups
Btrfs-progs: introduce '-l' option to print max referenced size of qgroups
Btrfs-progs: introduce '-e' option to print max exclusive size of qgroups
Btrfs-progs: list all qgroups impact given path(include ancestral qgroups)
Btrfs-progs: list all qgroups impact given path(exclude ancestral qgroups)
Btrfs-progs: enhance btrfs qgroup show to sort qgroups
Btrfs-progs: enhance btrfs qgroup to print the result as a table

 cmds-qgroup.c |  198 +++++-----
 ctree.h       |   11 +
 qgroup.c      | 1216 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 qgroup.h      |   71 ++++
 4 files changed, 1396 insertions(+), 100 deletions(-)
author
#1 lore raw

PATCH 1/9 Btrfs-progs: restructure show_qgroups

From: Wang Shilong <[email protected]>

The current show_qgroups() just shows a little information, and it is hard to add some functions which the users need in the future, so i restructure it, make it easy to add new functions.

In order to improve the scalability of show_qgroups(), i add some important structures:

	struct qgroup_lookup {
		struct rb_root root;
	}
 	/*
	*store qgroup's information
	*/
	struct btrfs_qgroup {
		struct rb_node  rb_node;
		u64 qgroupid;

		u64 generation;
		u64 rfer;
		u64 rfer_cmpr;
		u64 excl_cmpr;

		u64 flags;
		u64 max_rfer;
		u64 max_excl;
		u64 rsv_rfer;
		u64 rsv_excl;

		struct list_head qgroups;
		struct list_head members;
	}
	/*
	*glue structure to represent the relations
	*between qgroups
	*/
	struct btrfs_qgroup_list {
		struct list_head next_qgroups;
		struct list_head next_member;
		struct btrfs_qgroup *qgroup;
		struct btrfs_qgroup *member;
	}

The above 3 structures are used to manage all the information of qgroups.

	struct {
		char *name;
		char *column_name;
		int need_print;
	} btrfs_qgroup_columns[]

We define a arrary to manage all the columns that can be outputed, and use a member variant(->need_print) to control the output of the relative column. Some columns are outputed by default. But we can change it according to the requirement of the users.

For example:
if outputing max referenced size of qgroup is needed,the function
'btrfs_qgroup_setup_column()' will be called, and the parameter 'BTRFS_QGROUP_MAX_RFER' (extend in the future) will be passsed to the function. After the function is done, when showing qgroups, max referenced size of qgroup will be output.

---
 cmds-qgroup.c |  96 +----------
 ctree.h       |  11 ++
 qgroup.c      | 509 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 qgroup.h      |   9 ++
 4 files changed, 530 insertions(+), 95 deletions(-)
cmds-qgroup.c +1 -95
index 70019d0..2d5b59b 100644
@@ -103,100 +103,6 @@ static int qgroup_create(int create, int argc, char **argv)
 	return 0;
 }
 
-void print_qgroup_info(u64 objectid, struct btrfs_qgroup_info_item *info)
-{
-	printf("%llu/%llu %lld %lld\n", objectid >> 48,
-		objectid & ((1ll << 48) - 1),
-		btrfs_stack_qgroup_info_referenced(info),
-		btrfs_stack_qgroup_info_exclusive(info));
-}
-
-int list_qgroups(int fd)
-{
-	int ret;
-	struct btrfs_ioctl_search_args args;
-	struct btrfs_ioctl_search_key *sk = &args.key;
-	struct btrfs_ioctl_search_header *sh;
-	unsigned long off = 0;
-	unsigned int i;
-	int e;
-	struct btrfs_qgroup_info_item *info;
-
-	memset(&args, 0, sizeof(args));
-
-	/* search in the quota tree */
-	sk->tree_id = BTRFS_QUOTA_TREE_OBJECTID;
-
-	/*
-	 * set the min and max to backref keys.  The search will
-	 * only send back this type of key now.
-	 */
-	sk->max_type = BTRFS_QGROUP_INFO_KEY;
-	sk->min_type = BTRFS_QGROUP_INFO_KEY;
-	sk->max_objectid = 0;
-	sk->max_offset = (u64)-1;
-	sk->max_transid = (u64)-1;
-
-	/* just a big number, doesn't matter much */
-	sk->nr_items = 4096;
-
-	while (1) {
-		ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
-		e = errno;
-		if (ret < 0) {
-			fprintf(stderr,
-				"ERROR: can't perform the search - %s\n",
-				strerror(e));
-			return ret;
-		}
-		/* the ioctl returns the number of item it found in nr_items */
-		if (sk->nr_items == 0)
-			break;
-
-		off = 0;
-
-		/*
-		 * for each item, pull the key out of the header and then
-		 * read the root_ref item it contains
-		 */
-		for (i = 0; i < sk->nr_items; i++) {
-			sh = (struct btrfs_ioctl_search_header *)(args.buf +
-								  off);
-			off += sizeof(*sh);
-
-			if (sh->objectid != 0)
-				goto done;
-
-			if (sh->type != BTRFS_QGROUP_INFO_KEY)
-				goto done;
-
-			info = (struct btrfs_qgroup_info_item *)
-					(args.buf + off);
-			print_qgroup_info(sh->offset, info);
-
-			off += sh->len;
-
-			/*
-			 * record the mins in sk so we can make sure the
-			 * next search doesn't repeat this root
-			 */
-			sk->min_offset = sh->offset;
-		}
-		sk->nr_items = 4096;
-		/*
-		 * this iteration is done, step forward one qgroup for the next
-		 * ioctl
-		 */
-		if (sk->min_offset < (u64)-1)
-			sk->min_offset++;
-		else
-			break;
-	}
-
-done:
-	return ret;
-}
-
 static int parse_limit(const char *p, unsigned long long *s)
 {
 	char *endptr;
@@ -313,7 +219,7 @@ static int cmd_qgroup_show(int argc, char **argv)
 		return 12;
 	}
 
-	ret = list_qgroups(fd);
+	ret = btrfs_show_qgroups(fd);
 	if (ret < 0) {
 		fprintf(stderr, "ERROR: can't list qgroups\n");
 		return 30;
ctree.h +11 -0
index 293b24f..2c1b16b 100644
@@ -1949,6 +1949,17 @@ BTRFS_SETGET_FUNCS(qgroup_limit_rsv_referenced, struct btrfs_qgroup_limit_item,
 BTRFS_SETGET_FUNCS(qgroup_limit_rsv_exclusive, struct btrfs_qgroup_limit_item,
 		   rsv_exclusive, 64);
 
+BTRFS_SETGET_STACK_FUNCS(stack_qgroup_limit_flags,
+			 struct btrfs_qgroup_limit_item, flags, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_qgroup_limit_max_referenced,
+			 struct btrfs_qgroup_limit_item, max_referenced, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_qgroup_limit_max_exclusive,
+			 struct btrfs_qgroup_limit_item, max_exclusive, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_qgroup_limit_rsv_referenced,
+			 struct btrfs_qgroup_limit_item, rsv_referenced, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_qgroup_limit_rsv_exclusive,
+			 struct btrfs_qgroup_limit_item, rsv_exclusive, 64);
+
 /* this returns the number of file bytes represented by the inline item.
  * If an item is compressed, this is the uncompressed size
  */
qgroup.c +509 -0

516 lines not on this page · raw message

qgroup.h +9 -0
index ad14c88..138c48c 100644
@@ -22,6 +22,15 @@
 #include "ioctl.h"
 #include "kerncompat.h"
 
+enum btrfs_qgroup_column_enum {
+	BTRFS_QGROUP_QGROUPID,
+	BTRFS_QGROUP_RFER,
+	BTRFS_QGROUP_EXCL,
+	BTRFS_QGROUP_ALL,
+};
+
+int  btrfs_show_qgroups(int fd);
+void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
 u64 parse_qgroupid(char *p);
 int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
 int qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit,
Signature · 1 line
1.7.11.7
author
#2 lore raw

PATCH 2/9 Btrfs-progs: introduces '-p' option to print the ID of the parent qgroups

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduces '-p' option to print the ID of the parent qgroups. You may use it like:

btrfs qgroup show -p <path>
For Example:

                qgroupid(2/0)
                /         \
               /           \
              /             \
        qgroupid(1/0)  qgroupid(1/1)
              \              /
               \            /
                qgroupid(0/1)

If we use the command:

btrfs qgroup show -p <path>
The result will output

	0/1 -- -- 1/0,1/1
	1/0 -- -- 2/0
	1/1 -- -- 2/0
	2/0 -- -- --
---
 cmds-qgroup.c | 24 +++++++++++++++++++++---
 qgroup.c      | 22 ++++++++++++++++++++++
 qgroup.h      |  1 +
 3 files changed, 44 insertions(+), 3 deletions(-)
cmds-qgroup.c +21 -3
index 2d5b59b..f402587 100644
@@ -199,20 +199,38 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show <path>",
+	"btrfs qgroup show -p <path>",
 	"Show all subvolume quota groups.",
+	"-p		print parent qgroup id",
 	NULL
 };
 
 static int cmd_qgroup_show(int argc, char **argv)
 {
 	int ret = 0;
+	char *path;
 	int fd;
-	char *path = argv[1];
+	int c;
+
+	optind = 1;
+	while (1) {
+		c = getopt(argc, argv, "p");
+		if (c < 0)
+			break;
 
-	if (check_argc_exact(argc, 2))
+		switch (c) {
+		case 'p':
+			btrfs_qgroup_setup_print_column(
+						BTRFS_QGROUP_PARENT);
+			break;
+		default:
+			usage(cmd_qgroup_show_usage);
+		}
+	}
+	if (check_argc_exact(argc - optind, 1))
 		usage(cmd_qgroup_show_usage);
 
+	path = argv[optind];
 	fd = open_file_or_dir(path);
 	if (fd < 0) {
 		fprintf(stderr, "ERROR: can't access '%s'\n", path);
qgroup.c +22 -0
index 097811e..ebe7d17 100644
@@ -88,6 +88,11 @@ struct {
 		.need_print	= 1,
 	},
 	{
+		.name		= "parent",
+		.column_name	= "Parent",
+		.need_print	= 0,
+	},
+	{
 		.name		= NULL,
 		.column_name	= NULL,
 		.need_print	= 0,
@@ -108,6 +113,20 @@ void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column)
 		btrfs_qgroup_columns[i].need_print = 1;
 }
 
+static void print_parent_column(struct btrfs_qgroup *qgroup)
+{
+	struct btrfs_qgroup_list *list = NULL;
+
+	list_for_each_entry(list, &qgroup->qgroups, next_qgroup) {
+		printf("%llu/%llu", (list->qgroup)->qgroupid >> 48,
+		      ((1ll << 48) - 1) & (list->qgroup)->qgroupid);
+		if (!list_is_last(&list->next_qgroup, &qgroup->qgroups))
+			printf(",");
+	}
+	if (list_empty(&qgroup->qgroups))
+		printf("---");
+}
+
 static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 				enum btrfs_qgroup_column_enum column)
 {
@@ -125,6 +144,9 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 	case BTRFS_QGROUP_EXCL:
 		printf("%llu", qgroup->excl);
 		break;
+	case BTRFS_QGROUP_PARENT:
+		print_parent_column(qgroup);
+		break;
 	default:
 		break;
 	}
qgroup.h +1 -0
index 138c48c..e1de675 100644
@@ -26,6 +26,7 @@ enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_QGROUPID,
 	BTRFS_QGROUP_RFER,
 	BTRFS_QGROUP_EXCL,
+	BTRFS_QGROUP_PARENT,
 	BTRFS_QGROUP_ALL,
 };
 
Signature · 1 line
1.7.11.7
author
#3 lore raw

PATCH 3/9 Btrfs-progs: introduces '-c' option to print the ID of the child qgroups

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduces '-c' option to print the ID of the child qgroups. You may use it like:
btrfs qgroup show -c <path>

For Example:

                qgroupid(2/0)
                 /       \
                /         \
               /           \
            qgroupid(1/0) qgroupid(1/1)
               \            /
                \          /
		 qgroupid(0/1)

If we use the command:

btrfs qgroup show -c <path>
The result will output

	0/1 -- -- --
	1/0 -- -- 0/1
	1/1 -- -- 0/1
	2/0 -- -- 1/0,1/1
---
 cmds-qgroup.c |  9 +++++++--
 qgroup.c      | 22 ++++++++++++++++++++++
 qgroup.h      |  1 +
 3 files changed, 30 insertions(+), 2 deletions(-)
cmds-qgroup.c +7 -2
index f402587..f182c90 100644
@@ -199,9 +199,10 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show -p <path>",
+	"btrfs qgroup show -pc <path>",
 	"Show all subvolume quota groups.",
 	"-p		print parent qgroup id",
+	"-c		print child qgroup id",
 	NULL
 };
 
@@ -214,7 +215,7 @@ static int cmd_qgroup_show(int argc, char **argv)
 
 	optind = 1;
 	while (1) {
-		c = getopt(argc, argv, "p");
+		c = getopt(argc, argv, "pc");
 		if (c < 0)
 			break;
 
@@ -223,6 +224,10 @@ static int cmd_qgroup_show(int argc, char **argv)
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_PARENT);
 			break;
+		case 'c':
+			btrfs_qgroup_setup_print_column(
+						BTRFS_QGROUP_CHILD);
+			break;
 		default:
 			usage(cmd_qgroup_show_usage);
 		}
qgroup.c +22 -0
index ebe7d17..3bfc408 100644
@@ -93,6 +93,11 @@ struct {
 		.need_print	= 0,
 	},
 	{
+		.name		= "child",
+		.column_name	= "Child",
+		.need_print	= 0,
+	},
+	{
 		.name		= NULL,
 		.column_name	= NULL,
 		.need_print	= 0,
@@ -127,6 +132,20 @@ static void print_parent_column(struct btrfs_qgroup *qgroup)
 		printf("---");
 }
 
+static void print_child_column(struct btrfs_qgroup *qgroup)
+{
+	struct btrfs_qgroup_list *list = NULL;
+
+	list_for_each_entry(list, &qgroup->members, next_member) {
+		printf("%llu/%llu", (list->member)->qgroupid >> 48,
+		      ((1ll << 48) - 1) & (list->member)->qgroupid);
+		if (!list_is_last(&list->next_member, &qgroup->members))
+			printf(",");
+	}
+	if (list_empty(&qgroup->members))
+		printf("---");
+}
+
 static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 				enum btrfs_qgroup_column_enum column)
 {
@@ -147,6 +166,9 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 	case BTRFS_QGROUP_PARENT:
 		print_parent_column(qgroup);
 		break;
+	case BTRFS_QGROUP_CHILD:
+		print_child_column(qgroup);
+		break;
 	default:
 		break;
 	}
qgroup.h +1 -0
index e1de675..02c78be 100644
@@ -27,6 +27,7 @@ enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_RFER,
 	BTRFS_QGROUP_EXCL,
 	BTRFS_QGROUP_PARENT,
+	BTRFS_QGROUP_CHILD,
 	BTRFS_QGROUP_ALL,
 };
 
Signature · 1 line
1.7.11.7
author
#4 lore raw

PATCH 4/9 Btrfs-progs: introduce '-l' option to print max referenced size of qgroups

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduces '-l' option to print max referenced size of qgroups. You may use it like:

btrfs qgroup show -l <path>

---
 cmds-qgroup.c | 9 +++++++--
 qgroup.c      | 7 +++++++
 qgroup.h      | 1 +
 3 files changed, 15 insertions(+), 2 deletions(-)
cmds-qgroup.c +7 -2
index f182c90..a0156a6 100644
@@ -199,10 +199,11 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show -pc <path>",
+	"btrfs qgroup show -pcl <path>",
 	"Show all subvolume quota groups.",
 	"-p		print parent qgroup id",
 	"-c		print child qgroup id",
+	"-l		print max referenced size of qgroup",
 	NULL
 };
 
@@ -215,7 +216,7 @@ static int cmd_qgroup_show(int argc, char **argv)
 
 	optind = 1;
 	while (1) {
-		c = getopt(argc, argv, "pc");
+		c = getopt(argc, argv, "pcl");
 		if (c < 0)
 			break;
 
@@ -228,6 +229,10 @@ static int cmd_qgroup_show(int argc, char **argv)
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_CHILD);
 			break;
+		case 'l':
+			btrfs_qgroup_setup_print_column(
+						BTRFS_QGROUP_MAX_RFER);
+			break;
 		default:
 			usage(cmd_qgroup_show_usage);
 		}
qgroup.c +7 -0
index 3bfc408..31f3a16 100644
@@ -87,6 +87,10 @@ struct {
 		.column_name	= "Excl",
 		.need_print	= 1,
 	},
+	{	.name		= "max_rfer",
+		.column_name	= "Max_rfer",
+		.need_print	= 0,
+	},
 	{
 		.name		= "parent",
 		.column_name	= "Parent",
@@ -163,6 +167,9 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 	case BTRFS_QGROUP_EXCL:
 		printf("%llu", qgroup->excl);
 		break;
+	case BTRFS_QGROUP_MAX_RFER:
+		printf("%llu", qgroup->max_rfer);
+		break;
 	case BTRFS_QGROUP_PARENT:
 		print_parent_column(qgroup);
 		break;
qgroup.h +1 -0
index 02c78be..a212913 100644
@@ -26,6 +26,7 @@ enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_QGROUPID,
 	BTRFS_QGROUP_RFER,
 	BTRFS_QGROUP_EXCL,
+	BTRFS_QGROUP_MAX_RFER,
 	BTRFS_QGROUP_PARENT,
 	BTRFS_QGROUP_CHILD,
 	BTRFS_QGROUP_ALL,
Signature · 1 line
1.7.11.7
author
#5 lore raw

PATCH 5/9 Btrfs-progs: introduce '-e' option to print max exclusive size of qgroups

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduce '-e' option to print max exclusive size of qgroups. You may use it like this:
btrfs qgroup -e <path>

---
 cmds-qgroup.c | 9 +++++++--
 qgroup.c      | 8 ++++++++
 qgroup.h      | 1 +
 3 files changed, 16 insertions(+), 2 deletions(-)
cmds-qgroup.c +7 -2
index a0156a6..e020335 100644
@@ -199,11 +199,12 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show -pcl <path>",
+	"btrfs qgroup show -pcle <path>",
 	"Show all subvolume quota groups.",
 	"-p		print parent qgroup id",
 	"-c		print child qgroup id",
 	"-l		print max referenced size of qgroup",
+	"-e		print max exclusive size of qgroup",
 	NULL
 };
 
@@ -216,7 +217,7 @@ static int cmd_qgroup_show(int argc, char **argv)
 
 	optind = 1;
 	while (1) {
-		c = getopt(argc, argv, "pcl");
+		c = getopt(argc, argv, "pcle");
 		if (c < 0)
 			break;
 
@@ -233,6 +234,10 @@ static int cmd_qgroup_show(int argc, char **argv)
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_MAX_RFER);
 			break;
+		case 'e':
+			btrfs_qgroup_setup_print_column(
+						BTRFS_QGROUP_MAX_EXCL);
+			break;
 		default:
 			usage(cmd_qgroup_show_usage);
 		}
qgroup.c +8 -0
index 31f3a16..94cd202 100644
@@ -92,6 +92,11 @@ struct {
 		.need_print	= 0,
 	},
 	{
+		.name		= "max_excl",
+		.column_name	= "Max_excl",
+		.need_print	= 0,
+	},
+	{
 		.name		= "parent",
 		.column_name	= "Parent",
 		.need_print	= 0,
@@ -170,6 +175,9 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 	case BTRFS_QGROUP_MAX_RFER:
 		printf("%llu", qgroup->max_rfer);
 		break;
+	case BTRFS_QGROUP_MAX_EXCL:
+		printf("%llu", qgroup->max_excl);
+		break;
 	case BTRFS_QGROUP_PARENT:
 		print_parent_column(qgroup);
 		break;
qgroup.h +1 -0
index a212913..a23da83 100644
@@ -27,6 +27,7 @@ enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_RFER,
 	BTRFS_QGROUP_EXCL,
 	BTRFS_QGROUP_MAX_RFER,
+	BTRFS_QGROUP_MAX_EXCL,
 	BTRFS_QGROUP_PARENT,
 	BTRFS_QGROUP_CHILD,
 	BTRFS_QGROUP_ALL,
Signature · 1 line
1.7.11.7
author
#6 lore raw

PATCH 6/9 Btrfs-progs: list all qgroups impact given path(include ancestral qgroups)

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduces '-F' option which can help you filter the qgroups by the path name, you may use it like:

btrfs qgroup show -F <path>
For example:

                         qgroupid(2/0)
                          /     \
                         /       \
                        qgroupid(1/0)
                        /         \
                       /           \
                      /             \
                  qgroupid(0/1)   qgroupid(0/2)
                  sub1              sub2
                  /  \
                 /    \
		dir1  file1

If we use the command:
btrfs qgroup show -F sub1/dir1
The result will output

	0/1	--	--
	1/0	--	--
	2/0	--	--

'-F' option help you list all qgroups impact given path. (include ancestral qgroups).

---
 cmds-qgroup.c |  25 ++++--
 qgroup.c      | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 qgroup.h      |  27 ++++++-
 3 files changed, 281 insertions(+), 10 deletions(-)
cmds-qgroup.c +20 -5
index e020335..b6cdb53 100644
@@ -199,12 +199,14 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show -pcle <path>",
-	"Show all subvolume quota groups.",
+	"btrfs qgroup show -pcleF <path>",
+	"Show subvolume quota groups.",
 	"-p		print parent qgroup id",
 	"-c		print child qgroup id",
 	"-l		print max referenced size of qgroup",
 	"-e		print max exclusive size of qgroup",
+	"-F		list all qgroups which impact the given path"
+	"(include ancestral qgroups)",
 	NULL
 };
 
@@ -214,10 +216,15 @@ static int cmd_qgroup_show(int argc, char **argv)
 	char *path;
 	int fd;
 	int c;
+	u64 qgroupid;
+	int filter_flag = 0;
+
+	struct btrfs_qgroup_filter_set *filter_set;
+	filter_set = btrfs_qgroup_alloc_filter_set();
 
 	optind = 1;
 	while (1) {
-		c = getopt(argc, argv, "pcle");
+		c = getopt(argc, argv, "pcleF");
 		if (c < 0)
 			break;
 
@@ -238,6 +245,9 @@ static int cmd_qgroup_show(int argc, char **argv)
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_MAX_EXCL);
 			break;
+		case 'F':
+			filter_flag |= 0x1;
+			break;
 		default:
 			usage(cmd_qgroup_show_usage);
 		}
@@ -251,8 +261,13 @@ static int cmd_qgroup_show(int argc, char **argv)
 		fprintf(stderr, "ERROR: can't access '%s'\n", path);
 		return 12;
 	}
-
-	ret = btrfs_show_qgroups(fd);
+	if (filter_flag) {
+		qgroupid = btrfs_get_path_rootid(fd);
+		btrfs_qgroup_setup_filter(&filter_set,
+					  BTRFS_QGROUP_FILTER_ALL_PARENT,
+					  qgroupid);
+	}
+	ret = btrfs_show_qgroups(fd, filter_set);
 	if (ret < 0) {
 		fprintf(stderr, "ERROR: can't list qgroups\n");
 		return 30;
qgroup.c +235 -4

287 lines not on this page · raw message

qgroup.h +26 -1
index a23da83..30844fe 100644
@@ -22,6 +22,21 @@
 #include "ioctl.h"
 #include "kerncompat.h"
 
+struct btrfs_qgroup;
+
+typedef int (*btrfs_qgroup_filter_func)(struct btrfs_qgroup *, u64);
+
+struct btrfs_qgroup_filter {
+	btrfs_qgroup_filter_func filter_func;
+	u64 data;
+};
+
+struct btrfs_qgroup_filter_set {
+	int total;
+	int nfilters;
+	struct btrfs_qgroup_filter filters[0];
+};
+
 enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_QGROUPID,
 	BTRFS_QGROUP_RFER,
@@ -33,8 +48,18 @@ enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_ALL,
 };
 
-int  btrfs_show_qgroups(int fd);
+enum btrfs_qgroup_filter_enum {
+	BTRFS_QGROUP_FILTER_ALL_PARENT,
+	BTRFS_QGROUP_FILTER_MAX,
+};
+
+u64 btrfs_get_path_rootid(int fd);
+int btrfs_show_qgroups(int fd, struct btrfs_qgroup_filter_set *);
 void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
+struct btrfs_qgroup_filter_set *btrfs_qgroup_alloc_filter_set(void);
+void btrfs_qgroup_free_filter_set(struct btrfs_qgroup_filter_set *filter_set);
+int btrfs_qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
+			      enum btrfs_qgroup_filter_enum, u64 data);
 u64 parse_qgroupid(char *p);
 int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
 int qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit,
Signature · 1 line
1.7.11.7
author
#7 lore raw

PATCH 7/9 Btrfs-progs: list all qgroups impact given path(exclude ancestral qgroups)

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduces '-f' option which can help you filter the qgroups by the path name, you may use it like:

btrfs qgroup show -f <path>
For example:

                         qgroupid(2/0)
                          /     \
                         /       \
                        qgroupid(1/0)
                        /         \
                       /           \
                      /             \
                  qgroupid(0/1)   qgroupid(0/2)
                  sub1              sub2
                  /  \
                 /    \
		dir1  file1

If we use the command:
btrfs qgroup show -f sub1/dir1
The result will output

	0/1	--	--

'-f' option helps you list all qgroups impact given path. (exclude ancestral qgroups)

---
 cmds-qgroup.c | 14 ++++++++++++--
 qgroup.c      | 16 +++++++++++++++-
 qgroup.h      |  1 +
 3 files changed, 28 insertions(+), 3 deletions(-)
cmds-qgroup.c +12 -2
index b6cdb53..9447179 100644
@@ -207,6 +207,8 @@ static const char * const cmd_qgroup_show_usage[] = {
 	"-e		print max exclusive size of qgroup",
 	"-F		list all qgroups which impact the given path"
 	"(include ancestral qgroups)",
+	"-f		list all qgroups which impact the given path"
+	"(exclude ancestral qgroups)",
 	NULL
 };
 
@@ -224,7 +226,7 @@ static int cmd_qgroup_show(int argc, char **argv)
 
 	optind = 1;
 	while (1) {
-		c = getopt(argc, argv, "pcleF");
+		c = getopt(argc, argv, "pcleFf");
 		if (c < 0)
 			break;
 
@@ -248,6 +250,9 @@ static int cmd_qgroup_show(int argc, char **argv)
 		case 'F':
 			filter_flag |= 0x1;
 			break;
+		case 'f':
+			filter_flag |= 0x2;
+			break;
 		default:
 			usage(cmd_qgroup_show_usage);
 		}
@@ -263,9 +268,14 @@ static int cmd_qgroup_show(int argc, char **argv)
 	}
 	if (filter_flag) {
 		qgroupid = btrfs_get_path_rootid(fd);
-		btrfs_qgroup_setup_filter(&filter_set,
+		if (filter_flag & 0x1)
+			btrfs_qgroup_setup_filter(&filter_set,
 					  BTRFS_QGROUP_FILTER_ALL_PARENT,
 					  qgroupid);
+		if (filter_flag & 0x2)
+			btrfs_qgroup_setup_filter(&filter_set,
+					  BTRFS_QGROUP_FILTER_PARENT,
+					  qgroupid);
 	}
 	ret = btrfs_show_qgroups(fd, filter_set);
 	if (ret < 0) {
qgroup.c +15 -1
index 6cb71e9..b8640dc 100644
@@ -468,6 +468,18 @@ static int filter_all_parent_insert(struct qgroup_lookup *sort_tree,
 	return 0;
 }
 
+static int filter_by_parent(struct btrfs_qgroup *bq, u64 data)
+{
+	struct btrfs_qgroup *qgroup =
+		(struct btrfs_qgroup *)(unsigned long)data;
+
+	if (data == 0)
+		return 0;
+	if (qgroup->qgroupid == bq->qgroupid)
+		return 1;
+	return 0;
+}
+
 static int filter_by_all_parent(struct btrfs_qgroup *bq, u64 data)
 {
 	struct qgroup_lookup lookup;
@@ -502,6 +514,7 @@ static int filter_by_all_parent(struct btrfs_qgroup *bq, u64 data)
 }
 
 static btrfs_qgroup_filter_func all_filter_funcs[] = {
+	[BTRFS_QGROUP_FILTER_PARENT]		= filter_by_parent,
 	[BTRFS_QGROUP_FILTER_ALL_PARENT]	= filter_by_all_parent,
 };
 
@@ -586,7 +599,8 @@ static void pre_process_filter_set(struct qgroup_lookup *lookup,
 
 	for (i = 0; i < set->nfilters; i++) {
 
-		if (set->filters[i].filter_func == filter_by_all_parent) {
+		if (set->filters[i].filter_func == filter_by_all_parent
+		    || set->filters[i].filter_func == filter_by_parent) {
 			qgroup_for_filter = qgroup_tree_search(lookup,
 					    set->filters[i].data);
 			set->filters[i].data =
qgroup.h +1 -0
index 30844fe..d1165fd 100644
@@ -49,6 +49,7 @@ enum btrfs_qgroup_column_enum {
 };
 
 enum btrfs_qgroup_filter_enum {
+	BTRFS_QGROUP_FILTER_PARENT,
 	BTRFS_QGROUP_FILTER_ALL_PARENT,
 	BTRFS_QGROUP_FILTER_MAX,
 };
Signature · 1 line
1.7.11.7
author
#8 lore raw

PATCH 8/9 Btrfs-progs: enhance btrfs qgroup show to sort qgroups

In reply to Miao Xie

From: Wang Shilong <[email protected]>

You might want to list qgroups in order of some items, such as 'qgroupid', 'rfer' and so on, you can use '--sort'. Now you can sort the qgroups by 'qgroupid', 'rfer','excl','max_rfer' and 'max_excl'.

For example:
If you want to list qgroups in order of 'qgroupid'.
You can use the option like that:

	btrfs qgroup show --sort=+/-qgroupid <path>

Here, '+' means the result is sorted by ascending order. '-' is by descending order. If you don't specify either '+' nor '-', the result is sorted by default - ascending order.

If you want to combine sort items, you do it like that:

	btrfs qgroup show  --sort=-qgroupid,+rfer,max_rfer,excl <path>
---
 cmds-qgroup.c |  26 +++++-
 qgroup.c      | 254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 qgroup.h      |  33 +++++++-
 3 files changed, 301 insertions(+), 12 deletions(-)
cmds-qgroup.c +23 -3
index 9447179..dd74366 100644
@@ -199,7 +199,8 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show -pcleF <path>",
+	"btrfs qgroup show -pcleF "
+	"[--sort=qgroupid,rfer,excl,max_rfer,max_excl] <path>",
 	"Show subvolume quota groups.",
 	"-p		print parent qgroup id",
 	"-c		print child qgroup id",
@@ -209,6 +210,11 @@ static const char * const cmd_qgroup_show_usage[] = {
 	"(include ancestral qgroups)",
 	"-f		list all qgroups which impact the given path"
 	"(exclude ancestral qgroups)",
+	"--sort=qgroupid,rfer,excl,max_rfer,max_excl",
+	"		list qgroups in order of qgroupid,rfer"
+	"rfer,max_rfer or max_excl",
+	"		you can use '+' or '-' in front of each item.",
+	"		(+:ascending, -:descending, ascending default",
 	NULL
 };
 
@@ -221,12 +227,20 @@ static int cmd_qgroup_show(int argc, char **argv)
 	u64 qgroupid;
 	int filter_flag = 0;
 
+	struct btrfs_qgroup_comparer_set *comparer_set;
 	struct btrfs_qgroup_filter_set *filter_set;
 	filter_set = btrfs_qgroup_alloc_filter_set();
 
+	comparer_set = btrfs_qgroup_alloc_comparer_set();
+	struct option long_options[] = {
+		{"sort", 1, NULL, 'S'},
+		{0, 0, 0, 0}
+	};
+
 	optind = 1;
 	while (1) {
-		c = getopt(argc, argv, "pcleFf");
+		c = getopt_long(argc, argv, "pcleFf",
+				long_options, NULL);
 		if (c < 0)
 			break;
 
@@ -253,6 +267,12 @@ static int cmd_qgroup_show(int argc, char **argv)
 		case 'f':
 			filter_flag |= 0x2;
 			break;
+		case 'S':
+			ret = btrfs_qgroup_parse_sort_string(optarg,
+							     &comparer_set);
+			if (ret)
+				usage(cmd_qgroup_show_usage);
+			break;
 		default:
 			usage(cmd_qgroup_show_usage);
 		}
@@ -277,7 +297,7 @@ static int cmd_qgroup_show(int argc, char **argv)
 					  BTRFS_QGROUP_FILTER_PARENT,
 					  qgroupid);
 	}
-	ret = btrfs_show_qgroups(fd, filter_set);
+	ret = btrfs_show_qgroups(fd, filter_set, comparer_set);
 	if (ret < 0) {
 		fprintf(stderr, "ERROR: can't list qgroups\n");
 		return 30;
qgroup.c +246 -8

315 lines not on this page · raw message

qgroup.h +32 -1
index d1165fd..032ceda 100644
@@ -25,18 +25,32 @@
 struct btrfs_qgroup;
 
 typedef int (*btrfs_qgroup_filter_func)(struct btrfs_qgroup *, u64);
+typedef int (*btrfs_qgroup_comp_func)(struct btrfs_qgroup *,
+				      struct btrfs_qgroup *, int);
+
 
 struct btrfs_qgroup_filter {
 	btrfs_qgroup_filter_func filter_func;
 	u64 data;
 };
 
+struct btrfs_qgroup_comparer {
+	btrfs_qgroup_comp_func comp_func;
+	int is_descending;
+};
+
 struct btrfs_qgroup_filter_set {
 	int total;
 	int nfilters;
 	struct btrfs_qgroup_filter filters[0];
 };
 
+struct btrfs_qgroup_comparer_set {
+	int total;
+	int ncomps;
+	struct btrfs_qgroup_comparer comps[0];
+};
+
 enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_QGROUPID,
 	BTRFS_QGROUP_RFER,
@@ -48,19 +62,36 @@ enum btrfs_qgroup_column_enum {
 	BTRFS_QGROUP_ALL,
 };
 
+enum btrfs_qgroup_comp_enum {
+	BTRFS_QGROUP_COMP_QGROUPID,
+	BTRFS_QGROUP_COMP_RFER,
+	BTRFS_QGROUP_COMP_EXCL,
+	BTRFS_QGROUP_COMP_MAX_RFER,
+	BTRFS_QGROUP_COMP_MAX_EXCL,
+	BTRFS_QGROUP_COMP_MAX
+};
+
 enum btrfs_qgroup_filter_enum {
 	BTRFS_QGROUP_FILTER_PARENT,
 	BTRFS_QGROUP_FILTER_ALL_PARENT,
 	BTRFS_QGROUP_FILTER_MAX,
 };
 
+int btrfs_qgroup_parse_sort_string(char *optarg,
+				   struct btrfs_qgroup_comparer_set **comps);
 u64 btrfs_get_path_rootid(int fd);
-int btrfs_show_qgroups(int fd, struct btrfs_qgroup_filter_set *);
+int btrfs_show_qgroups(int fd, struct btrfs_qgroup_filter_set *,
+		       struct btrfs_qgroup_comparer_set *);
 void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
 struct btrfs_qgroup_filter_set *btrfs_qgroup_alloc_filter_set(void);
 void btrfs_qgroup_free_filter_set(struct btrfs_qgroup_filter_set *filter_set);
 int btrfs_qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
 			      enum btrfs_qgroup_filter_enum, u64 data);
+struct btrfs_qgroup_comparer_set *btrfs_qgroup_alloc_comparer_set(void);
+void btrfs_qgroup_free_comparer_set(struct btrfs_qgroup_comparer_set *comp_set);
+int btrfs_qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set,
+				enum btrfs_qgroup_comp_enum comparer,
+				int is_descending);
 u64 parse_qgroupid(char *p);
 int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
 int qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit,
Signature · 1 line
1.7.11.7
author
#9 lore raw

PATCH 9/9 Btrfs-progs: enhance btrfs qgroup to print the result as a table

In reply to Miao Xie

From: Wang Shilong <[email protected]>

This patch introduce '-t' option which can help you print the result as a table.

You can use it like:
btrfs qgroup show -t <path>
However, to table the result better, we make '-p' and '-c' not present at the same time.If you still want to show both of them at the same time, you may print the result without '-t' option.

For example:

btrfs qgroup show -tpl <path>
The result will output as the follow format:

qgroupid rfer       excl       max_excl       parent
-------- ----       ----       --------       ------
0/265    1289752576 1289752576 0              ---
1/0      0          0          10999511627776 2/0,3/0
2/0      0          0          0              ---
3/0      0          0          0              ---
---
 cmds-qgroup.c |  20 ++++++-
 qgroup.c      | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 qgroup.h      |   3 +-
 3 files changed, 191 insertions(+), 11 deletions(-)
cmds-qgroup.c +17 -3
index dd74366..1cba305 100644
@@ -199,13 +199,14 @@ static int cmd_qgroup_destroy(int argc, char **argv)
 }
 
 static const char * const cmd_qgroup_show_usage[] = {
-	"btrfs qgroup show -pcleF "
+	"btrfs qgroup show -pcleFt "
 	"[--sort=qgroupid,rfer,excl,max_rfer,max_excl] <path>",
 	"Show subvolume quota groups.",
 	"-p		print parent qgroup id",
 	"-c		print child qgroup id",
 	"-l		print max referenced size of qgroup",
 	"-e		print max exclusive size of qgroup",
+	"-t		print the result as a table",
 	"-F		list all qgroups which impact the given path"
 	"(include ancestral qgroups)",
 	"-f		list all qgroups which impact the given path"
@@ -226,6 +227,8 @@ static int cmd_qgroup_show(int argc, char **argv)
 	int c;
 	u64 qgroupid;
 	int filter_flag = 0;
+	int is_table_result = 0;
+	int table_better = 0;
 
 	struct btrfs_qgroup_comparer_set *comparer_set;
 	struct btrfs_qgroup_filter_set *filter_set;
@@ -239,17 +242,19 @@ static int cmd_qgroup_show(int argc, char **argv)
 
 	optind = 1;
 	while (1) {
-		c = getopt_long(argc, argv, "pcleFf",
+		c = getopt_long(argc, argv, "pcleFft",
 				long_options, NULL);
 		if (c < 0)
 			break;
 
 		switch (c) {
 		case 'p':
+			table_better |= 0x1;
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_PARENT);
 			break;
 		case 'c':
+			table_better |= 0x2;
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_CHILD);
 			break;
@@ -261,6 +266,9 @@ static int cmd_qgroup_show(int argc, char **argv)
 			btrfs_qgroup_setup_print_column(
 						BTRFS_QGROUP_MAX_EXCL);
 			break;
+		case 't':
+			is_table_result = 1;
+			break;
 		case 'F':
 			filter_flag |= 0x1;
 			break;
@@ -297,7 +305,13 @@ static int cmd_qgroup_show(int argc, char **argv)
 					  BTRFS_QGROUP_FILTER_PARENT,
 					  qgroupid);
 	}
-	ret = btrfs_show_qgroups(fd, filter_set, comparer_set);
+	if (is_table_result && table_better == 3) {
+		fprintf(stderr, "ERROR: '-p' and '-c' can't used "
+			"at the same time\n");
+		exit(1);
+	}
+	ret = btrfs_show_qgroups(fd, filter_set, comparer_set,
+				 is_table_result);
 	if (ret < 0) {
 		fprintf(stderr, "ERROR: can't list qgroups\n");
 		return 30;
qgroup.c +172 -7

296 lines not on this page · raw message

qgroup.h +2 -1
index 032ceda..64984a6 100644
@@ -81,7 +81,8 @@ int btrfs_qgroup_parse_sort_string(char *optarg,
 				   struct btrfs_qgroup_comparer_set **comps);
 u64 btrfs_get_path_rootid(int fd);
 int btrfs_show_qgroups(int fd, struct btrfs_qgroup_filter_set *,
-		       struct btrfs_qgroup_comparer_set *);
+		       struct btrfs_qgroup_comparer_set *,
+		       int is_table_result);
 void btrfs_qgroup_setup_print_column(enum btrfs_qgroup_column_enum column);
 struct btrfs_qgroup_filter_set *btrfs_qgroup_alloc_filter_set(void);
 void btrfs_qgroup_free_filter_set(struct btrfs_qgroup_filter_set *filter_set);
Signature · 1 line
1.7.11.7
#10 lore raw
In reply to Miao Xie
Quoted 9 lines · Miao Xie <miaox <at> cn.fujitsu.com> writes:

The patchset enhanced btrfs qgroup show command.

Firstly, we restructure show_qgroups, make it easy to add new features.

And then we add '-p' '-c', '-l',and '-e' options to print the parent qgroup id, child qgroup id, max referenced size and max exclusive size of qgroup respectively, add '-F' and '-f' option to list qgroups that impact the given path.

Hi,

What is the status of this patch? I don't ever think it made it in upstream. Was it flawed or just forgotten?

Thanks,
Dusty

#11 lore raw
Quoted 11 lines · Dusty Mabe
Quoted 8 lines · Miao Xie <miaox <at> cn.fujitsu.com> writes:

The patchset enhanced btrfs qgroup show command.

Firstly, we restructure show_qgroups, make it easy to add new features.

And then we add '-p' '-c', '-l',and '-e' options to print the parent qgroup id, child qgroup id, max referenced size and max exclusive size of qgroup respectively, add '-F' and '-f' option to list qgroups that impact the given path.

Quoted 4 lines

Hi,

What is the status of this patch? I don't ever think it made it in upstream. Was it flawed or just forgotten?

I will rebase this patchset and resend.

Thanks,
Wang

Quoted 9 lines

Thanks,
Dusty

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

Hi Wang,

Thank you! There is one other thing I have noticed while playing around with quota and qgroups. If I delete subvolumes I can manage to get some of the qgroup information to be reported as a negative number. If you are interested check out my steps at
http://dustymabe.com/2013/09/22/btrfs-how-big-are-my-snapshots/ . The system I was using was Fedora 19 (so not the latest stuff so this may be a known issue already).

Feel free to share the post if you think it could help anyone.

Dusty

Quoted 30 lines · Wang Shilong
Quoted 11 lines · Dusty Mabe
Quoted 8 lines · Miao Xie <miaox <at> cn.fujitsu.com> writes:

The patchset enhanced btrfs qgroup show command.

Firstly, we restructure show_qgroups, make it easy to add new features.

And then we add '-p' '-c', '-l',and '-e' options to print the parent qgroup id, child qgroup id, max referenced size and max exclusive size of qgroup respectively, add '-F' and '-f' option to list qgroups that impact the given path.

Quoted 4 lines

Hi,

What is the status of this patch? I don't ever think it made it in upstream. Was it flawed or just forgotten?

I will rebase this patchset and resend.

Thanks,
Wang

Quoted 9 lines

Thanks,
Dusty

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw
Quoted 9 lines · Dusty Mabe

Hi Wang,

Thank you! There is one other thing I have noticed while playing around with quota and qgroups. If I delete subvolumes I can manage to get some of the qgroup information to be reported as a negative number. If you are interested check out my steps at
http://dustymabe.com/2013/09/22/btrfs-how-big-are-my-snapshots/ . The system I was using was Fedora 19 (so not the latest stuff so this may be a known issue already).

I will take a look at this issue.

Thanks,
Wang

Quoted 39 lines

Feel free to share the post if you think it could help anyone.

Dusty

Quoted 11 lines · Wang Shilong
Quoted 10 lines · Dusty Mabe
Quoted 8 lines · Miao Xie <miaox <at> cn.fujitsu.com> writes:

The patchset enhanced btrfs qgroup show command.

Firstly, we restructure show_qgroups, make it easy to add new features.

And then we add '-p' '-c', '-l',and '-e' options to print the parent qgroup id, child qgroup id, max referenced size and max exclusive size of qgroup respectively, add '-F' and '-f' option to list qgroups that impact the given path.

Quoted 16 lines
Quoted 4 lines

Hi,

What is the status of this patch? I don't ever think it made it in upstream. Was it flawed or just forgotten?

I will rebase this patchset and resend.

Thanks,
Wang

Quoted 8 lines

Thanks,
Dusty

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

Wang Shilong posted on Mon, 23 Sep 2013 10:18:19 +0800 as excerpted:

Quoted 11 lines · Dusty Mabe
Quoted 8 lines

There is one other thing I have noticed while playing around with quota and qgroups. If I delete subvolumes I can manage to get some of the qgroup information to be reported as a negative number. If you are interested check out my steps at
http://dustymabe.com/2013/09/22/btrfs-how-big-are-my-snapshots/ . The system I was using was Fedora 19 (so not the latest stuff so this may be a known issue already).

I will take a look at this issue.

FWIW, I remember seeing discussion of the negative qgroup numbers on-
list, but as I don't use quotas I didn't track resolution. So it should
indeed be a known issue, but I'm not sure if it's fixed or someone's at least working on it yet or not.

But that might give you a duplicating instance if you need one, anyway. (Unless of course Dusty reported it earlier too and that's what I'm remembering.)

Signature · 3 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman
#15 lore raw

Hello,

Quoted 12 lines

Wang Shilong posted on Mon, 23 Sep 2013 10:18:19 +0800 as excerpted:

Quoted 9 lines · Dusty Mabe
Quoted 8 lines

There is one other thing I have noticed while playing around with quota and qgroups. If I delete subvolumes I can manage to get some of the qgroup information to be reported as a negative number. If you are interested check out my steps at
http://dustymabe.com/2013/09/22/btrfs-how-big-are-my-snapshots/ . The system I was using was Fedora 19 (so not the latest stuff so this may be a known issue already).

Quoted 6 lines
Quoted 1 line

I will take a look at this issue.

FWIW, I remember seeing discussion of the negative qgroup numbers on-
list, but as I don't use quotas I didn't track resolution. So it should
indeed be a known issue, but I'm not sure if it's fixed or someone's at least working on it yet or not.

I think this problem reported by Dusty is different from before.

Previously, we discussed about negative numbers because quota rescan has not been implemented.

In Dusty's reproduced steps, there are no parent qgroups. So i think every qgroup should works as expected, if negative numbers come out, it must be a *bug*.

Thanks,
Wang

Quoted 14 lines

But that might give you a duplicating instance if you need one, anyway. (Unless of course Dusty reported it earlier too and that's what I'm remembering.)

Signature · 8 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#16 lore raw
Quoted 5 lines · Wang Shilong <wangshilong1991 <at> gmail.com> writes:

In Dusty's reproduced steps, there are no parent qgroups. So i think every qgroup should works as expected, if negative numbers come out, it must be a *bug*.

In that case would you like for me to open a new bug report with the details?

Dusty

A message that is not in the archive (sent off-list or not yet received): [email protected]