diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-09-14 01:23:17 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-07 00:43:35 -0500 |
commit | 6214ed4461f1ad8aeec41857c73d58afb31be335 (patch) | |
tree | cd01b3d54a4156ee9315ea88ef7fea26fb40acfb /fs | |
parent | cf441eeb79c32471379f0a4d97feaef691432a03 (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')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 27 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.h | 1 |
3 files changed, 17 insertions, 20 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 | ||
110 | STATIC struct block_device * | ||
111 | xfs_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 | } |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 72786e356d56..58cda06a1846 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -193,7 +193,7 @@ xfs_iomap( | |||
193 | 193 | ||
194 | switch (flags & | 194 | switch (flags & |
195 | (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE | | 195 | (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE | |
196 | BMAPI_UNWRITTEN | BMAPI_DEVICE)) { | 196 | BMAPI_UNWRITTEN)) { |
197 | case BMAPI_READ: | 197 | case BMAPI_READ: |
198 | xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count); | 198 | xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count); |
199 | lockmode = XFS_LCK_MAP_SHARED(mp, io); | 199 | lockmode = XFS_LCK_MAP_SHARED(mp, io); |
@@ -220,13 +220,6 @@ xfs_iomap( | |||
220 | break; | 220 | break; |
221 | case BMAPI_UNWRITTEN: | 221 | case BMAPI_UNWRITTEN: |
222 | goto phase2; | 222 | goto phase2; |
223 | case BMAPI_DEVICE: | ||
224 | lockmode = XFS_LCK_MAP_SHARED(mp, io); | ||
225 | iomapp->iomap_target = io->io_flags & XFS_IOCORE_RT ? | ||
226 | mp->m_rtdev_targp : mp->m_ddev_targp; | ||
227 | error = 0; | ||
228 | *niomaps = 1; | ||
229 | goto out; | ||
230 | default: | 223 | default: |
231 | BUG(); | 224 | BUG(); |
232 | } | 225 | } |
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h index f5c09887fe93..2b94874e92d1 100644 --- a/fs/xfs/xfs_iomap.h +++ b/fs/xfs/xfs_iomap.h | |||
@@ -43,7 +43,6 @@ typedef enum { | |||
43 | BMAPI_MMAP = (1 << 6), /* allocate for mmap write */ | 43 | BMAPI_MMAP = (1 << 6), /* allocate for mmap write */ |
44 | BMAPI_SYNC = (1 << 7), /* sync write to flush delalloc space */ | 44 | BMAPI_SYNC = (1 << 7), /* sync write to flush delalloc space */ |
45 | BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */ | 45 | BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */ |
46 | BMAPI_DEVICE = (1 << 9), /* we only want to know the device */ | ||
47 | } bmapi_flags_t; | 46 | } bmapi_flags_t; |
48 | 47 | ||
49 | 48 | ||