diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 52bd08c0a278..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 | ||
@@ -497,7 +497,7 @@ xfs_cancel_ioend( | |||
497 | unlock_buffer(bh); | 497 | unlock_buffer(bh); |
498 | } while ((bh = next_bh) != NULL); | 498 | } while ((bh = next_bh) != NULL); |
499 | 499 | ||
500 | vn_iowake(ioend->io_vnode); | 500 | vn_iowake(XFS_I(ioend->io_inode)); |
501 | mempool_free(ioend, xfs_ioend_pool); | 501 | mempool_free(ioend, xfs_ioend_pool); |
502 | } while ((ioend = next) != NULL); | 502 | } while ((ioend = next) != NULL); |
503 | } | 503 | } |
@@ -1237,10 +1237,7 @@ xfs_vm_writepages( | |||
1237 | struct address_space *mapping, | 1237 | struct address_space *mapping, |
1238 | struct writeback_control *wbc) | 1238 | struct writeback_control *wbc) |
1239 | { | 1239 | { |
1240 | struct bhv_vnode *vp = vn_from_inode(mapping->host); | 1240 | xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); |
1241 | |||
1242 | if (VN_TRUNC(vp)) | ||
1243 | VUNTRUNCATE(vp); | ||
1244 | return generic_writepages(mapping, wbc); | 1241 | return generic_writepages(mapping, wbc); |
1245 | } | 1242 | } |
1246 | 1243 | ||
@@ -1317,7 +1314,6 @@ __xfs_get_blocks( | |||
1317 | int direct, | 1314 | int direct, |
1318 | bmapi_flags_t flags) | 1315 | bmapi_flags_t flags) |
1319 | { | 1316 | { |
1320 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
1321 | xfs_iomap_t iomap; | 1317 | xfs_iomap_t iomap; |
1322 | xfs_off_t offset; | 1318 | xfs_off_t offset; |
1323 | ssize_t size; | 1319 | ssize_t size; |
@@ -1327,7 +1323,7 @@ __xfs_get_blocks( | |||
1327 | offset = (xfs_off_t)iblock << inode->i_blkbits; | 1323 | offset = (xfs_off_t)iblock << inode->i_blkbits; |
1328 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); | 1324 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); |
1329 | size = bh_result->b_size; | 1325 | size = bh_result->b_size; |
1330 | error = bhv_vop_bmap(vp, offset, size, | 1326 | error = xfs_bmap(XFS_I(inode), offset, size, |
1331 | create ? flags : BMAPI_READ, &iomap, &niomap); | 1327 | create ? flags : BMAPI_READ, &iomap, &niomap); |
1332 | if (error) | 1328 | if (error) |
1333 | return -error; | 1329 | return -error; |
@@ -1475,13 +1471,13 @@ xfs_vm_direct_IO( | |||
1475 | { | 1471 | { |
1476 | struct file *file = iocb->ki_filp; | 1472 | struct file *file = iocb->ki_filp; |
1477 | struct inode *inode = file->f_mapping->host; | 1473 | struct inode *inode = file->f_mapping->host; |
1478 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
1479 | xfs_iomap_t iomap; | 1474 | xfs_iomap_t iomap; |
1480 | int maps = 1; | 1475 | int maps = 1; |
1481 | int error; | 1476 | int error; |
1482 | ssize_t ret; | 1477 | ssize_t ret; |
1483 | 1478 | ||
1484 | 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); | ||
1485 | if (error) | 1481 | if (error) |
1486 | return -error; | 1482 | return -error; |
1487 | 1483 | ||
@@ -1527,12 +1523,13 @@ xfs_vm_bmap( | |||
1527 | sector_t block) | 1523 | sector_t block) |
1528 | { | 1524 | { |
1529 | struct inode *inode = (struct inode *)mapping->host; | 1525 | struct inode *inode = (struct inode *)mapping->host; |
1530 | bhv_vnode_t *vp = vn_from_inode(inode); | 1526 | struct xfs_inode *ip = XFS_I(inode); |
1531 | 1527 | ||
1532 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 1528 | vn_trace_entry(XFS_I(inode), __FUNCTION__, |
1533 | bhv_vop_rwlock(vp, VRWLOCK_READ); | 1529 | (inst_t *)__return_address); |
1534 | bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF); | 1530 | xfs_rwlock(ip, VRWLOCK_READ); |
1535 | 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); | ||
1536 | return generic_block_bmap(mapping, block, xfs_get_blocks); | 1533 | return generic_block_bmap(mapping, block, xfs_get_blocks); |
1537 | } | 1534 | } |
1538 | 1535 | ||