All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: Arne Jansen <sensille@gmx.net>
Cc: Josef Bacik <JBacik@fusionio.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"daniel@quora.org" <daniel@quora.org>,
	"Chris L. Mason" <clmason@fusionio.com>,
	"list.btrfs@jan-o-sch.net" <list.btrfs@jan-o-sch.net>
Subject: Re: [PATCH] Btrfs: allow delayed refs to be merged
Date: Tue, 10 Jul 2012 15:52:16 -0400	[thread overview]
Message-ID: <20120710195216.GG7529@localhost.localdomain> (raw)
In-Reply-To: <4FFC84FE.7000302@gmx.net>

On Tue, Jul 10, 2012 at 01:39:42PM -0600, Arne Jansen wrote:
> On 07/10/2012 08:52 PM, Josef Bacik wrote:
> > Daniel Blueman reported a bug with fio+balance on a ramdisk setup.
> > Basically what happens is the balance relocates a tree block which will drop
> > the implicit refs for all of its children and adds a full backref.  Once the
> > block is relocated we have to add the implicit refs back, so when we cow the
> > block again we add the implicit refs for its children back.  The problem
> > comes when the original drop ref doesn't get run before we add the implicit
> > refs back.  The delayed ref stuff will specifically prefer ADD operations
> > over DROP to keep us from freeing up an extent that will have references to
> > it, so we try to add the implicit ref before it is actually removed and we
> > panic.  This worked fine before because the add would have just canceled the
> > drop out and we would have been fine.  But the backref walking work needs to
> > be able to freeze the delayed ref stuff in time so we have this ever
> > increasing sequence number that gets attached to all new delayed ref updates
> > which makes us not merge refs and we run into this issue.
> >
> > So since the backref walking stuff doesn't get run all that often we just
> > ignore the sequence updates until somebody actually tries to do the freeze.
> > Then if we try to run the delayed refs we go back and try to merge them in
> > case we get a sequence like this again so we do not panic.
> 
> Subvolume quota will also use it, so it might get used _very_ often.
> Please give me some time to understand the problem deeper. This patch
> adds a lot of complexity, and I'd prefer to find a solution that adds
> none :)
> 

If you've got a better idea then go for it, but I'm coming up short.  One way or
another we need these operations to cancel out of they are both on the same ref
head at the same time.  We may be able to do something like make sure the full
backrefs are added first, then let implicit ref deletes happen, and then let
implicit ref adds happen, but then you are adding even more weird logic to what
can be run when.

The other option is to make relocate not do this dance at all, and I'm not
entirely sure how you would go about this.  I think we are ok leaving the
implicit ref because frankly the children all still belong to the original root,
but I don't understand the relocate code enough to decide if thats ok.  Thanks,

Josef

  reply	other threads:[~2012-07-10 19:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 18:52 [PATCH] Btrfs: allow delayed refs to be merged Josef Bacik
2012-07-10 19:39 ` Arne Jansen
2012-07-10 19:52   ` Josef Bacik [this message]
2012-07-11 13:19 ` Jan Schmidt
2012-07-12 17:05   ` Josef Bacik
2012-07-12 18:41     ` Jan Schmidt

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=20120710195216.GG7529@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=clmason@fusionio.com \
    --cc=daniel@quora.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=list.btrfs@jan-o-sch.net \
    --cc=sensille@gmx.net \
    /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.