linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Josef Bacik <jbacik@fusionio.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: fix what bits we clear when erroring out from delalloc
Date: Fri, 2 Aug 2013 19:29:23 -0400	[thread overview]
Message-ID: <20130802232923.GF2372@localhost.localdomain> (raw)
In-Reply-To: <51FB8501.80605@cn.fujitsu.com>

On Fri, Aug 02, 2013 at 06:08:01PM +0800, Miao Xie wrote:
> Hi, Josef
> 
> On Tue, 30 Jul 2013 14:27:40 +0800, Miao Xie wrote:
> >>  			extent_clear_unlock_delalloc(inode, start, end, NULL,
> >> -						     EXTENT_DIRTY |
> >> -						     EXTENT_DELALLOC,
> >> +						     EXTENT_DELALLOC |
> >> +						     EXTENT_DO_ACCOUNTING |
> >> +						     EXTENT_DEFRAG,
> >>  						     PAGE_UNLOCK |
> >>  						     PAGE_CLEAR_DIRTY |
> >>  						     PAGE_SET_WRITEBACK |
> > 
> > I found we released the reserved space in cow_file_range_inline(), but at that time,
> > we didn't drop the outstanding_extents counter by the number of the delalloc extents,
> > so it might leave some reserved space which was not released. So I think we should remove
> > the release function in cow_file_range_inline().
> > 
> > (This bug is not introduced by your patch. but if we don't fix the above problem before
> >  applying your patch, the double release would happen because we have released the space
> >  in cow_file_range_inline())
> 
> I'm sorry that I made a mistake, the problem I said above doesn't exist because the block
> size is equal to the page size, and we can only inline the file extent which is <= the page size,
> so it is unlikely that one inline extent has two extent state objects.
> 
> But the double release of the reserved space exists actually. We can fix by removing the release
> function in cow_file_range_inline() and passing EXTENT_DO_ACCOUNTING to the clear function.
>

Sorry I meant to send a v2, but what I've committed isn't actually this.  We
need DO_ACCOUNTING if ret < 0 but not if ret == 0, so I've changed this to take
that into account since cow_file_range_inline does do the accounting as you say.
Thanks,

Josef 

      reply	other threads:[~2013-08-02 23:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 17:24 [PATCH] Btrfs: fix what bits we clear when erroring out from delalloc Josef Bacik
2013-07-30  6:27 ` Miao Xie
2013-08-02 10:08   ` Miao Xie
2013-08-02 23:29     ` Josef Bacik [this message]

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=20130802232923.GF2372@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.com \
    /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).