All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Stefan Behrens <sbehrens@giantdisaster.de>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 4/8] Btrfs: maintain subvolume items in the UUID tree
Date: Thu, 16 May 2013 09:50:37 +0800	[thread overview]
Message-ID: <20130516015031.GD20202@liubo.jp.oracle.com> (raw)
In-Reply-To: <5193AC37.6080609@giantdisaster.de>

On Wed, May 15, 2013 at 05:39:35PM +0200, Stefan Behrens wrote:
> On Tue, 14 May 2013 18:44:11 +0800, Liu Bo wrote:
> > On Tue, May 14, 2013 at 11:36:56AM +0200, Stefan Behrens wrote:
> >> @@ -396,7 +403,7 @@ static noinline int create_subvol(struct inode *dir,
> >>  	 * of create_snapshot().
> >>  	 */
> >>  	ret = btrfs_subvolume_reserve_metadata(root, &block_rsv,
> >> -					       7, &qgroup_reserved);
> >> +					       8, &qgroup_reserved);
> >>  	if (ret)
> >>  		return ret;
> > 
> > This uuid_root will not use trans->block_rsv but empty_rsv since it does not set
> > ref_cow, so you don't need to add one more to block_rsv, and same for
> > the below cases.
> 
> Hi Liu Bo,
> 
> Thanks for your review comments!
> 
> You are right, this won't work because the empty_block_rsv is used for
> the UUID tree as it is now.
> 
> I need to avoid ENOSPC in the middle of the transaction. Can you please
> acknowledge or comment the following addition to get_block_rsv()? And
> the "plus 1" that I have added to the transaction reservations for
> subvolume/snapshot creation/destruction will work correctly afterwards.

Looks good.

(Although I'm more looking forward to Josef's metadata enospc killer
patch, that way we won't ever need to deal with all of this buggy stuff ;))

thanks,
liubo

> 
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4259,6 +4259,9 @@ static struct btrfs_block_rsv *get_block_rsv(
>         if (root == root->fs_info->csum_root && trans->adding_csums)
>                 block_rsv = trans->block_rsv;
> 
> +       if (root == root->fs_info->uuid_root)
> +               block_rsv = trans->block_rsv;
> +
>         if (!block_rsv)
>                 block_rsv = root->block_rsv;
> 
> 
> 
> >> @@ -567,9 +578,10 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
> >>  	 * 1 - root item
> >>  	 * 2 - root ref/backref
> >>  	 * 1 - root of snapshot
> >> +	 * 1 - UUID item
> >>  	 */
> >>  	ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root,
> >> -					&pending_snapshot->block_rsv, 7,
> >> +					&pending_snapshot->block_rsv, 8,
> >>  					&pending_snapshot->qgroup_reserved);
> >>  	if (ret)
> >>  		goto out;
> 

  reply	other threads:[~2013-05-16  1:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14  9:36 [PATCH v2 0/8] Btrfs: introduce a tree for UUID to subvol ID mapping Stefan Behrens
2013-05-14  9:36 ` [PATCH v2 1/8] Btrfs: introduce a tree for items that map UUIDs to something Stefan Behrens
2013-05-16  6:35   ` Liu Bo
2013-05-14  9:36 ` [PATCH v2 2/8] Btrfs: support printing UUID tree elements Stefan Behrens
2013-05-14  9:36 ` [PATCH v2 3/8] Btrfs: create UUID tree if required Stefan Behrens
2013-05-14 10:45   ` Liu Bo
2013-05-14  9:36 ` [PATCH v2 4/8] Btrfs: maintain subvolume items in the UUID tree Stefan Behrens
2013-05-14 10:44   ` Liu Bo
2013-05-15 15:39     ` Stefan Behrens
2013-05-16  1:50       ` Liu Bo [this message]
2013-05-14  9:36 ` [PATCH v2 5/8] Btrfs: fill UUID tree initially Stefan Behrens
2013-05-14  9:36 ` [PATCH v2 6/8] Btrfs: introduce uuid-tree-gen field Stefan Behrens
2013-05-14  9:36 ` [PATCH v2 7/8] Btrfs: check UUID tree during mount if required Stefan Behrens
2013-05-14  9:37 ` [PATCH v2 8/8] Btrfs: add mount option to force UUID tree checking Stefan Behrens
2013-05-14 10:55 ` [PATCH v2 0/8] Btrfs: introduce a tree for UUID to subvol ID mapping Liu Bo
2013-05-14 17:11   ` Stefan Behrens
2013-05-15  8:52     ` Stefan Behrens
2013-05-15 13:12     ` David Sterba

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=20130516015031.GD20202@liubo.jp.oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sbehrens@giantdisaster.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.