From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/3] xfs: byte range granularity for XFS_IOC_ZERO_RANGE
Date: Fri, 23 Nov 2012 19:59:30 +1100 [thread overview]
Message-ID: <20121123085930.GF32450@dastard> (raw)
In-Reply-To: <20121123083403.GB24938@infradead.org>
On Fri, Nov 23, 2012 at 03:34:03AM -0500, Christoph Hellwig wrote:
> On Fri, Nov 23, 2012 at 02:24:25PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > XFS_IOC_ZERO_RANGE simply does not work properly for non page cache
> > aligned ranges. Neither test 242 or 290 exercise this correctly, so
> > the behaviour is completely busted even though the tests pass.
> >
> > Fix it to support full byte range granularity as was originally
> > intended for this ioctl.
>
> Looks good, but a couple cosmetic comments below:
>
> > + rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
>
> I'd call this granularity.
OK. I just copied that from the hole punch code. ;)
> > + /* round the range iof extents we are going to convert inwards */
> > + start = round_up(offset, rounding);
> > + end = round_down(offset + len, rounding);
>
> start_boundary, end_boundary?
OK.
> > + if (start < end - 1) {
> > + /* punch out the page cache over the conversion range */
> > + truncate_pagecache_range(VFS_I(ip), start, end - 1);
> > + /* convert the blocks */
> > + error = xfs_alloc_file_space(ip, start, end - start - 1,
> > + XFS_BMAPI_PREALLOC | XFS_BMAPI_CONVERT,
> > + attr_flags);
> > + if (error)
> > + goto out_unlock;
> > + } else {
> > + /* it's a sub-rounding range */
> > + ASSERT(offset + len <= start);
> > + error = xfs_iozero(ip, offset, len);
> > + goto out_unlock;
> > + }
> > +
> > + /* now we've handled the interior of the range, handle the edges */
> > + if (start != offset)
> > + error = xfs_iozero(ip, offset, start - offset);
> > + if (!error && end != offset + len)
> > + error = xfs_iozero(ip, end, offset + len - end);
>
> I'd move the edge iozero calls into the if branch, that gives a natural
> code flow and avoids the goto unlock in the sub-page case.
Sure. I added the sub-page case after the edge cases when I realised
the edge cases didn't handle that. I'll rework it.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2012-11-23 8:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 3:24 [PATCH 0/3, V2] xfs: regression fixes for the 3.8 cycle Dave Chinner
2012-11-23 3:24 ` [PATCH 1/3] xfs: inode allocation should use unmapped buffers Dave Chinner
2012-11-26 19:07 ` Mark Tinguely
2012-11-26 22:12 ` Ben Myers
2012-11-26 23:00 ` Dave Chinner
2012-11-23 3:24 ` [PATCH 2/3] xfs: fix direct IO nested transaction deadlock Dave Chinner
2012-11-23 8:31 ` Christoph Hellwig
2012-11-26 15:54 ` Mark Tinguely
2012-11-26 21:45 ` Dave Chinner
2012-11-27 22:46 ` Mark Tinguely
2012-11-28 0:14 ` Dave Chinner
2012-11-23 3:24 ` [PATCH 3/3] xfs: byte range granularity for XFS_IOC_ZERO_RANGE Dave Chinner
2012-11-23 8:34 ` Christoph Hellwig
2012-11-23 8:59 ` Dave Chinner [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=20121123085930.GF32450@dastard \
--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 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.