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.
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
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
Version 5 of this posting can be found at
Version 4 of this posting can be found at
Version 3 of this posting can be found at
Version 2 of this posting can be found at
Version 1 of this posting can be found at