All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <clm@fb.com>
To: Mark Fasheh <mfasheh@suse.de>, <linux-btrfs@vger.kernel.org>
Cc: Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH 2/5] btrfs: qgroup: account shared subtrees during snapshot delete
Date: Tue, 12 Aug 2014 14:22:31 -0400	[thread overview]
Message-ID: <53EA5B67.7040109@fb.com> (raw)
In-Reply-To: <1405625944-4883-3-git-send-email-mfasheh@suse.de>



On 07/17/2014 03:39 PM, Mark Fasheh wrote:
> During its tree walk, btrfs_drop_snapshot() will skip any shared
> subtrees it encounters. This is incorrect when we have qgroups
> turned on as those subtrees need to have their contents
> accounted. In particular, the case we're concerned with is when
> removing our snapshot root leaves the subtree with only one root
> reference.
> 
> In those cases we need to find the last remaining root and add
> each extent in the subtree to the corresponding qgroup exclusive
> counts.
> 
> This patch implements the shared subtree walk and a new qgroup
> operation, BTRFS_QGROUP_OPER_SUB_SUBTREE. When an operation of
> this type is encountered during qgroup accounting, we search for
> any root references to that extent and in the case that we find
> only one reference left, we go ahead and do the math on it's
> exclusive counts.
> 
> Signed-off-by: Mark Fasheh <mfasheh@suse.de>
> Reviewed-by: Josef Bacik <jbacik@fb.com>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 813537f..1aa4325 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -8078,6 +8331,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
>  	}
>  	root_dropped = true;
>  out_end_trans:
> +	ret = btrfs_delayed_qgroup_accounting(trans, root->fs_info);
                                                     ^^^^^^^^^^^

CONFIG_DEBUG_PAGEALLOC noticed that root is already free at this point.
 I switched it to tree_root instead ;)

-chris

  reply	other threads:[~2014-08-12 18:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 19:38 [PATCH 0/5] btrfs: qgroup fixes for btrfs_drop_snapshot V5 Mark Fasheh
2014-07-17 19:39 ` [PATCH 1/5] btrfs: add trace for qgroup accounting Mark Fasheh
2014-07-17 19:39 ` [PATCH 2/5] btrfs: qgroup: account shared subtrees during snapshot delete Mark Fasheh
2014-08-12 18:22   ` Chris Mason [this message]
2014-08-12 18:32     ` Mark Fasheh
2014-08-12 18:36       ` Chris Mason
2014-08-12 19:01         ` Mark Fasheh
2014-08-12 19:08           ` Chris Mason
2014-07-17 19:39 ` [PATCH 3/5] Btrfs: __btrfs_mod_ref should always use no_quota Mark Fasheh
2014-07-17 19:39 ` [PATCH 4/5] btrfs: delete qgroup items in drop_snapshot Mark Fasheh
2014-07-17 19:39 ` [PATCH 5/5] btrfs: correctly handle return from ulist_add Mark Fasheh

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=53EA5B67.7040109@fb.com \
    --to=clm@fb.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mfasheh@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.