linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Subject: [PATCH 3/7] btrfs: qgroup: Apply type to btrfs_qgroup_inherit().
Date: Tue, 10 Feb 2015 18:24:17 +0800	[thread overview]
Message-ID: <1423563862-9151-7-git-send-email-yangds.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1423563862-9151-1-git-send-email-yangds.fnst@cn.fujitsu.com>

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.fnst@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


  parent reply	other threads:[~2015-02-10 10:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 10:24 [RFC PATCH 0/7] Btrfs: qgroup: part-4: Add type to btrfs qgroup Dongsheng Yang
2015-02-10 10:24 ` [PATCH 1/4] btrfs-progs: Add type to qgroup Dongsheng Yang
2015-02-10 10:24 ` [PATCH 1/7] Btrfs: qgroup: Add type to btrfs_qgroup Dongsheng Yang
2015-02-10 10:24 ` [PATCH 2/4] btrfs-progs: specify qgroup type when creating subvolume Dongsheng Yang
2015-02-10 10:24 ` [PATCH 2/7] btrfs: qgroup: apply type to the recording and accounting Dongsheng Yang
2015-02-10 10:24 ` [PATCH 3/4] btrfs-progs:specify qgroup type when creating qgroup Dongsheng Yang
2015-02-10 10:24 ` Dongsheng Yang [this message]
2015-02-10 10:24 ` [PATCH 4/4] btrfs-progs:show qgroup type Dongsheng Yang
2015-02-10 10:24 ` [PATCH 4/7] btrfs: qgroup: Apply qgroup type to qgroup creating Dongsheng Yang
2015-02-10 10:24 ` [PATCH 5/7] btrfs: qgroup: Apply qgroup type to subvol creating Dongsheng Yang
2015-02-10 10:24 ` [PATCH 6/7] btrfs: qgroup: apply type to quota rescan Dongsheng Yang
2015-02-10 10:24 ` [PATCH 7/7] btrfs: qgroup: fix a bug when type of parent is different with child's Dongsheng Yang
2015-03-04  1:49 ` [RFC PATCH 0/7] Btrfs: qgroup: part-4: Add type to btrfs qgroup Dongsheng Yang
2015-03-17 10:08 ` Dongsheng Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423563862-9151-7-git-send-email-yangds.fnst@cn.fujitsu.com \
    --to=yangds.fnst@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).