public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Mark Tinguely <tinguely@sgi.com>
Cc: jeff.liu@oracle.com, xfs@oss.sgi.com
Subject: Re: [PATCH v7 2/4] xfs: Introduce a helper routine to probe data or hole offset from page cache
Date: Tue, 21 Aug 2012 09:08:33 +1000	[thread overview]
Message-ID: <20120820230833.GI19235@dastard> (raw)
In-Reply-To: <5032583F.6050207@sgi.com>

On Mon, Aug 20, 2012 at 10:31:11AM -0500, Mark Tinguely wrote:
> On 08/13/12 08:07, Jeff Liu wrote:
> >helper routine to lookup data or hole offset from page cache for unwritten extents.
> >
> >Signed-off-by: Jie Liu<jeff.liu@oracle.com>
> >
> >---
> >  fs/xfs/xfs_file.c |  213 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 213 insertions(+), 0 deletions(-)
> >+STATIC bool
> >+xfs_find_get_desired_pgoff(
> >+	struct inode		*inode,
> >+	struct xfs_bmbt_irec	*map,
> >+	unsigned int		type,
> >+	loff_t			*offset)
> >+{
> 
> ...
> 
> >+		for (i = 0; i<  nr_pages; i++) {
> >+			struct page	*page = pvec.pages[i];
> >+			loff_t		b_offset;
> >+
> >+			/*
> >+			 * Page index is out of range, searching done.
> >+			 * If the current offset is not reaches the end
> >+			 * of the specified search range, there should
> >+			 * be a hole between them.
> >+			 */
> >+			if (page->index>  end) {
> 
> Shouldn't this sample of the index also be locked?

You can check it before the page is locked for being beyond EOF, but
it still needs to be checked again after the page is locked as it
can change between this check and the page being locked.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-08-20 23:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 13:07 [PATCH v7 2/4] xfs: Introduce a helper routine to probe data or hole offset from page cache Jeff Liu
2012-08-20 15:31 ` Mark Tinguely
2012-08-20 23:08   ` Dave Chinner [this message]
2012-08-21  4:54   ` Jie Liu
2012-08-21  5:25     ` Dave Chinner
2012-08-21  6:41       ` Jie Liu
2012-08-20 23:13 ` Dave Chinner
2012-08-21  5:04   ` Jie Liu

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=20120820230833.GI19235@dastard \
    --to=david@fromorbit.com \
    --cc=jeff.liu@oracle.com \
    --cc=tinguely@sgi.com \
    --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