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/3] btrfs: qgroup: destroy related qgroup when removing subvolume if needed.
Date: Thu, 22 Jan 2015 13:46:22 +0800 [thread overview]
Message-ID: <1421905582-4539-3-git-send-email-yangds.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1421905582-4539-1-git-send-email-yangds.fnst@cn.fujitsu.com>
When removing a subvol, if the related qgroup has no child qgroup, we should destroy
it at the same time. Also remove the TODO entry in qgroup.c.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
fs/btrfs/inode.c | 4 ++++
fs/btrfs/qgroup.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e687bb0..31de211 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -59,6 +59,7 @@
#include "backref.h"
#include "hash.h"
#include "props.h"
+#include "qgroup.h"
struct btrfs_iget_args {
struct btrfs_key *location;
@@ -4029,6 +4030,9 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
ret = btrfs_update_inode_fallback(trans, root, dir);
if (ret)
btrfs_abort_transaction(trans, root, ret);
+ ret = btrfs_remove_qgroup(trans, root->fs_info, objectid);
+ if (ret == -EBUSY)
+ ret = 0;
out:
btrfs_free_path(path);
return ret;
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index c3b1e4f..303c078 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -35,7 +35,6 @@
#include "qgroup.h"
/* TODO XXX FIXME
- * - subvol delete -> delete when ref goes to 0? delete limits also?
* - reorganize keys
* - compressed
* - sync
--
1.8.4.2
next prev parent reply other threads:[~2015-01-22 5:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 5:46 [PATCH 1/3] btrfs: qgroup: return EINVAL if level of parent is not higher than child's Dongsheng Yang
2015-01-22 5:46 ` [PATCH 2/3] btrfs: qgroup: allow user to remove qgroup which has parent but no child Dongsheng Yang
2015-01-22 5:46 ` Dongsheng Yang [this message]
2015-01-22 6:16 ` [PATCH 3/3] btrfs: qgroup: destroy related qgroup when removing subvolume if needed Wang Shilong
2015-01-22 9:46 ` 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=1421905582-4539-3-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).