aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-06-03 19:19:15 -0400
committerDave Chinner <david@fromorbit.com>2015-06-03 19:19:15 -0400
commit6e1ba0bcb84b3f97616feb07c27f974509ba57be (patch)
treecafd16deba445ed386582259721a3e14f33733a7
parent9969441f9f86a8a7de8c36514fa789e5f5d83145 (diff)
xfs: add DAX IO path support
DAX does not do buffered IO (can't buffer direct access!) and hence all read/write IO is vectored through the direct IO path. Hence we need to add the DAX IO path callouts to the direct IO infrastructure. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_aops.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 1d195e80d62e..e5e9fc23f230 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1657,6 +1657,29 @@ xfs_end_io_dax_write(
1657void xfs_end_io_dax_write(struct buffer_head *bh, int uptodate) { } 1657void xfs_end_io_dax_write(struct buffer_head *bh, int uptodate) { }
1658#endif 1658#endif
1659 1659
1660static inline ssize_t
1661xfs_vm_do_dio(
1662 struct inode *inode,
1663 struct kiocb *iocb,
1664 struct iov_iter *iter,
1665 loff_t offset,
1666 void (*endio)(struct kiocb *iocb,
1667 loff_t offset,
1668 ssize_t size,
1669 void *private),
1670 int flags)
1671{
1672 struct block_device *bdev;
1673
1674 if (IS_DAX(inode))
1675 return dax_do_io(iocb, inode, iter, offset,
1676 xfs_get_blocks_direct, endio, 0);
1677
1678 bdev = xfs_find_bdev_for_inode(inode);
1679 return __blockdev_direct_IO(iocb, inode, bdev, iter, offset,
1680 xfs_get_blocks_direct, endio, NULL, flags);
1681}
1682
1660STATIC ssize_t 1683STATIC ssize_t
1661xfs_vm_direct_IO( 1684xfs_vm_direct_IO(
1662 struct kiocb *iocb, 1685 struct kiocb *iocb,
@@ -1664,16 +1687,11 @@ xfs_vm_direct_IO(
1664 loff_t offset) 1687 loff_t offset)
1665{ 1688{
1666 struct inode *inode = iocb->ki_filp->f_mapping->host; 1689 struct inode *inode = iocb->ki_filp->f_mapping->host;
1667 struct block_device *bdev = xfs_find_bdev_for_inode(inode);
1668 1690
1669 if (iov_iter_rw(iter) == WRITE) { 1691 if (iov_iter_rw(iter) == WRITE)
1670 return __blockdev_direct_IO(iocb, inode, bdev, iter, offset, 1692 return xfs_vm_do_dio(inode, iocb, iter, offset,
1671 xfs_get_blocks_direct, 1693 xfs_end_io_direct_write, DIO_ASYNC_EXTEND);
1672 xfs_end_io_direct_write, NULL, 1694 return xfs_vm_do_dio(inode, iocb, iter, offset, NULL, 0);
1673 DIO_ASYNC_EXTEND);
1674 }
1675 return __blockdev_direct_IO(iocb, inode, bdev, iter, offset,
1676 xfs_get_blocks_direct, NULL, NULL, 0);
1677} 1695}
1678 1696
1679/* 1697/*