diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 4d191ef39b67..3e807b828e22 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include "xfs_inum.h" | 21 | #include "xfs_inum.h" |
22 | #include "xfs_sb.h" | 22 | #include "xfs_sb.h" |
23 | #include "xfs_ag.h" | 23 | #include "xfs_ag.h" |
24 | #include "xfs_dir.h" | ||
25 | #include "xfs_dir2.h" | 24 | #include "xfs_dir2.h" |
26 | #include "xfs_trans.h" | 25 | #include "xfs_trans.h" |
27 | #include "xfs_dmapi.h" | 26 | #include "xfs_dmapi.h" |
@@ -29,7 +28,6 @@ | |||
29 | #include "xfs_bmap_btree.h" | 28 | #include "xfs_bmap_btree.h" |
30 | #include "xfs_alloc_btree.h" | 29 | #include "xfs_alloc_btree.h" |
31 | #include "xfs_ialloc_btree.h" | 30 | #include "xfs_ialloc_btree.h" |
32 | #include "xfs_dir_sf.h" | ||
33 | #include "xfs_dir2_sf.h" | 31 | #include "xfs_dir2_sf.h" |
34 | #include "xfs_attr_sf.h" | 32 | #include "xfs_attr_sf.h" |
35 | #include "xfs_dinode.h" | 33 | #include "xfs_dinode.h" |
@@ -76,7 +74,7 @@ xfs_page_trace( | |||
76 | int mask) | 74 | int mask) |
77 | { | 75 | { |
78 | xfs_inode_t *ip; | 76 | xfs_inode_t *ip; |
79 | vnode_t *vp = vn_from_inode(inode); | 77 | bhv_vnode_t *vp = vn_from_inode(inode); |
80 | loff_t isize = i_size_read(inode); | 78 | loff_t isize = i_size_read(inode); |
81 | loff_t offset = page_offset(page); | 79 | loff_t offset = page_offset(page); |
82 | int delalloc = -1, unmapped = -1, unwritten = -1; | 80 | int delalloc = -1, unmapped = -1, unwritten = -1; |
@@ -136,9 +134,10 @@ xfs_destroy_ioend( | |||
136 | 134 | ||
137 | for (bh = ioend->io_buffer_head; bh; bh = next) { | 135 | for (bh = ioend->io_buffer_head; bh; bh = next) { |
138 | next = bh->b_private; | 136 | next = bh->b_private; |
139 | bh->b_end_io(bh, ioend->io_uptodate); | 137 | bh->b_end_io(bh, !ioend->io_error); |
140 | } | 138 | } |
141 | 139 | if (unlikely(ioend->io_error)) | |
140 | vn_ioerror(ioend->io_vnode, ioend->io_error, __FILE__,__LINE__); | ||
142 | vn_iowake(ioend->io_vnode); | 141 | vn_iowake(ioend->io_vnode); |
143 | mempool_free(ioend, xfs_ioend_pool); | 142 | mempool_free(ioend, xfs_ioend_pool); |
144 | } | 143 | } |
@@ -180,13 +179,12 @@ xfs_end_bio_unwritten( | |||
180 | void *data) | 179 | void *data) |
181 | { | 180 | { |
182 | xfs_ioend_t *ioend = data; | 181 | xfs_ioend_t *ioend = data; |
183 | vnode_t *vp = ioend->io_vnode; | 182 | bhv_vnode_t *vp = ioend->io_vnode; |
184 | xfs_off_t offset = ioend->io_offset; | 183 | xfs_off_t offset = ioend->io_offset; |
185 | size_t size = ioend->io_size; | 184 | size_t size = ioend->io_size; |
186 | int error; | ||
187 | 185 | ||
188 | if (ioend->io_uptodate) | 186 | if (likely(!ioend->io_error)) |
189 | VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error); | 187 | bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL); |
190 | xfs_destroy_ioend(ioend); | 188 | xfs_destroy_ioend(ioend); |
191 | } | 189 | } |
192 | 190 | ||
@@ -211,7 +209,7 @@ xfs_alloc_ioend( | |||
211 | * all the I/O from calling the completion routine too early. | 209 | * all the I/O from calling the completion routine too early. |
212 | */ | 210 | */ |
213 | atomic_set(&ioend->io_remaining, 1); | 211 | atomic_set(&ioend->io_remaining, 1); |
214 | ioend->io_uptodate = 1; /* cleared if any I/O fails */ | 212 | ioend->io_error = 0; |
215 | ioend->io_list = NULL; | 213 | ioend->io_list = NULL; |
216 | ioend->io_type = type; | 214 | ioend->io_type = type; |
217 | ioend->io_vnode = vn_from_inode(inode); | 215 | ioend->io_vnode = vn_from_inode(inode); |
@@ -239,10 +237,10 @@ xfs_map_blocks( | |||
239 | xfs_iomap_t *mapp, | 237 | xfs_iomap_t *mapp, |
240 | int flags) | 238 | int flags) |
241 | { | 239 | { |
242 | vnode_t *vp = vn_from_inode(inode); | 240 | bhv_vnode_t *vp = vn_from_inode(inode); |
243 | int error, nmaps = 1; | 241 | int error, nmaps = 1; |
244 | 242 | ||
245 | VOP_BMAP(vp, offset, count, flags, mapp, &nmaps, error); | 243 | error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps); |
246 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) | 244 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) |
247 | VMODIFY(vp); | 245 | VMODIFY(vp); |
248 | return -error; | 246 | return -error; |
@@ -271,16 +269,14 @@ xfs_end_bio( | |||
271 | if (bio->bi_size) | 269 | if (bio->bi_size) |
272 | return 1; | 270 | return 1; |
273 | 271 | ||
274 | ASSERT(ioend); | ||
275 | ASSERT(atomic_read(&bio->bi_cnt) >= 1); | 272 | ASSERT(atomic_read(&bio->bi_cnt) >= 1); |
273 | ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error; | ||
276 | 274 | ||
277 | /* Toss bio and pass work off to an xfsdatad thread */ | 275 | /* Toss bio and pass work off to an xfsdatad thread */ |
278 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | ||
279 | ioend->io_uptodate = 0; | ||
280 | bio->bi_private = NULL; | 276 | bio->bi_private = NULL; |
281 | bio->bi_end_io = NULL; | 277 | bio->bi_end_io = NULL; |
282 | |||
283 | bio_put(bio); | 278 | bio_put(bio); |
279 | |||
284 | xfs_finish_ioend(ioend); | 280 | xfs_finish_ioend(ioend); |
285 | return 0; | 281 | return 0; |
286 | } | 282 | } |
@@ -1127,7 +1123,7 @@ xfs_vm_writepage( | |||
1127 | * then mark the page dirty again and leave the page | 1123 | * then mark the page dirty again and leave the page |
1128 | * as is. | 1124 | * as is. |
1129 | */ | 1125 | */ |
1130 | if (PFLAGS_TEST_FSTRANS() && need_trans) | 1126 | if (current_test_flags(PF_FSTRANS) && need_trans) |
1131 | goto out_fail; | 1127 | goto out_fail; |
1132 | 1128 | ||
1133 | /* | 1129 | /* |
@@ -1158,6 +1154,18 @@ out_unlock: | |||
1158 | return error; | 1154 | return error; |
1159 | } | 1155 | } |
1160 | 1156 | ||
1157 | STATIC int | ||
1158 | xfs_vm_writepages( | ||
1159 | struct address_space *mapping, | ||
1160 | struct writeback_control *wbc) | ||
1161 | { | ||
1162 | struct bhv_vnode *vp = vn_from_inode(mapping->host); | ||
1163 | |||
1164 | if (VN_TRUNC(vp)) | ||
1165 | VUNTRUNCATE(vp); | ||
1166 | return generic_writepages(mapping, wbc); | ||
1167 | } | ||
1168 | |||
1161 | /* | 1169 | /* |
1162 | * Called to move a page into cleanable state - and from there | 1170 | * Called to move a page into cleanable state - and from there |
1163 | * to be released. Possibly the page is already clean. We always | 1171 | * to be released. Possibly the page is already clean. We always |
@@ -1204,7 +1212,7 @@ xfs_vm_releasepage( | |||
1204 | /* If we are already inside a transaction or the thread cannot | 1212 | /* If we are already inside a transaction or the thread cannot |
1205 | * do I/O, we cannot release this page. | 1213 | * do I/O, we cannot release this page. |
1206 | */ | 1214 | */ |
1207 | if (PFLAGS_TEST_FSTRANS()) | 1215 | if (current_test_flags(PF_FSTRANS)) |
1208 | return 0; | 1216 | return 0; |
1209 | 1217 | ||
1210 | /* | 1218 | /* |
@@ -1231,7 +1239,7 @@ __xfs_get_blocks( | |||
1231 | int direct, | 1239 | int direct, |
1232 | bmapi_flags_t flags) | 1240 | bmapi_flags_t flags) |
1233 | { | 1241 | { |
1234 | vnode_t *vp = vn_from_inode(inode); | 1242 | bhv_vnode_t *vp = vn_from_inode(inode); |
1235 | xfs_iomap_t iomap; | 1243 | xfs_iomap_t iomap; |
1236 | xfs_off_t offset; | 1244 | xfs_off_t offset; |
1237 | ssize_t size; | 1245 | ssize_t size; |
@@ -1241,8 +1249,8 @@ __xfs_get_blocks( | |||
1241 | offset = (xfs_off_t)iblock << inode->i_blkbits; | 1249 | offset = (xfs_off_t)iblock << inode->i_blkbits; |
1242 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); | 1250 | ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); |
1243 | size = bh_result->b_size; | 1251 | size = bh_result->b_size; |
1244 | VOP_BMAP(vp, offset, size, | 1252 | error = bhv_vop_bmap(vp, offset, size, |
1245 | create ? flags : BMAPI_READ, &iomap, &niomap, error); | 1253 | create ? flags : BMAPI_READ, &iomap, &niomap); |
1246 | if (error) | 1254 | if (error) |
1247 | return -error; | 1255 | return -error; |
1248 | if (niomap == 0) | 1256 | if (niomap == 0) |
@@ -1370,13 +1378,13 @@ xfs_vm_direct_IO( | |||
1370 | { | 1378 | { |
1371 | struct file *file = iocb->ki_filp; | 1379 | struct file *file = iocb->ki_filp; |
1372 | struct inode *inode = file->f_mapping->host; | 1380 | struct inode *inode = file->f_mapping->host; |
1373 | vnode_t *vp = vn_from_inode(inode); | 1381 | bhv_vnode_t *vp = vn_from_inode(inode); |
1374 | xfs_iomap_t iomap; | 1382 | xfs_iomap_t iomap; |
1375 | int maps = 1; | 1383 | int maps = 1; |
1376 | int error; | 1384 | int error; |
1377 | ssize_t ret; | 1385 | ssize_t ret; |
1378 | 1386 | ||
1379 | VOP_BMAP(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps, error); | 1387 | error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps); |
1380 | if (error) | 1388 | if (error) |
1381 | return -error; | 1389 | return -error; |
1382 | 1390 | ||
@@ -1409,14 +1417,12 @@ xfs_vm_bmap( | |||
1409 | sector_t block) | 1417 | sector_t block) |
1410 | { | 1418 | { |
1411 | struct inode *inode = (struct inode *)mapping->host; | 1419 | struct inode *inode = (struct inode *)mapping->host; |
1412 | vnode_t *vp = vn_from_inode(inode); | 1420 | bhv_vnode_t *vp = vn_from_inode(inode); |
1413 | int error; | ||
1414 | 1421 | ||
1415 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 1422 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); |
1416 | 1423 | bhv_vop_rwlock(vp, VRWLOCK_READ); | |
1417 | VOP_RWLOCK(vp, VRWLOCK_READ); | 1424 | bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF); |
1418 | VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error); | 1425 | bhv_vop_rwunlock(vp, VRWLOCK_READ); |
1419 | VOP_RWUNLOCK(vp, VRWLOCK_READ); | ||
1420 | return generic_block_bmap(mapping, block, xfs_get_blocks); | 1426 | return generic_block_bmap(mapping, block, xfs_get_blocks); |
1421 | } | 1427 | } |
1422 | 1428 | ||
@@ -1452,6 +1458,7 @@ struct address_space_operations xfs_address_space_operations = { | |||
1452 | .readpage = xfs_vm_readpage, | 1458 | .readpage = xfs_vm_readpage, |
1453 | .readpages = xfs_vm_readpages, | 1459 | .readpages = xfs_vm_readpages, |
1454 | .writepage = xfs_vm_writepage, | 1460 | .writepage = xfs_vm_writepage, |
1461 | .writepages = xfs_vm_writepages, | ||
1455 | .sync_page = block_sync_page, | 1462 | .sync_page = block_sync_page, |
1456 | .releasepage = xfs_vm_releasepage, | 1463 | .releasepage = xfs_vm_releasepage, |
1457 | .invalidatepage = xfs_vm_invalidatepage, | 1464 | .invalidatepage = xfs_vm_invalidatepage, |