diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 354d68a32d4a..2e34b104107c 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include "xfs_error.h" | 37 | #include "xfs_error.h" |
| 38 | #include "xfs_rw.h" | 38 | #include "xfs_rw.h" |
| 39 | #include "xfs_iomap.h" | 39 | #include "xfs_iomap.h" |
| 40 | #include "xfs_vnodeops.h" | ||
| 40 | #include <linux/mpage.h> | 41 | #include <linux/mpage.h> |
| 41 | #include <linux/pagevec.h> | 42 | #include <linux/pagevec.h> |
| 42 | #include <linux/writeback.h> | 43 | #include <linux/writeback.h> |
| @@ -139,9 +140,11 @@ xfs_destroy_ioend( | |||
| 139 | next = bh->b_private; | 140 | next = bh->b_private; |
| 140 | bh->b_end_io(bh, !ioend->io_error); | 141 | bh->b_end_io(bh, !ioend->io_error); |
| 141 | } | 142 | } |
| 142 | if (unlikely(ioend->io_error)) | 143 | if (unlikely(ioend->io_error)) { |
| 143 | vn_ioerror(ioend->io_vnode, ioend->io_error, __FILE__,__LINE__); | 144 | vn_ioerror(XFS_I(ioend->io_inode), ioend->io_error, |
| 144 | vn_iowake(ioend->io_vnode); | 145 | __FILE__,__LINE__); |
| 146 | } | ||
| 147 | vn_iowake(XFS_I(ioend->io_inode)); | ||
| 145 | mempool_free(ioend, xfs_ioend_pool); | 148 | mempool_free(ioend, xfs_ioend_pool); |
| 146 | } | 149 | } |
| 147 | 150 | ||
| @@ -156,14 +159,10 @@ STATIC void | |||
| 156 | xfs_setfilesize( | 159 | xfs_setfilesize( |
| 157 | xfs_ioend_t *ioend) | 160 | xfs_ioend_t *ioend) |
| 158 | { | 161 | { |
| 159 | xfs_inode_t *ip; | 162 | xfs_inode_t *ip = XFS_I(ioend->io_inode); |
| 160 | xfs_fsize_t isize; | 163 | xfs_fsize_t isize; |
| 161 | xfs_fsize_t bsize; | 164 | xfs_fsize_t bsize; |
| 162 | 165 | ||
| 163 | ip = xfs_vtoi(ioend->io_vnode); | ||
| 164 | if (!ip) | ||
| 165 | return; | ||
| 166 | |||
| 167 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); | 166 | ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); |
| 168 | ASSERT(ioend->io_type != IOMAP_READ); | 167 | ASSERT(ioend->io_type != IOMAP_READ); |
| 169 | 168 | ||
| @@ -181,7 +180,7 @@ xfs_setfilesize( | |||
| 181 | ip->i_d.di_size = isize; | 180 | ip->i_d.di_size = isize; |
| 182 | ip->i_update_core = 1; | 181 | ip->i_update_core = 1; |
| 183 | ip->i_update_size = 1; | 182 | ip->i_update_size = 1; |
| 184 | mark_inode_dirty_sync(vn_to_inode(ioend->io_vnode)); | 183 | mark_inode_dirty_sync(ioend->io_inode); |
| 185 | } | 184 | } |
| 186 | 185 | ||
| 187 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 186 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| @@ -227,12 +226,12 @@ xfs_end_bio_unwritten( | |||
| 227 | { | 226 | { |
| 228 | xfs_ioend_t *ioend = | 227 | xfs_ioend_t *ioend = |
| 229 | container_of(work, xfs_ioend_t, io_work); | 228 | container_of(work, xfs_ioend_t, io_work); |
| 230 | bhv_vnode_t *vp = ioend->io_vnode; | ||
| 231 | xfs_off_t offset = ioend->io_offset; | 229 | xfs_off_t offset = ioend->io_offset; |
| 232 | size_t size = ioend->io_size; | 230 | size_t size = ioend->io_size; |
| 233 | 231 | ||
| 234 | if (likely(!ioend->io_error)) { | 232 | if (likely(!ioend->io_error)) { |
| 235 | bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL); | 233 | xfs_bmap(XFS_I(ioend->io_inode), offset, size, |
| 234 | BMAPI_UNWRITTEN, NULL, NULL); | ||
| 236 | xfs_setfilesize(ioend); | 235 | xfs_setfilesize(ioend); |
| 237 | } | 236 | } |
| 238 | xfs_destroy_ioend(ioend); | 237 | xfs_destroy_ioend(ioend); |
| @@ -275,10 +274,10 @@ xfs_alloc_ioend( | |||
| 275 | ioend->io_error = 0; | 274 | ioend->io_error = 0; |
| 276 | ioend->io_list = NULL; | 275 | ioend->io_list = NULL; |
| 277 | ioend->io_type = type; | 276 | ioend->io_type = type; |
| 278 | ioend->io_vnode = vn_from_inode(inode); | 277 | ioend->io_inode = inode; |
| 279 | ioend->io_buffer_head = NULL; | 278 | ioend->io_buffer_head = NULL; |
| 280 | ioend->io_buffer_tail = NULL; | 279 | ioend->io_buffer_tail = NULL; |
| 281 | atomic_inc(&ioend->io_vnode->v_iocount); | 280 | atomic_inc(&XFS_I(ioend->io_inode)->i_iocount); |
| 282 | ioend->io_offset = 0; | 281 | ioend->io_offset = 0; |
| 283 | ioend->io_size = 0; | 282 | ioend->io_size = 0; |
| 284 | 283 | ||
| @@ -302,12 +301,13 @@ xfs_map_blocks( | |||
| 302 | xfs_iomap_t *mapp, | 301 | xfs_iomap_t *mapp, |
| 303 | int flags) | 302 | int flags) |
| 304 | { | 303 | { |
| 305 | bhv_vnode_t *vp = vn_from_inode(inode); | 304 | xfs_inode_t *ip = XFS_I(inode); |
| 306 | int error, nmaps = 1; | 305 | int error, nmaps = 1; |
| 307 | 306 | ||
| 308 | error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps); | 307 | error = xfs_bmap(ip, offset, count, |
| 308 | flags, mapp, &nmaps); | ||
| 309 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) | 309 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) |
| 310 | VMODIFY(vp); | 310 | xfs_iflags_set(ip, XFS_IMODIFIED); |
| 311 | return -error; | 311 | return -error; |
| 312 | } | 312 | } |
| 313 | 313 | ||
| @@ -402,10 +402,9 @@ xfs_start_page_writeback( | |||
| 402 | clear_page_dirty_for_io(page); | 402 | clear_page_dirty_for_io(page); |
| 403 | set_page_writeback(page); | 403 | set_page_writeback(page); |
| 404 | unlock_page(page); | 404 | unlock_page(page); |
| 405 | if (!buffers) { | 405 | /* If no buffers on the page are to be written, finish it here */ |
| 406 | if (!buffers) | ||
| 406 | end_page_writeback(page); | 407 | end_page_writeback(page); |
| 407 | wbc->pages_skipped++; /* We didn't write this page */ | ||
| 408 | } | ||
| 409 | } | 408 | } |
| 410 | 409 | ||
| 411 | static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh) | 410 | static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh) |
| @@ -498,7 +497,7 @@ xfs_cancel_ioend( | |||
| 498 | unlock_buffer(bh); | 497 | unlock_buffer(bh); |
| 499 | } while ((bh = next_bh) != NULL); | 498 | } while ((bh = next_bh) != NULL); |
| 500 | 499 | ||
| 501 | vn_iowake(ioend->io_vnode); | 500 | vn_iowake(XFS_I(ioend->io_inode)); |
| 502 | mempool_free(ioend, xfs_ioend_pool); | 501 | mempool_free(ioend, xfs_ioend_pool); |
| 503 | } while ((ioend = next) != NULL); | 502 | } while ((ioend = next) != NULL); |
| 504 | } | 503 | } |
| @@ -1238,10 +1237,7 @@ xfs_vm_writepages( | |||
| 1238 | struct address_space *mapping, | 1237 | struct address_space *mapping, |
| 1239 | struct writeback_control *wbc) | 1238 | struct writeback_control *wbc) |
| 1240 | { | 1239 | { |
| 1241 | struct bhv_vnode *vp = vn_from_inode(mapping->host); | 1240 | xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); |
| 1242 | |||
| 1243 | if (VN_TRUNC(vp)) | ||
| 1244 | VUNTRUNCATE(vp); | ||
| 1245 | return generic_writepages(mapping, wbc); | 1241 | return generic_writepages(mapping, wbc); |
| 1246 | } | 1242 | } |
| 1247 | 1243 | ||
| @@ -1318,7 +1314,6 @@ __xfs_get_blocks( | |||
| 1318 | int direct, | 1314 | int direct, |
| 1319 | bmapi_flags_t flags) | 1315 | bmapi_flags_t flags) |
| 1320 | { | 1316 | { |
| 1321 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
| 1322 | xfs_iomap_t iomap; | 1317 | xfs_iomap_t iomap; |
| 1323 | xfs_off_t offset; | 1318 | xfs_off_t offset; |
| 1324 | ssize_t size; | 1319 | ssize_t size; |
| @@ -1328,7 +1323,7 @@ __xfs_get_blocks( | |||
| 1328 | offset = (xfs_off_t)iblock << inode->i_blkbits; | 1323 | offset = (xfs_off_t)iblock << inode->i_blkbits; |
| 1329 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); | 1324 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); |
| 1330 | size = bh_result->b_size; | 1325 | size = bh_result->b_size; |
| 1331 | error = bhv_vop_bmap(vp, offset, size, | 1326 | error = xfs_bmap(XFS_I(inode), offset, size, |
| 1332 | create ? flags : BMAPI_READ, &iomap, &niomap); | 1327 | create ? flags : BMAPI_READ, &iomap, &niomap); |
| 1333 | if (error) | 1328 | if (error) |
| 1334 | return -error; | 1329 | return -error; |
| @@ -1476,13 +1471,13 @@ xfs_vm_direct_IO( | |||
| 1476 | { | 1471 | { |
| 1477 | struct file *file = iocb->ki_filp; | 1472 | struct file *file = iocb->ki_filp; |
| 1478 | struct inode *inode = file->f_mapping->host; | 1473 | struct inode *inode = file->f_mapping->host; |
| 1479 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
| 1480 | xfs_iomap_t iomap; | 1474 | xfs_iomap_t iomap; |
| 1481 | int maps = 1; | 1475 | int maps = 1; |
| 1482 | int error; | 1476 | int error; |
| 1483 | ssize_t ret; | 1477 | ssize_t ret; |
| 1484 | 1478 | ||
| 1485 | error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps); | 1479 | error = xfs_bmap(XFS_I(inode), offset, 0, |
| 1480 | BMAPI_DEVICE, &iomap, &maps); | ||
| 1486 | if (error) | 1481 | if (error) |
| 1487 | return -error; | 1482 | return -error; |
| 1488 | 1483 | ||
| @@ -1528,12 +1523,13 @@ xfs_vm_bmap( | |||
| 1528 | sector_t block) | 1523 | sector_t block) |
| 1529 | { | 1524 | { |
| 1530 | struct inode *inode = (struct inode *)mapping->host; | 1525 | struct inode *inode = (struct inode *)mapping->host; |
| 1531 | bhv_vnode_t *vp = vn_from_inode(inode); | 1526 | struct xfs_inode *ip = XFS_I(inode); |
| 1532 | 1527 | ||
| 1533 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 1528 | vn_trace_entry(XFS_I(inode), __FUNCTION__, |
| 1534 | bhv_vop_rwlock(vp, VRWLOCK_READ); | 1529 | (inst_t *)__return_address); |
| 1535 | bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF); | 1530 | xfs_rwlock(ip, VRWLOCK_READ); |
| 1536 | bhv_vop_rwunlock(vp, VRWLOCK_READ); | 1531 | xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); |
| 1532 | xfs_rwunlock(ip, VRWLOCK_READ); | ||
| 1537 | return generic_block_bmap(mapping, block, xfs_get_blocks); | 1533 | return generic_block_bmap(mapping, block, xfs_get_blocks); |
| 1538 | } | 1534 | } |
| 1539 | 1535 | ||
