Now, we have a type in each qgroup, then when we do a inherit(),
we need to consider the type of qgroup to decide account metadata
or not.

Signed-off-by: Dongsheng Yang <yangds.f...@cn.fujitsu.com>
---
 fs/btrfs/qgroup.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 2fa8497..0129dae 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2382,10 +2382,20 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle 
*trans,
                dstgroup->type = srcgroup->type;
                dstgroup->rfer = srcgroup->rfer;
                dstgroup->rfer_cmpr = srcgroup->rfer_cmpr;
-               dstgroup->excl = level_size;
-               dstgroup->excl_cmpr = level_size;
-               srcgroup->excl = level_size;
-               srcgroup->excl_cmpr = level_size;
+               if (dstgroup->type & BTRFS_QGROUP_TYPE_METADATA) {
+                       dstgroup->excl = level_size;
+                       dstgroup->excl_cmpr = level_size;
+               } else {
+                       dstgroup->excl = 0;
+                       dstgroup->excl_cmpr = 0;
+               }
+               if (srcgroup->type & BTRFS_QGROUP_TYPE_METADATA) {
+                       srcgroup->excl = level_size;
+                       srcgroup->excl_cmpr = level_size;
+               } else {
+                       srcgroup->excl = 0;
+                       srcgroup->excl_cmpr = 0;
+               }
 
                /* inherit the limit info */
                dstgroup->lim_flags = srcgroup->lim_flags;
-- 
1.8.4.2

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

Reply via email to