aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_aops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 31269cbd5e1a..43f5a75fc3c0 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -107,6 +107,18 @@ xfs_page_trace(
107#define xfs_page_trace(tag, inode, page, pgoff) 107#define xfs_page_trace(tag, inode, page, pgoff)
108#endif 108#endif
109 109
110STATIC struct block_device *
111xfs_find_bdev_for_inode(
112 struct xfs_inode *ip)
113{
114 struct xfs_mount *mp = ip->i_mount;
115
116 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
117 return mp->m_rtdev_targp->bt_bdev;
118 else
119 return mp->m_ddev_targp->bt_bdev;
120}
121
110/* 122/*
111 * Schedule IO completion handling on a xfsdatad if this was 123 * Schedule IO completion handling on a xfsdatad if this was
112 * the final hold on this ioend. If we are asked to wait, 124 * the final hold on this ioend. If we are asked to wait,
@@ -1471,28 +1483,21 @@ xfs_vm_direct_IO(
1471{ 1483{
1472 struct file *file = iocb->ki_filp; 1484 struct file *file = iocb->ki_filp;
1473 struct inode *inode = file->f_mapping->host; 1485 struct inode *inode = file->f_mapping->host;
1474 xfs_iomap_t iomap; 1486 struct block_device *bdev;
1475 int maps = 1;
1476 int error;
1477 ssize_t ret; 1487 ssize_t ret;
1478 1488
1479 error = xfs_bmap(XFS_I(inode), offset, 0, 1489 bdev = xfs_find_bdev_for_inode(XFS_I(inode));
1480 BMAPI_DEVICE, &iomap, &maps);
1481 if (error)
1482 return -error;
1483 1490
1484 if (rw == WRITE) { 1491 if (rw == WRITE) {
1485 iocb->private = xfs_alloc_ioend(inode, IOMAP_UNWRITTEN); 1492 iocb->private = xfs_alloc_ioend(inode, IOMAP_UNWRITTEN);
1486 ret = blockdev_direct_IO_own_locking(rw, iocb, inode, 1493 ret = blockdev_direct_IO_own_locking(rw, iocb, inode,
1487 iomap.iomap_target->bt_bdev, 1494 bdev, iov, offset, nr_segs,
1488 iov, offset, nr_segs,
1489 xfs_get_blocks_direct, 1495 xfs_get_blocks_direct,
1490 xfs_end_io_direct); 1496 xfs_end_io_direct);
1491 } else { 1497 } else {
1492 iocb->private = xfs_alloc_ioend(inode, IOMAP_READ); 1498 iocb->private = xfs_alloc_ioend(inode, IOMAP_READ);
1493 ret = blockdev_direct_IO_no_locking(rw, iocb, inode, 1499 ret = blockdev_direct_IO_no_locking(rw, iocb, inode,
1494 iomap.iomap_target->bt_bdev, 1500 bdev, iov, offset, nr_segs,
1495 iov, offset, nr_segs,
1496 xfs_get_blocks_direct, 1501 xfs_get_blocks_direct,
1497 xfs_end_io_direct); 1502 xfs_end_io_direct);
1498 } 1503 }