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@xxxxxxxxxx> > > > >--- > > 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@xxxxxxxxxxxxx _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs