[PATCH 1/2] xfs: use range primitives for xfs page cache operations

Christoph Hellwig hch at infradead.org
Tue Jul 27 01:53:26 CDT 2010


On Tue, Jul 27, 2010 at 03:55:28PM +1000, Dave Chinner wrote:
> While XFS passes ranges to operate on from the core code, the
> functions being called ignore the either the entire range or the end
> of the range. This is historical because when the function were
> written linux didn't have the necessary range operations. Update the
> functions to use the correct operations.

Assuming you have actually tested this - given that we've ignore
these parameters so long that I'm really fearing some callers have
started to rely on that behaviour.

>  	if (mapping->nrpages) {

I'd drop this check ere as well - no other caller does it.

>  		xfs_iflags_clear(ip, XFS_ITRUNCATED);
> -		ret = filemap_write_and_wait(mapping);
> +		ret = filemap_write_and_wait_range(mapping, first,
> +					last == -1 ? LLONG_MAX : last);
>  		if (!ret)
> -			truncate_inode_pages(mapping, first);
> +			truncate_inode_pages_range(mapping, first, last);
>  	}
>  	return -ret;
>  }
> @@ -73,7 +71,8 @@ xfs_flush_pages(
>  
>  	if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {

Same for this check.

>  		xfs_iflags_clear(ip, XFS_ITRUNCATED);
> -		ret = -filemap_fdatawrite(mapping);
> +		ret = -filemap_fdatawrite_range(mapping, first,
> +					last == -1 ? LLONG_MAX : last);

Also for the non-async case we should just use
filemap_write_and_wait_range, and kill off xfs_wait_on_pages.




More information about the xfs mailing list