aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_aops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-09-14 01:23:17 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 00:43:35 -0500
commit6214ed4461f1ad8aeec41857c73d58afb31be335 (patch)
treecd01b3d54a4156ee9315ea88ef7fea26fb40acfb /fs/xfs/linux-2.6/xfs_aops.c
parentcf441eeb79c32471379f0a4d97feaef691432a03 (diff)
[XFS] kill BMAPI_DEVICE
There is no reason to go into the iomap machinery just to get the right block device for an inode. Instead look at the realtime flag in the inode and grab the right device from the mount structure. I created a new helper, xfs_find_bdev_for_inode instead of opencoding it because I plan to use it in other places in the future. SGI-PV: 970240 SGI-Modid: xfs-linux-melb:xfs-kern:29680a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Donald Douwsma <donaldd@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
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 }