/* Look for a page at index that is suitable for clustering.  */
STATIC unsigned int xfs_probe_page(struct page *page, unsigned int pg_offset, int mapped)
/* Look for a page at index that is suitable for clustering.  */
STATIC unsigned int xfs_probe_page(struct page *page, unsigned int pg_offset, int mapped)
{
	int			ret = 0;
	if (PageWriteback(page))
		return 0;
	if (page->mapping && PageDirty(page)) {
		if (page_has_buffers(page)) {
			struct buffer_head	*bh, *head;
			bh = head = page_buffers(page);
			do {
				if (!buffer_uptodate(bh))
					break;
				if (mapped != buffer_mapped(bh))
					break;
				ret += bh->b_size;
				if (ret >= pg_offset)
					break;
			} while ((bh = bh->b_this_page) != head);
		} else
			ret = mapped ? 0 : PAGE_CACHE_SIZE;
	}
	return ret;
}