From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/3] xfs: truncate delalloc extents when IO fails in writeback
Date: Fri, 5 Mar 2010 09:03:09 +1100 [thread overview]
Message-ID: <20100304220309.GI14317@discord.disaster> (raw)
In-Reply-To: <20100304142851.GA19157@infradead.org>
On Thu, Mar 04, 2010 at 09:28:51AM -0500, Christoph Hellwig wrote:
> On Thu, Mar 04, 2010 at 12:46:24PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > We currently use block_invalidatepage() to clean up pages where I/O
> > fails in ->writepage(). Unfortunately, if the page has delalloc
> > regions on it, we fail to remove the delalloc regions when we
> > invalidate the page. This can result in tripping a BUG() in
> > xfs_get_blocks() later on if a direct IO read is done on that same
> > region - the delalloc extent is returned when none is supposed to be
> > there.
> >
> > Fix this by truncating away the delalloc regions on the page before
> > invalidating it. Because they are delalloc, we can do this without
> > needing a transaction. Indeed - if we get ENOSPC errors, we have to
> > be able to do this truncation without a transaction as there is
> > no space left for block reservation (typically why we see a ENOSPC
> > in writeback).
>
> The code looks good to me, but it could use a bit more documentation
> from the page description above inside the code.
Good point. I'll add some comments to it...
> > +static void
> > +xfs_aops_discard_page(
>
> This seems like a prime candidate for STATIC to make sure the
> over-eager compiler doesn't inline it into xfs_page_state_convert.
Will do.
> > - cur->bc_private.b.firstblock = *firstblock;
> > + cur->bc_private.b.firstblock = firstblock ?
> > + *firstblock : NULLFSBLOCK;
> > cur->bc_private.b.flist = flist;
> > cur->bc_private.b.flags = 0;
> > } else
> > @@ -5503,7 +5504,8 @@ error0:
> > xfs_trans_log_inode(tp, ip, logflags);
> > if (cur) {
> > if (!error) {
> > - *firstblock = cur->bc_private.b.firstblock;
> > + if (firstblock)
> > + *firstblock = cur->bc_private.b.firstblock;
>
> I don't think it's a good idea to throw this change in as part of
> this patch. I'd rather throw in the xfs_bmap_init and two
> useless arguments for now and clean up the calling conventions later.
> For which is more than enough opportunity, e.g. there's a totally
> unused delta argument in xfs_bunmapi.
I was undecided about which method to use. In the end I went with
the above because it was easier to check that correct behaviour was
occurring. i.e. if firstblock get used, then I'd see a panic. I'll
switch it to the variable method, and try to find the right
combination of ASSERT() calls to make sure it hasn't been used.
Thanks Christoph.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-03-04 22:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 1:46 [PATCH 0/3] xfs: delayed allocation @ ENOSPC fixes Dave Chinner
2010-03-04 1:46 ` [PATCH 1/3] xfs: check for more work before sleeping in xfssyncd Dave Chinner
2010-03-04 13:50 ` Christoph Hellwig
2010-03-04 22:56 ` Dave Chinner
2010-03-04 1:46 ` [PATCH 2/3] xfs: truncate delalloc extents when IO fails in writeback Dave Chinner
2010-03-04 14:28 ` Christoph Hellwig
2010-03-04 22:03 ` Dave Chinner [this message]
2010-03-05 2:00 ` [PATCH v2] " Dave Chinner
2010-03-05 9:21 ` Christoph Hellwig
2010-03-10 9:12 ` [PATCH 2/3] " Christoph Hellwig
2010-03-10 12:52 ` Dave Chinner
2010-03-10 18:18 ` Christoph Hellwig
2010-03-04 1:46 ` [PATCH 3/3] xfs: Increase the default size of the reserved blocks pool Dave Chinner
2010-03-05 15:45 ` Alex Elder
2010-03-05 23:26 ` Dave Chinner
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=20100304220309.GI14317@discord.disaster \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.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