Hello, This is the new version of supplying xfs_seek_data/xfs_seek_hole refinements by probing page cache to find out the desired offset for unwritten extents. Hi Dave, According to your comments for v5, we have to check both page->index && page->mapping after locking a page due to memory reclaim or truncate. For page->mapping, it definitely need to check up again as it may be invalidated or truncated. For page->index, we have a reference on this page at pagevec_lookup(), to this point, its mapping may be set to NULL, but it would still resides in cache or swap space IMHO, so the index will not change because of that. I think I must missing something in this point, could you please give some hints? Changes from v6 to v5: - Fix off-by-one bug for calculating the number of pages to be mapped. - Fix a few comments according to Mark and Dave's comments. - Introduce a new helper routine xfs_lookup_buffer_offset() to lookup the desired offset from one page. This could help reducing one level of indention at xfs_find_get_pgoff(). - Verify page->mapping after page got locked at xfs_find_get_pgoff() as a searched page may be invalidated/truncated at memory reclarim or page truncation stage. - xfs_seek_data()/xfs_seek_hole(): loop bodys are indent by one level as for if statements. Old version: Version 5 of this posting can be found at http://www.spinics.net/lists/xfs/msg12987.html Version 4 of this posting can be found at http://oss.sgi.com/archives/xfs/2012-07/msg00279.html Version 3 of this posting can be found at http://oss.sgi.com/archives/xfs/2012-07/msg00050.html Version 2 of this posting can be found at http://oss.sgi.com/archives/xfs/2012-06/msg00407.html Version 1 of this posting can be found at http://www.digipedia.pl/usenet/thread/11980/26875/ Thanks, -Jeff _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs