xfs: use iomap for blocksize == PAGE_SIZE readpage and readpages
authorChristoph Hellwig <[email protected]>
Thu, 12 Jul 2018 05:25:56 +0000 (22:25 -0700)
committerDarrick J. Wong <[email protected]>
Thu, 12 Jul 2018 05:25:56 +0000 (22:25 -0700)
For file systems with a block size that equals the page size we never do
partial reads, so we can use the buffer_head-less iomap versions of
readpage and readpages without conflicting with the buffer_head structures
create later in write_begin.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Dave Chinner <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
fs/xfs/xfs_aops.c

index 8eb3ba3d4d0026f8cba2ce7b5ba9dbca4d3d889e..85e1a625d42aa6f4700b30368d399e37e9e75522 100644 (file)
@@ -1401,6 +1401,8 @@ xfs_vm_readpage(
        struct page             *page)
 {
        trace_xfs_vm_readpage(page->mapping->host, 1);
+       if (i_blocksize(page->mapping->host) == PAGE_SIZE)
+               return iomap_readpage(page, &xfs_iomap_ops);
        return mpage_readpage(page, xfs_get_blocks);
 }
 
@@ -1412,6 +1414,8 @@ xfs_vm_readpages(
        unsigned                nr_pages)
 {
        trace_xfs_vm_readpages(mapping->host, nr_pages);
+       if (i_blocksize(mapping->host) == PAGE_SIZE)
+               return iomap_readpages(mapping, pages, nr_pages, &xfs_iomap_ops);
        return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks);
 }