diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 2e34b104107..e0519529c26 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 (XFS_IS_REALTIME_INODE(ip)) | ||
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, |
@@ -151,7 +163,7 @@ xfs_destroy_ioend( | |||
151 | /* | 163 | /* |
152 | * Update on-disk file size now that data has been written to disk. | 164 | * Update on-disk file size now that data has been written to disk. |
153 | * The current in-memory file size is i_size. If a write is beyond | 165 | * The current in-memory file size is i_size. If a write is beyond |
154 | * eof io_new_size will be the intended file size until i_size is | 166 | * eof i_new_size will be the intended file size until i_size is |
155 | * updated. If this write does not extend all the way to the valid | 167 | * updated. If this write does not extend all the way to the valid |
156 | * file size then restrict this update to the end of the write. | 168 | * file size then restrict this update to the end of the write. |
157 | */ | 169 | */ |
@@ -173,7 +185,7 @@ xfs_setfilesize( | |||
173 | 185 | ||
174 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 186 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
175 | 187 | ||
176 | isize = MAX(ip->i_size, ip->i_iocore.io_new_size); | 188 | isize = MAX(ip->i_size, ip->i_new_size); |
177 | isize = MIN(isize, bsize); | 189 | isize = MIN(isize, bsize); |
178 | 190 | ||
179 | if (ip->i_d.di_size < isize) { | 191 | if (ip->i_d.di_size < isize) { |
@@ -226,12 +238,13 @@ xfs_end_bio_unwritten( | |||
226 | { | 238 | { |
227 | xfs_ioend_t *ioend = | 239 | xfs_ioend_t *ioend = |
228 | container_of(work, xfs_ioend_t, io_work); | 240 | container_of(work, xfs_ioend_t, io_work); |
241 | struct xfs_inode *ip = XFS_I(ioend->io_inode); | ||
229 | xfs_off_t offset = ioend->io_offset; | 242 | xfs_off_t offset = ioend->io_offset; |
230 | size_t size = ioend->io_size; | 243 | size_t size = ioend->io_size; |
231 | 244 | ||
232 | if (likely(!ioend->io_error)) { | 245 | if (likely(!ioend->io_error)) { |
233 | xfs_bmap(XFS_I(ioend->io_inode), offset, size, | 246 | if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) |
234 | BMAPI_UNWRITTEN, NULL, NULL); | 247 | xfs_iomap_write_unwritten(ip, offset, size); |
235 | xfs_setfilesize(ioend); | 248 | xfs_setfilesize(ioend); |
236 | } | 249 | } |
237 | xfs_destroy_ioend(ioend); | 250 | xfs_destroy_ioend(ioend); |
@@ -304,7 +317,7 @@ xfs_map_blocks( | |||
304 | xfs_inode_t *ip = XFS_I(inode); | 317 | xfs_inode_t *ip = XFS_I(inode); |
305 | int error, nmaps = 1; | 318 | int error, nmaps = 1; |
306 | 319 | ||
307 | error = xfs_bmap(ip, offset, count, | 320 | error = xfs_iomap(ip, offset, count, |
308 | flags, mapp, &nmaps); | 321 | flags, mapp, &nmaps); |
309 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) | 322 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) |
310 | xfs_iflags_set(ip, XFS_IMODIFIED); | 323 | xfs_iflags_set(ip, XFS_IMODIFIED); |
@@ -1323,7 +1336,7 @@ __xfs_get_blocks( | |||
1323 | offset = (xfs_off_t)iblock << inode->i_blkbits; | 1336 | offset = (xfs_off_t)iblock << inode->i_blkbits; |
1324 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); | 1337 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); |
1325 | size = bh_result->b_size; | 1338 | size = bh_result->b_size; |
1326 | error = xfs_bmap(XFS_I(inode), offset, size, | 1339 | error = xfs_iomap(XFS_I(inode), offset, size, |
1327 | create ? flags : BMAPI_READ, &iomap, &niomap); | 1340 | create ? flags : BMAPI_READ, &iomap, &niomap); |
1328 | if (error) | 1341 | if (error) |
1329 | return -error; | 1342 | return -error; |
@@ -1471,28 +1484,21 @@ xfs_vm_direct_IO( | |||
1471 | { | 1484 | { |
1472 | struct file *file = iocb->ki_filp; | 1485 | struct file *file = iocb->ki_filp; |
1473 | struct inode *inode = file->f_mapping->host; | 1486 | struct inode *inode = file->f_mapping->host; |
1474 | xfs_iomap_t iomap; | 1487 | struct block_device *bdev; |
1475 | int maps = 1; | ||
1476 | int error; | ||
1477 | ssize_t ret; | 1488 | ssize_t ret; |
1478 | 1489 | ||
1479 | error = xfs_bmap(XFS_I(inode), offset, 0, | 1490 | bdev = xfs_find_bdev_for_inode(XFS_I(inode)); |
1480 | BMAPI_DEVICE, &iomap, &maps); | ||
1481 | if (error) | ||
1482 | return -error; | ||
1483 | 1491 | ||
1484 | if (rw == WRITE) { | 1492 | if (rw == WRITE) { |
1485 | iocb->private = xfs_alloc_ioend(inode, IOMAP_UNWRITTEN); | 1493 | iocb->private = xfs_alloc_ioend(inode, IOMAP_UNWRITTEN); |
1486 | ret = blockdev_direct_IO_own_locking(rw, iocb, inode, | 1494 | ret = blockdev_direct_IO_own_locking(rw, iocb, inode, |
1487 | iomap.iomap_target->bt_bdev, | 1495 | bdev, iov, offset, nr_segs, |
1488 | iov, offset, nr_segs, | ||
1489 | xfs_get_blocks_direct, | 1496 | xfs_get_blocks_direct, |
1490 | xfs_end_io_direct); | 1497 | xfs_end_io_direct); |
1491 | } else { | 1498 | } else { |
1492 | iocb->private = xfs_alloc_ioend(inode, IOMAP_READ); | 1499 | iocb->private = xfs_alloc_ioend(inode, IOMAP_READ); |
1493 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, | 1500 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, |
1494 | iomap.iomap_target->bt_bdev, | 1501 | bdev, iov, offset, nr_segs, |
1495 | iov, offset, nr_segs, | ||
1496 | xfs_get_blocks_direct, | 1502 | xfs_get_blocks_direct, |
1497 | xfs_end_io_direct); | 1503 | xfs_end_io_direct); |
1498 | } | 1504 | } |
@@ -1525,8 +1531,7 @@ xfs_vm_bmap( | |||
1525 | struct inode *inode = (struct inode *)mapping->host; | 1531 | struct inode *inode = (struct inode *)mapping->host; |
1526 | struct xfs_inode *ip = XFS_I(inode); | 1532 | struct xfs_inode *ip = XFS_I(inode); |
1527 | 1533 | ||
1528 | vn_trace_entry(XFS_I(inode), __FUNCTION__, | 1534 | xfs_itrace_entry(XFS_I(inode)); |
1529 | (inst_t *)__return_address); | ||
1530 | xfs_rwlock(ip, VRWLOCK_READ); | 1535 | xfs_rwlock(ip, VRWLOCK_READ); |
1531 | xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); | 1536 | xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); |
1532 | xfs_rwunlock(ip, VRWLOCK_READ); | 1537 | xfs_rwunlock(ip, VRWLOCK_READ); |