On Tue, Oct 04, 2011 at 10:43:05AM +1100, Dave Chinner wrote: > The lookup is pretty simple - if there's cached data over the > unwritten range, then I'm considering it a data range. If there's no > cached data over the unwritten extent, it's a hole. That makes the > lookup simply a case of finding the first cached page in the > unwritten extent. > > It'll end up reading something like this: > > iomap = offset_to_extent(offset); > first_index = extent_to_page_index(iomap); > > nr_found = pagevec_lookup(&pvec, inode->i_mapping, first_index, 1); > if (!nr_found) > break; > > offset = page->index << PAGECACHE_SHIFT; > pagevec_release(&pvec); > > /* If we fell off the end of the extent lookup next extent */ > if (offset >= end_of_extent(iomap)) { > offset = end_of_extent(iomap); > goto next_extent; > } > > All the extent manipulations are pretty filesystem specific, so > there's not much that can be extracted into generic helper, I > think... Actually pretty similar code will work just fine if you passt the start + len of the extents in (which we got from looking it up fs-specificly): Note that we have to look for both dirty and writeback pages to make it safe. _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs