diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index f4273c2c2095..ca3d38addbb9 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -509,14 +509,17 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb, | |||
509 | struct ocfs2_alloc_context *meta_ac, | 509 | struct ocfs2_alloc_context *meta_ac, |
510 | enum ocfs2_alloc_restarted *reason_ret) | 510 | enum ocfs2_alloc_restarted *reason_ret) |
511 | { | 511 | { |
512 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data; | 512 | int ret; |
513 | struct ocfs2_extent_list *el = &fe->id2.i_list; | 513 | struct ocfs2_extent_tree et; |
514 | 514 | ||
515 | return ocfs2_add_clusters_in_btree(osb, inode, logical_offset, | 515 | ocfs2_get_dinode_extent_tree(&et, inode, fe_bh); |
516 | ret = ocfs2_add_clusters_in_btree(osb, inode, logical_offset, | ||
516 | clusters_to_add, mark_unwritten, | 517 | clusters_to_add, mark_unwritten, |
517 | fe_bh, el, handle, | 518 | &et, handle, |
518 | data_ac, meta_ac, reason_ret, | 519 | data_ac, meta_ac, reason_ret); |
519 | OCFS2_DINODE_EXTENT, NULL); | 520 | ocfs2_put_extent_tree(&et); |
521 | |||
522 | return ret; | ||
520 | } | 523 | } |
521 | 524 | ||
522 | static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | 525 | static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, |
@@ -533,6 +536,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | |||
533 | struct ocfs2_alloc_context *meta_ac = NULL; | 536 | struct ocfs2_alloc_context *meta_ac = NULL; |
534 | enum ocfs2_alloc_restarted why; | 537 | enum ocfs2_alloc_restarted why; |
535 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 538 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
539 | struct ocfs2_extent_tree et; | ||
536 | 540 | ||
537 | mlog_entry("(clusters_to_add = %u)\n", clusters_to_add); | 541 | mlog_entry("(clusters_to_add = %u)\n", clusters_to_add); |
538 | 542 | ||
@@ -564,9 +568,10 @@ restart_all: | |||
564 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 568 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
565 | (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters), | 569 | (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters), |
566 | clusters_to_add); | 570 | clusters_to_add); |
567 | status = ocfs2_lock_allocators(inode, bh, &fe->id2.i_list, | 571 | ocfs2_get_dinode_extent_tree(&et, inode, bh); |
568 | clusters_to_add, 0, &data_ac, | 572 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, |
569 | &meta_ac, OCFS2_DINODE_EXTENT, NULL); | 573 | &data_ac, &meta_ac); |
574 | ocfs2_put_extent_tree(&et); | ||
570 | if (status) { | 575 | if (status) { |
571 | mlog_errno(status); | 576 | mlog_errno(status); |
572 | goto leave; | 577 | goto leave; |
@@ -1236,11 +1241,13 @@ static int __ocfs2_remove_inode_range(struct inode *inode, | |||
1236 | handle_t *handle; | 1241 | handle_t *handle; |
1237 | struct ocfs2_alloc_context *meta_ac = NULL; | 1242 | struct ocfs2_alloc_context *meta_ac = NULL; |
1238 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; | 1243 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; |
1244 | struct ocfs2_extent_tree et; | ||
1245 | |||
1246 | ocfs2_get_dinode_extent_tree(&et, inode, di_bh); | ||
1239 | 1247 | ||
1240 | ret = ocfs2_lock_allocators(inode, di_bh, &di->id2.i_list, | 1248 | ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac); |
1241 | 0, 1, NULL, &meta_ac, | ||
1242 | OCFS2_DINODE_EXTENT, NULL); | ||
1243 | if (ret) { | 1249 | if (ret) { |
1250 | ocfs2_put_extent_tree(&et); | ||
1244 | mlog_errno(ret); | 1251 | mlog_errno(ret); |
1245 | return ret; | 1252 | return ret; |
1246 | } | 1253 | } |
@@ -1269,8 +1276,8 @@ static int __ocfs2_remove_inode_range(struct inode *inode, | |||
1269 | goto out; | 1276 | goto out; |
1270 | } | 1277 | } |
1271 | 1278 | ||
1272 | ret = ocfs2_remove_extent(inode, di_bh, cpos, len, handle, meta_ac, | 1279 | ret = ocfs2_remove_extent(inode, &et, cpos, len, handle, meta_ac, |
1273 | dealloc, OCFS2_DINODE_EXTENT, NULL); | 1280 | dealloc); |
1274 | if (ret) { | 1281 | if (ret) { |
1275 | mlog_errno(ret); | 1282 | mlog_errno(ret); |
1276 | goto out_commit; | 1283 | goto out_commit; |
@@ -1297,6 +1304,7 @@ out: | |||
1297 | if (meta_ac) | 1304 | if (meta_ac) |
1298 | ocfs2_free_alloc_context(meta_ac); | 1305 | ocfs2_free_alloc_context(meta_ac); |
1299 | 1306 | ||
1307 | ocfs2_put_extent_tree(&et); | ||
1300 | return ret; | 1308 | return ret; |
1301 | } | 1309 | } |
1302 | 1310 | ||