* [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit.
@ 2015-02-10 10:23 Dongsheng Yang
2015-02-10 10:23 ` [PATCH 1/2] btrfs-progs:correct the return value Dongsheng Yang
` (10 more replies)
0 siblings, 11 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
Hi all,
[1/9] is a RESEND with a reviewed-by.
[2/9]-[6/9] are bug fixes about qgroup_inherit(), these patch make
user can set the limits when creating a subvolume with the related
patch in userspace applied.
[7/9]-[8/9] are a cleanup for qgroup.
[9/9] provides a way for btrfs-progs to get the quota status by ioctl(),
then btrfs-progs can warn user when they are using qgroup with quota_disabled.
With this series patch applied, both btrfs and btrfs-progs:
[root@atest-guest linux_btrfs]# btrfs quota enable /mnt
[root@atest-guest linux_btrfs]# btrfs qgroup show -prce /mnt
qgroupid rfer excl max_rfer max_excl parent child
-------- ---- ---- -------- -------- ------ -----
0/5 16.00KiB 16.00KiB 0.00B 0.00B --- ---
[root@atest-guest linux_btrfs]# btrfs sub create /mnt/sub1
Create subvolume '/mnt/sub1'
[root@atest-guest linux_btrfs]# btrfs qgroup show -prce /mnt
qgroupid rfer excl max_rfer max_excl parent child
-------- ---- ---- -------- -------- ------ -----
0/5 16.00KiB 16.00KiB 0.00B 0.00B --- ---
0/257 16.00KiB 16.00KiB 0.00B 0.00B --- ---
[root@atest-guest linux_btrfs]# btrfs sub create /mnt/sub2 -r 10M -e 5M
Create subvolume '/mnt/sub2'
Set qgroup arguments:
max reference: 10485760
max exclusive: 5242880
[root@atest-guest linux_btrfs]# btrfs qgroup show -prce /mnt
qgroupid rfer excl max_rfer max_excl parent child
-------- ---- ---- -------- -------- ------ -----
0/5 16.00KiB 16.00KiB 0.00B 0.00B --- ---
0/257 16.00KiB 16.00KiB 0.00B 0.00B --- ---
0/258 16.00KiB 16.00KiB 10.00MiB 5.00MiB --- ---
Dongsheng Yang (8):
btrfs: qgroup: move WARN_ON() to the correct location.
btrfs: qgroup: inherit limit info from srcgroup in creating snapshot.
btrfs: qgroup: update qgroup in memory at the same time when we update
it in btree.
btrfs: qgroup: consolidate the parameter of fucntion
update_qgroup_limit_item().
btrfs: qgroup: update limit info in function btrfs_run_qgroups().
btrfs: qgroup: fix limit args override whole limit struct
Btrfs: qgroup: make the btree for qgroup increase from left to right.
Btrfs: qgroup: cleanup, remove an unsued parameter in
btrfs_create_qgroup().
Fan Chengniang (1):
btrfs: qgroup: obtain quota status
fs/btrfs/ioctl.c | 9 +++-
fs/btrfs/qgroup.c | 109 +++++++++++++++++++++++++++---------------
fs/btrfs/qgroup.h | 6 ++-
fs/btrfs/tests/qgroup-tests.c | 4 +-
include/uapi/linux/btrfs.h | 3 ++
5 files changed, 87 insertions(+), 44 deletions(-)
--
1.8.4.2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/2] btrfs-progs:correct the return value
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-27 15:37 ` David Sterba
2015-02-10 10:23 ` [PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location Dongsheng Yang
` (9 subsequent siblings)
10 siblings, 1 reply; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Fan Chengniang
From: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
the return values 12 and 13 are not used spectially except as
return value. No description and definition about them. so I
change them to generic errno
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
---
qgroup.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/qgroup.c b/qgroup.c
index d59f4bb..5a4e393 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -21,6 +21,7 @@
#include "ctree.h"
#include "ioctl.h"
#include "utils.h"
+#include <errno.h>
#define BTRFS_QGROUP_NFILTERS_INCREASE (2 * BTRFS_QGROUP_FILTER_MAX)
#define BTRFS_QGROUP_NCOMPS_INCREASE (2 * BTRFS_QGROUP_COMP_MAX)
@@ -1294,7 +1295,7 @@ qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit, int n, int pos)
out = calloc(sizeof(*out) + sizeof(out->qgroups[0]) * (nitems + n), 1);
if (out == NULL) {
fprintf(stderr, "ERROR: Not enough memory\n");
- return 13;
+ return -ENOMEM;
}
if (*inherit) {
@@ -1322,7 +1323,7 @@ int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg)
if (qgroupid == 0) {
fprintf(stderr, "ERROR: bad qgroup specification\n");
- return 12;
+ return -EINVAL;
}
if (*inherit)
@@ -1349,7 +1350,7 @@ int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg,
if (!p) {
bad:
fprintf(stderr, "ERROR: bad copy specification\n");
- return 12;
+ return -EINVAL;
}
*p = 0;
qgroup_src = parse_qgroupid(arg);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location.
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
2015-02-10 10:23 ` [PATCH 1/2] btrfs-progs:correct the return value Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-03-02 22:05 ` Josef Bacik
2015-02-10 10:23 ` [PATCH 2/2] btrfs-progs:set max_rfer and max_excl on creating new subvolume Dongsheng Yang
` (8 subsequent siblings)
10 siblings, 1 reply; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
In function qgroup_excl_accounting(), we need to WARN when
qg->excl is less than what we want to free, same to child
and parents. But currently, for parent qgroup, the WARN_ON()
is located after freeing qg->excl. It will WARN out even we
free it normally.
This patch move this WARN_ON() before freeing qg->excl.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
fs/btrfs/qgroup.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 48b60db..97159a8 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1431,9 +1431,8 @@ static int qgroup_excl_accounting(struct btrfs_fs_info *fs_info,
qgroup = u64_to_ptr(unode->aux);
qgroup->rfer += sign * oper->num_bytes;
qgroup->rfer_cmpr += sign * oper->num_bytes;
+ WARN_ON(sign < 0 && qgroup->excl < oper->num_bytes);
qgroup->excl += sign * oper->num_bytes;
- if (sign < 0)
- WARN_ON(qgroup->excl < oper->num_bytes);
qgroup->excl_cmpr += sign * oper->num_bytes;
qgroup_dirty(fs_info, qgroup);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] btrfs-progs:set max_rfer and max_excl on creating new subvolume
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
2015-02-10 10:23 ` [PATCH 1/2] btrfs-progs:correct the return value Dongsheng Yang
2015-02-10 10:23 ` [PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot Dongsheng Yang
` (7 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Fan Chengniang
From: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
add -r and -e options to enable setting max reference size
and max exclusive on creating new subvolumes.
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
---
Documentation/btrfs-subvolume.txt | 8 +++-
cmds-qgroup.c | 42 ------------------
cmds-subvolume.c | 57 +++++++++++++++++++++++-
ioctl.h | 3 ++
qgroup.c | 92 +++++++++++++++++++++++++++++++++++++++
qgroup.h | 3 ++
6 files changed, 160 insertions(+), 45 deletions(-)
diff --git a/Documentation/btrfs-subvolume.txt b/Documentation/btrfs-subvolume.txt
index b0ae030..fe13943 100644
--- a/Documentation/btrfs-subvolume.txt
+++ b/Documentation/btrfs-subvolume.txt
@@ -43,7 +43,7 @@ from normal directories.
SUBCOMMAND
-----------
-*create* [-i <qgroupid>] [<dest>]<name>::
+*create* [-i <qgroupid>] [-r <max_rfer>] [-e <max_excl>] [<dest>]<name>::
Create a subvolume <name> in <dest>.
+
If <dest> is not given, subvolume <name> will be created in the currently
@@ -54,6 +54,12 @@ directory.
-i <qgroupid>::::
Add the newly created subvolume to a qgroup. This option can be given multiple
times.
++
+-r <max_rfer>::::
+set the newly created subvolume's max reference size
++
+-e <max_excl>::::
+set the newly created subvolume's max exclusive size
*delete* [options] <subvolume> [<subvolume>...]::
Delete the subvolume(s) from the filesystem.
diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 2172944..30f0851 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -106,48 +106,6 @@ static int qgroup_create(int create, int argc, char **argv)
return 0;
}
-static int parse_limit(const char *p, unsigned long long *s)
-{
- char *endptr;
- unsigned long long size;
-
- if (strcasecmp(p, "none") == 0) {
- *s = 0;
- return 1;
- }
- size = strtoull(p, &endptr, 10);
- switch (*endptr) {
- case 'T':
- case 't':
- size *= 1024;
- /* fallthrough */
- case 'G':
- case 'g':
- size *= 1024;
- /* fallthrough */
- case 'M':
- case 'm':
- size *= 1024;
- /* fallthrough */
- case 'K':
- case 'k':
- size *= 1024;
- ++endptr;
- break;
- case 0:
- break;
- default:
- return 0;
- }
-
- if (*endptr)
- return 0;
-
- *s = size;
-
- return 1;
-}
-
static const char * const cmd_qgroup_assign_usage[] = {
"btrfs qgroup assign <src> <dst> <path>",
"Enable subvolume qgroup support for a filesystem.",
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index a31cb1b..f0e22ac 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -42,13 +42,15 @@ static const char * const subvolume_cmd_group_usage[] = {
};
static const char * const cmd_subvol_create_usage[] = {
- "btrfs subvolume create [-i <qgroupid>] [<dest>/]<name>",
+ "btrfs subvolume create [-i <qgroupid>] [-r <max_rfer>] [-e <max_excl>] [<dest>/]<name>",
"Create a subvolume",
"Create a subvolume <name> in <dest>. If <dest> is not given",
"subvolume <name> will be created in the current directory.",
"",
"-i <qgroupid> add the newly created subvolume to a qgroup. This",
" option can be given multiple times.",
+ "-r <max_rfer> set the newly created subvolume's max reference size",
+ "-e <max_excl> set the newly created subvolume's max exclusive size",
NULL
};
@@ -66,7 +68,7 @@ static int cmd_subvol_create(int argc, char **argv)
optind = 1;
while (1) {
- int c = getopt(argc, argv, "c:i:v");
+ int c = getopt(argc, argv, "c:i:r:e:v");
if (c < 0)
break;
@@ -85,6 +87,20 @@ static int cmd_subvol_create(int argc, char **argv)
goto out;
}
break;
+ case 'r':
+ res = qgroup_inherit_set_maxrfer(&inherit, optarg);
+ if (res) {
+ retval = res;
+ goto out;
+ }
+ break;
+ case 'e':
+ res = qgroup_inherit_set_maxexcl(&inherit, optarg);
+ if (res) {
+ retval = res;
+ goto out;
+ }
+ break;
default:
usage(cmd_subvol_create_usage);
}
@@ -129,6 +145,43 @@ static int cmd_subvol_create(int argc, char **argv)
printf("Create subvolume '%s/%s'\n", dstdir, newname);
if (inherit) {
struct btrfs_ioctl_vol_args_v2 args;
+ struct btrfs_ioctl_quota_ctl_args sa;
+
+ printf("Set qgroup arguments:\n");
+ if (inherit->num_qgroups > 0) {
+ __u64 index;
+ __u64 qgroupid;
+
+ printf("\tparent qgroup: ");
+ for (index = 0; index < inherit->num_qgroups; index++) {
+ qgroupid = inherit->qgroups[index];
+ printf("%llu/%llu ", qgroupid >> 48,
+ (qgroupid << 16) >> 16);
+ }
+ printf("\n");
+ }
+ if (inherit->lim.flags) {
+ if (inherit->lim.flags & BTRFS_QGROUP_LIMIT_MAX_RFER)
+ printf("\tmax reference: %llu\n",
+ inherit->lim.max_referenced);
+ if (inherit->lim.flags & BTRFS_QGROUP_LIMIT_MAX_EXCL)
+ printf("\tmax exclusive: %llu\n",
+ inherit->lim.max_exclusive);
+ }
+
+ sa.cmd = BTRFS_QUOTA_CTL_STATUS;
+ res = ioctl(fddst, BTRFS_IOC_QUOTA_CTL, &sa);
+ if (res < 0) {
+ fprintf(stderr, "ERROR: cannot get quota status - %s\n",
+ strerror(errno));
+ retval = 1;
+ goto out;
+ }
+ if (!(sa.status & BTRFS_QUOTA_STATUS_QUOTA_ENABLED)) {
+ fprintf(stderr, "ERROR: quota disabled\n");
+ retval = 1;
+ goto out;
+ }
memset(&args, 0, sizeof(args));
strncpy_null(args.name, newname);
diff --git a/ioctl.h b/ioctl.h
index d550ca6..a47eab8 100644
--- a/ioctl.h
+++ b/ioctl.h
@@ -450,6 +450,9 @@ struct btrfs_ioctl_get_dev_stats {
/* BTRFS_IOC_SNAP_CREATE is no longer used by the btrfs command */
#define BTRFS_QUOTA_CTL_ENABLE 1
#define BTRFS_QUOTA_CTL_DISABLE 2
+#define BTRFS_QUOTA_CTL_STATUS 4
+
+#define BTRFS_QUOTA_STATUS_QUOTA_ENABLED 1
/* 3 has formerly been reserved for BTRFS_QUOTA_CTL_RESCAN */
struct btrfs_ioctl_quota_ctl_args {
__u64 cmd;
diff --git a/qgroup.c b/qgroup.c
index 5a4e393..620ec7e 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -1273,6 +1273,48 @@ err:
exit(-1);
}
+int parse_limit(const char *p, unsigned long long *s)
+{
+ char *endptr;
+ unsigned long long size;
+
+ if (strcasecmp(p, "none") == 0) {
+ *s = 0;
+ return 1;
+ }
+ size = strtoull(p, &endptr, 10);
+ switch (*endptr) {
+ case 'T':
+ case 't':
+ size *= 1024;
+ /* fallthrough */
+ case 'G':
+ case 'g':
+ size *= 1024;
+ /* fallthrough */
+ case 'M':
+ case 'm':
+ size *= 1024;
+ /* fallthrough */
+ case 'K':
+ case 'k':
+ size *= 1024;
+ ++endptr;
+ break;
+ case 0:
+ break;
+ default:
+ return 0;
+ }
+
+ if (*endptr)
+ return 0;
+
+ *s = size;
+
+ return 1;
+}
+
int qgroup_inherit_size(struct btrfs_qgroup_inherit *p)
{
return sizeof(*p) + sizeof(p->qgroups[0]) *
@@ -1302,6 +1344,8 @@ qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit, int n, int pos)
struct btrfs_qgroup_inherit *i = *inherit;
int s = sizeof(out->qgroups[0]);
+ out->flags = i->flags;
+ out->lim = i->lim;
out->num_qgroups = i->num_qgroups;
out->num_ref_copies = i->num_ref_copies;
out->num_excl_copies = i->num_excl_copies;
@@ -1378,3 +1422,51 @@ bad:
return 0;
}
+
+int qgroup_inherit_set_maxrfer(struct btrfs_qgroup_inherit **inherit, char *arg)
+{
+ unsigned long long size;
+
+ if(!parse_limit(arg, &size)) {
+ fprintf(stderr, "Invalid size argument given\n");
+ return 1;
+ }
+
+ if ((*inherit) == NULL) {
+ (*inherit) = malloc(sizeof(struct btrfs_qgroup_inherit));
+ if ((*inherit) == NULL) {
+ fprintf(stderr, "ERROR: Not enough memory\n");
+ return -ENOMEM;
+ }
+ memset((*inherit), 0, sizeof(struct btrfs_qgroup_inherit));
+ }
+
+ (*inherit)->flags |= BTRFS_QGROUP_INHERIT_SET_LIMITS;
+ (*inherit)->lim.flags |= BTRFS_QGROUP_LIMIT_MAX_RFER;
+ (*inherit)->lim.max_referenced = size;
+ return 0;
+}
+
+int qgroup_inherit_set_maxexcl(struct btrfs_qgroup_inherit **inherit, char *arg)
+{
+ unsigned long long size;
+
+ if(!parse_limit(arg, &size)) {
+ fprintf(stderr, "Invalid size argument given\n");
+ return 1;
+ }
+
+ if ((*inherit) == NULL) {
+ (*inherit) = malloc(sizeof(struct btrfs_qgroup_inherit));
+ if ((*inherit) == NULL) {
+ fprintf(stderr, "ERROR: Not enough memory\n");
+ return -ENOMEM;
+ }
+ memset((*inherit), 0, sizeof(struct btrfs_qgroup_inherit));
+ }
+
+ (*inherit)->flags |= BTRFS_QGROUP_INHERIT_SET_LIMITS;
+ (*inherit)->lim.flags |= BTRFS_QGROUP_LIMIT_MAX_EXCL;
+ (*inherit)->lim.max_exclusive = size;
+ return 0;
+}
diff --git a/qgroup.h b/qgroup.h
index 6e65ef7..e5d03ca 100644
--- a/qgroup.h
+++ b/qgroup.h
@@ -94,9 +94,12 @@ 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 parse_limit(const char *p, unsigned long long *s);
int qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg);
int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg,
int type);
+int qgroup_inherit_set_maxrfer(struct btrfs_qgroup_inherit **inherit, char *arg);
+int qgroup_inherit_set_maxexcl(struct btrfs_qgroup_inherit **inherit, char *arg);
#endif
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot.
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (2 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 2/2] btrfs-progs:set max_rfer and max_excl on creating new subvolume Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-03-02 22:10 ` Josef Bacik
2015-02-10 10:23 ` [PATCH 3/9] btrfs: qgroup: update qgroup in memory at the same time when we update it in btree Dongsheng Yang
` (6 subsequent siblings)
10 siblings, 1 reply; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
Currently, when we snapshot a subvol, snapshot will not copy the limits
from srcqgroup.
This patch make the qgroup in snapshot inherit the limit info when create
a snapshot.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/qgroup.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 97159a8..b2cee33 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2302,6 +2302,14 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
dstgroup->excl_cmpr = level_size;
srcgroup->excl = level_size;
srcgroup->excl_cmpr = level_size;
+
+ /* inherit the limit info */
+ dstgroup->lim_flags = srcgroup->lim_flags;
+ dstgroup->max_rfer = srcgroup->max_rfer;
+ dstgroup->max_excl = srcgroup->max_excl;
+ dstgroup->rsv_rfer = srcgroup->rsv_rfer;
+ dstgroup->rsv_excl = srcgroup->rsv_excl;
+
qgroup_dirty(fs_info, dstgroup);
qgroup_dirty(fs_info, srcgroup);
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/9] btrfs: qgroup: update qgroup in memory at the same time when we update it in btree.
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (3 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 4/9] btrfs: qgroup: consolidate the parameter of fucntion update_qgroup_limit_item() Dongsheng Yang
` (5 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
When we call btrfs_qgroup_inherit() with BTRFS_QGROUP_INHERIT_SET_LIMITS,
btrfs will update the limit info of qgroup in btree but forget to update
the qgroup in rbtree at the same time. It obviousely will cause an inconsistency.
This patch fix it by updating the rbtree at the same time.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/qgroup.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index b2cee33..1aae0c3 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2230,17 +2230,6 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) {
- ret = update_qgroup_limit_item(trans, quota_root, objectid,
- inherit->lim.flags,
- inherit->lim.max_rfer,
- inherit->lim.max_excl,
- inherit->lim.rsv_rfer,
- inherit->lim.rsv_excl);
- if (ret)
- goto out;
- }
-
if (srcid) {
struct btrfs_root *srcroot;
struct btrfs_key srckey;
@@ -2286,6 +2275,23 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
goto unlock;
}
+ if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) {
+ ret = update_qgroup_limit_item(trans, quota_root, objectid,
+ inherit->lim.flags,
+ inherit->lim.max_rfer,
+ inherit->lim.max_excl,
+ inherit->lim.rsv_rfer,
+ inherit->lim.rsv_excl);
+ if (ret)
+ goto unlock;
+
+ dstgroup->lim_flags = inherit->lim.flags;
+ dstgroup->max_rfer = inherit->lim.max_rfer;
+ dstgroup->max_excl = inherit->lim.max_excl;
+ dstgroup->rsv_rfer = inherit->lim.rsv_rfer;
+ dstgroup->rsv_excl = inherit->lim.rsv_excl;
+ }
+
if (srcid) {
srcgroup = find_qgroup_rb(fs_info, srcid);
if (!srcgroup)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/9] btrfs: qgroup: consolidate the parameter of fucntion update_qgroup_limit_item().
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (4 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 3/9] btrfs: qgroup: update qgroup in memory at the same time when we update it in btree Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 5/9] btrfs: qgroup: update limit info in function btrfs_run_qgroups() Dongsheng Yang
` (4 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
Cleanup: Change the parameter of update_qgroup_limit_item() to the family of
update_qgroup_xxx_item().
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/qgroup.c | 51 ++++++++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 1aae0c3..a7ffebb 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -644,9 +644,8 @@ out:
}
static int update_qgroup_limit_item(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 qgroupid,
- u64 flags, u64 max_rfer, u64 max_excl,
- u64 rsv_rfer, u64 rsv_excl)
+ struct btrfs_root *root,
+ struct btrfs_qgroup *qgroup)
{
struct btrfs_path *path;
struct btrfs_key key;
@@ -657,7 +656,7 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans,
key.objectid = 0;
key.type = BTRFS_QGROUP_LIMIT_KEY;
- key.offset = qgroupid;
+ key.offset = qgroup->qgroupid;
path = btrfs_alloc_path();
if (!path)
@@ -673,11 +672,11 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans,
l = path->nodes[0];
slot = path->slots[0];
qgroup_limit = btrfs_item_ptr(l, slot, struct btrfs_qgroup_limit_item);
- btrfs_set_qgroup_limit_flags(l, qgroup_limit, flags);
- btrfs_set_qgroup_limit_max_rfer(l, qgroup_limit, max_rfer);
- btrfs_set_qgroup_limit_max_excl(l, qgroup_limit, max_excl);
- btrfs_set_qgroup_limit_rsv_rfer(l, qgroup_limit, rsv_rfer);
- btrfs_set_qgroup_limit_rsv_excl(l, qgroup_limit, rsv_excl);
+ btrfs_set_qgroup_limit_flags(l, qgroup_limit, qgroup->lim_flags);
+ btrfs_set_qgroup_limit_max_rfer(l, qgroup_limit, qgroup->max_rfer);
+ btrfs_set_qgroup_limit_max_excl(l, qgroup_limit, qgroup->max_excl);
+ btrfs_set_qgroup_limit_rsv_rfer(l, qgroup_limit, qgroup->rsv_rfer);
+ btrfs_set_qgroup_limit_rsv_excl(l, qgroup_limit, qgroup->rsv_excl);
btrfs_mark_buffer_dirty(l);
@@ -1184,15 +1183,6 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
ret = -ENOENT;
goto out;
}
- ret = update_qgroup_limit_item(trans, quota_root, qgroupid,
- limit->flags, limit->max_rfer,
- limit->max_excl, limit->rsv_rfer,
- limit->rsv_excl);
- if (ret) {
- fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
- btrfs_info(fs_info, "unable to update quota limit for %llu",
- qgroupid);
- }
spin_lock(&fs_info->qgroup_lock);
qgroup->lim_flags = limit->flags;
@@ -1201,6 +1191,14 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
qgroup->rsv_rfer = limit->rsv_rfer;
qgroup->rsv_excl = limit->rsv_excl;
spin_unlock(&fs_info->qgroup_lock);
+
+ ret = update_qgroup_limit_item(trans, quota_root, qgroup);
+ if (ret) {
+ fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
+ btrfs_info(fs_info, "unable to update quota limit for %llu",
+ qgroupid);
+ }
+
out:
mutex_unlock(&fs_info->qgroup_ioctl_lock);
return ret;
@@ -2276,20 +2274,19 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
}
if (inherit && inherit->flags & BTRFS_QGROUP_INHERIT_SET_LIMITS) {
- ret = update_qgroup_limit_item(trans, quota_root, objectid,
- inherit->lim.flags,
- inherit->lim.max_rfer,
- inherit->lim.max_excl,
- inherit->lim.rsv_rfer,
- inherit->lim.rsv_excl);
- if (ret)
- goto unlock;
-
dstgroup->lim_flags = inherit->lim.flags;
dstgroup->max_rfer = inherit->lim.max_rfer;
dstgroup->max_excl = inherit->lim.max_excl;
dstgroup->rsv_rfer = inherit->lim.rsv_rfer;
dstgroup->rsv_excl = inherit->lim.rsv_excl;
+
+ ret = update_qgroup_limit_item(trans, quota_root, dstgroup);
+ if (ret) {
+ fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
+ btrfs_info(fs_info, "unable to update quota limit for %llu",
+ dstgroup->qgroupid);
+ goto unlock;
+ }
}
if (srcid) {
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/9] btrfs: qgroup: update limit info in function btrfs_run_qgroups().
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (5 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 4/9] btrfs: qgroup: consolidate the parameter of fucntion update_qgroup_limit_item() Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 6/9] btrfs: qgroup: fix limit args override whole limit struct Dongsheng Yang
` (3 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
When we commit_transaction(), qgroups in btree should be updated.
But, limit info is not considered currently. It will cause a problem
when a qgroup of a snapshot inherit the limit info from srcqgroup,
then there is an inconsistency.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/qgroup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index a7ffebb..953befd 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2154,6 +2154,10 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans,
if (ret)
fs_info->qgroup_flags |=
BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
+ ret = update_qgroup_limit_item(trans, quota_root, qgroup);
+ if (ret)
+ fs_info->qgroup_flags |=
+ BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
spin_lock(&fs_info->qgroup_lock);
}
if (fs_info->quota_enabled)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/9] btrfs: qgroup: fix limit args override whole limit struct
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (6 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 5/9] btrfs: qgroup: update limit info in function btrfs_run_qgroups() Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 7/9] Btrfs: qgroup: make the btree for qgroup increase from left to right Dongsheng Yang
` (2 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang, Fan Chengniang
btrfs_limit_group use arg limit to override the old qgroup_limit of
corresponding qgroup. However, we should override part of old qgroup_limit
according to the bit which has been set in arg limit.
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/qgroup.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 953befd..34717ed 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1185,11 +1185,16 @@ int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
}
spin_lock(&fs_info->qgroup_lock);
- qgroup->lim_flags = limit->flags;
- qgroup->max_rfer = limit->max_rfer;
- qgroup->max_excl = limit->max_excl;
- qgroup->rsv_rfer = limit->rsv_rfer;
- qgroup->rsv_excl = limit->rsv_excl;
+ if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_RFER)
+ qgroup->max_rfer = limit->max_rfer;
+ if (limit->flags & BTRFS_QGROUP_LIMIT_MAX_EXCL)
+ qgroup->max_excl = limit->max_excl;
+ if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_RFER)
+ qgroup->rsv_rfer = limit->rsv_rfer;
+ if (limit->flags & BTRFS_QGROUP_LIMIT_RSV_EXCL)
+ qgroup->rsv_excl = limit->rsv_excl;
+ qgroup->lim_flags |= limit->flags;
+
spin_unlock(&fs_info->qgroup_lock);
ret = update_qgroup_limit_item(trans, quota_root, qgroup);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 7/9] Btrfs: qgroup: make the btree for qgroup increase from left to right.
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (7 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 6/9] btrfs: qgroup: fix limit args override whole limit struct Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 8/9] Btrfs: qgroup: cleanup, remove an unsued parameter in btrfs_create_qgroup() Dongsheng Yang
2015-02-10 10:23 ` [PATCH 9/9] btrfs: qgroup: obtain quota status Dongsheng Yang
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
It's not a big deal, but I would rather make the btree follow the
convention to increase from left to right.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/qgroup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 34717ed..d3c261b 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -117,9 +117,9 @@ static struct btrfs_qgroup *find_qgroup_rb(struct btrfs_fs_info *fs_info,
while (n) {
qgroup = rb_entry(n, struct btrfs_qgroup, node);
if (qgroup->qgroupid < qgroupid)
- n = n->rb_left;
- else if (qgroup->qgroupid > qgroupid)
n = n->rb_right;
+ else if (qgroup->qgroupid > qgroupid)
+ n = n->rb_left;
else
return qgroup;
}
@@ -139,9 +139,9 @@ static struct btrfs_qgroup *add_qgroup_rb(struct btrfs_fs_info *fs_info,
qgroup = rb_entry(parent, struct btrfs_qgroup, node);
if (qgroup->qgroupid < qgroupid)
- p = &(*p)->rb_left;
- else if (qgroup->qgroupid > qgroupid)
p = &(*p)->rb_right;
+ else if (qgroup->qgroupid > qgroupid)
+ p = &(*p)->rb_left;
else
return qgroup;
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 8/9] Btrfs: qgroup: cleanup, remove an unsued parameter in btrfs_create_qgroup().
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (8 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 7/9] Btrfs: qgroup: make the btree for qgroup increase from left to right Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
2015-02-10 10:23 ` [PATCH 9/9] btrfs: qgroup: obtain quota status Dongsheng Yang
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/ioctl.c | 3 +--
fs/btrfs/qgroup.c | 2 +-
fs/btrfs/qgroup.h | 3 +--
fs/btrfs/tests/qgroup-tests.c | 4 ++--
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d49fe8a..658d83d 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4669,8 +4669,7 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
/* FIXME: check if the IDs really exist */
if (sa->create) {
- ret = btrfs_create_qgroup(trans, root->fs_info, sa->qgroupid,
- NULL);
+ ret = btrfs_create_qgroup(trans, root->fs_info, sa->qgroupid);
} else {
ret = btrfs_remove_qgroup(trans, root->fs_info, sa->qgroupid);
}
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index d3c261b..24c5bb1 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1094,7 +1094,7 @@ out:
}
int btrfs_create_qgroup(struct btrfs_trans_handle *trans,
- struct btrfs_fs_info *fs_info, u64 qgroupid, char *name)
+ struct btrfs_fs_info *fs_info, u64 qgroupid)
{
struct btrfs_root *quota_root;
struct btrfs_qgroup *qgroup;
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
index 18cc68c..c5242aa 100644
--- a/fs/btrfs/qgroup.h
+++ b/fs/btrfs/qgroup.h
@@ -70,8 +70,7 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans,
int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 src, u64 dst);
int btrfs_create_qgroup(struct btrfs_trans_handle *trans,
- struct btrfs_fs_info *fs_info, u64 qgroupid,
- char *name);
+ struct btrfs_fs_info *fs_info, u64 qgroupid);
int btrfs_remove_qgroup(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 qgroupid);
int btrfs_limit_qgroup(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c
index ec3dcb2..bcc1c7a 100644
--- a/fs/btrfs/tests/qgroup-tests.c
+++ b/fs/btrfs/tests/qgroup-tests.c
@@ -232,7 +232,7 @@ static int test_no_shared_qgroup(struct btrfs_root *root)
init_dummy_trans(&trans);
test_msg("Qgroup basic add\n");
- ret = btrfs_create_qgroup(NULL, fs_info, 5, NULL);
+ ret = btrfs_create_qgroup(NULL, fs_info, 5);
if (ret) {
test_msg("Couldn't create a qgroup %d\n", ret);
return ret;
@@ -301,7 +301,7 @@ static int test_multiple_refs(struct btrfs_root *root)
test_msg("Qgroup multiple refs test\n");
/* We have 5 created already from the previous test */
- ret = btrfs_create_qgroup(NULL, fs_info, 256, NULL);
+ ret = btrfs_create_qgroup(NULL, fs_info, 256);
if (ret) {
test_msg("Couldn't create a qgroup %d\n", ret);
return ret;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 9/9] btrfs: qgroup: obtain quota status
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
` (9 preceding siblings ...)
2015-02-10 10:23 ` [PATCH 8/9] Btrfs: qgroup: cleanup, remove an unsued parameter in btrfs_create_qgroup() Dongsheng Yang
@ 2015-02-10 10:23 ` Dongsheng Yang
10 siblings, 0 replies; 15+ messages in thread
From: Dongsheng Yang @ 2015-02-10 10:23 UTC (permalink / raw)
To: linux-btrfs; +Cc: Fan Chengniang
From: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
add a function to obtain quota status. Now it can only get
whether quota is enabled. We can extend the function to get
more quota status
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
---
fs/btrfs/ioctl.c | 6 ++++++
fs/btrfs/qgroup.c | 14 ++++++++++++++
fs/btrfs/qgroup.h | 3 +++
include/uapi/linux/btrfs.h | 3 +++
4 files changed, 26 insertions(+)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 658d83d..f6e730b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4572,6 +4572,12 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
case BTRFS_QUOTA_CTL_DISABLE:
ret = btrfs_quota_disable(trans, root->fs_info);
break;
+ case BTRFS_QUOTA_CTL_STATUS:
+ ret = btrfs_quota_status(trans, root->fs_info, sa);
+ if (!ret)
+ if (copy_to_user(arg, sa, sizeof(*sa)))
+ ret = -EFAULT;
+ break;
default:
ret = -EINVAL;
break;
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 24c5bb1..b57fe45 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -993,6 +993,20 @@ out:
return ret;
}
+int btrfs_quota_status(struct btrfs_trans_handle *trans,
+ struct btrfs_fs_info *fs_info,
+ struct btrfs_ioctl_quota_ctl_args *sa)
+{
+ int ret = 0;
+
+ if (fs_info->quota_enabled)
+ sa->status |= BTRFS_QUOTA_STATUS_QUOTA_ENABLED;
+ else
+ sa->status &= ~BTRFS_QUOTA_STATUS_QUOTA_ENABLED;
+
+ return ret;
+}
+
static void qgroup_dirty(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup *qgroup)
{
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
index c5242aa..52d8b19 100644
--- a/fs/btrfs/qgroup.h
+++ b/fs/btrfs/qgroup.h
@@ -62,6 +62,9 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info);
int btrfs_quota_disable(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info);
+int btrfs_quota_status(struct btrfs_trans_handle *trans,
+ struct btrfs_fs_info *fs_info,
+ struct btrfs_ioctl_quota_ctl_args *sa);
int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info);
void btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info);
int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info);
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 611e1c5..d4014e6 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -423,6 +423,9 @@ struct btrfs_ioctl_get_dev_stats {
#define BTRFS_QUOTA_CTL_ENABLE 1
#define BTRFS_QUOTA_CTL_DISABLE 2
#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
+#define BTRFS_QUOTA_CTL_STATUS 4
+
+#define BTRFS_QUOTA_STATUS_QUOTA_ENABLED 1
struct btrfs_ioctl_quota_ctl_args {
__u64 cmd;
__u64 status;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] btrfs-progs:correct the return value
2015-02-10 10:23 ` [PATCH 1/2] btrfs-progs:correct the return value Dongsheng Yang
@ 2015-02-27 15:37 ` David Sterba
0 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2015-02-27 15:37 UTC (permalink / raw)
To: Dongsheng Yang; +Cc: linux-btrfs, Fan Chengniang
On Tue, Feb 10, 2015 at 06:23:13PM +0800, Dongsheng Yang wrote:
> From: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
>
> the return values 12 and 13 are not used spectially except as
> return value. No description and definition about them. so I
> change them to generic errno
>
> Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location.
2015-02-10 10:23 ` [PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location Dongsheng Yang
@ 2015-03-02 22:05 ` Josef Bacik
0 siblings, 0 replies; 15+ messages in thread
From: Josef Bacik @ 2015-03-02 22:05 UTC (permalink / raw)
To: Dongsheng Yang, linux-btrfs
On 02/10/2015 05:23 AM, Dongsheng Yang wrote:
> In function qgroup_excl_accounting(), we need to WARN when
> qg->excl is less than what we want to free, same to child
> and parents. But currently, for parent qgroup, the WARN_ON()
> is located after freeing qg->excl. It will WARN out even we
> free it normally.
>
> This patch move this WARN_ON() before freeing qg->excl.
>
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot.
2015-02-10 10:23 ` [PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot Dongsheng Yang
@ 2015-03-02 22:10 ` Josef Bacik
0 siblings, 0 replies; 15+ messages in thread
From: Josef Bacik @ 2015-03-02 22:10 UTC (permalink / raw)
To: Dongsheng Yang, linux-btrfs
On 02/10/2015 05:23 AM, Dongsheng Yang wrote:
> Currently, when we snapshot a subvol, snapshot will not copy the limits
> from srcqgroup.
>
> This patch make the qgroup in snapshot inherit the limit info when create
> a snapshot.
>
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2015-03-02 22:10 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 10:23 [PATCH 0/9] Btrfs: qgroup: part-1: bug fixes for qgroup inherit Dongsheng Yang
2015-02-10 10:23 ` [PATCH 1/2] btrfs-progs:correct the return value Dongsheng Yang
2015-02-27 15:37 ` David Sterba
2015-02-10 10:23 ` [PATCH 1/9] btrfs: qgroup: move WARN_ON() to the correct location Dongsheng Yang
2015-03-02 22:05 ` Josef Bacik
2015-02-10 10:23 ` [PATCH 2/2] btrfs-progs:set max_rfer and max_excl on creating new subvolume Dongsheng Yang
2015-02-10 10:23 ` [PATCH 2/9] btrfs: qgroup: inherit limit info from srcgroup in creating snapshot Dongsheng Yang
2015-03-02 22:10 ` Josef Bacik
2015-02-10 10:23 ` [PATCH 3/9] btrfs: qgroup: update qgroup in memory at the same time when we update it in btree Dongsheng Yang
2015-02-10 10:23 ` [PATCH 4/9] btrfs: qgroup: consolidate the parameter of fucntion update_qgroup_limit_item() Dongsheng Yang
2015-02-10 10:23 ` [PATCH 5/9] btrfs: qgroup: update limit info in function btrfs_run_qgroups() Dongsheng Yang
2015-02-10 10:23 ` [PATCH 6/9] btrfs: qgroup: fix limit args override whole limit struct Dongsheng Yang
2015-02-10 10:23 ` [PATCH 7/9] Btrfs: qgroup: make the btree for qgroup increase from left to right Dongsheng Yang
2015-02-10 10:23 ` [PATCH 8/9] Btrfs: qgroup: cleanup, remove an unsued parameter in btrfs_create_qgroup() Dongsheng Yang
2015-02-10 10:23 ` [PATCH 9/9] btrfs: qgroup: obtain quota status Dongsheng Yang
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).