aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-13 05:16:08 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:08:01 -0400
commit4fe82c312a7d975a9d0f591dc9180c1197ee4270 (patch)
tree53ca5d0aeeeb92768ee993ec69324b3b6767f09f /fs/ocfs2/alloc.c
parent70f18c08b476e315c8ee17ea34b55ea1957e7e7d (diff)
ocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.
Drop it from the parameters - they already have ocfs2_extent_list. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c54
1 files changed, 24 insertions, 30 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index d348cfb509e..bac6ca02476 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3250,7 +3250,7 @@ static void ocfs2_cleanup_merge(struct ocfs2_extent_list *el,
3250 } 3250 }
3251} 3251}
3252 3252
3253static int ocfs2_get_right_path(struct inode *inode, 3253static int ocfs2_get_right_path(struct ocfs2_extent_tree *et,
3254 struct ocfs2_path *left_path, 3254 struct ocfs2_path *left_path,
3255 struct ocfs2_path **ret_right_path) 3255 struct ocfs2_path **ret_right_path)
3256{ 3256{
@@ -3267,8 +3267,8 @@ static int ocfs2_get_right_path(struct inode *inode,
3267 left_el = path_leaf_el(left_path); 3267 left_el = path_leaf_el(left_path);
3268 BUG_ON(left_el->l_next_free_rec != left_el->l_count); 3268 BUG_ON(left_el->l_next_free_rec != left_el->l_count);
3269 3269
3270 ret = ocfs2_find_cpos_for_right_leaf(inode->i_sb, left_path, 3270 ret = ocfs2_find_cpos_for_right_leaf(ocfs2_metadata_cache_get_super(et->et_ci),
3271 &right_cpos); 3271 left_path, &right_cpos);
3272 if (ret) { 3272 if (ret) {
3273 mlog_errno(ret); 3273 mlog_errno(ret);
3274 goto out; 3274 goto out;
@@ -3284,7 +3284,7 @@ static int ocfs2_get_right_path(struct inode *inode,
3284 goto out; 3284 goto out;
3285 } 3285 }
3286 3286
3287 ret = ocfs2_find_path(INODE_CACHE(inode), right_path, right_cpos); 3287 ret = ocfs2_find_path(et->et_ci, right_path, right_cpos);
3288 if (ret) { 3288 if (ret) {
3289 mlog_errno(ret); 3289 mlog_errno(ret);
3290 goto out; 3290 goto out;
@@ -3304,8 +3304,7 @@ out:
3304 * For index == l_count - 1, the "next" means the 1st extent rec of the 3304 * For index == l_count - 1, the "next" means the 1st extent rec of the
3305 * next extent block. 3305 * next extent block.
3306 */ 3306 */
3307static int ocfs2_merge_rec_right(struct inode *inode, 3307static int ocfs2_merge_rec_right(struct ocfs2_path *left_path,
3308 struct ocfs2_path *left_path,
3309 handle_t *handle, 3308 handle_t *handle,
3310 struct ocfs2_extent_tree *et, 3309 struct ocfs2_extent_tree *et,
3311 struct ocfs2_extent_rec *split_rec, 3310 struct ocfs2_extent_rec *split_rec,
@@ -3328,7 +3327,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3328 if (index == le16_to_cpu(el->l_next_free_rec) - 1 && 3327 if (index == le16_to_cpu(el->l_next_free_rec) - 1 &&
3329 le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) { 3328 le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) {
3330 /* we meet with a cross extent block merge. */ 3329 /* we meet with a cross extent block merge. */
3331 ret = ocfs2_get_right_path(inode, left_path, &right_path); 3330 ret = ocfs2_get_right_path(et, left_path, &right_path);
3332 if (ret) { 3331 if (ret) {
3333 mlog_errno(ret); 3332 mlog_errno(ret);
3334 goto out; 3333 goto out;
@@ -3425,7 +3424,7 @@ out:
3425 return ret; 3424 return ret;
3426} 3425}
3427 3426
3428static int ocfs2_get_left_path(struct inode *inode, 3427static int ocfs2_get_left_path(struct ocfs2_extent_tree *et,
3429 struct ocfs2_path *right_path, 3428 struct ocfs2_path *right_path,
3430 struct ocfs2_path **ret_left_path) 3429 struct ocfs2_path **ret_left_path)
3431{ 3430{
@@ -3438,7 +3437,7 @@ static int ocfs2_get_left_path(struct inode *inode,
3438 /* This function shouldn't be called for non-trees. */ 3437 /* This function shouldn't be called for non-trees. */
3439 BUG_ON(right_path->p_tree_depth == 0); 3438 BUG_ON(right_path->p_tree_depth == 0);
3440 3439
3441 ret = ocfs2_find_cpos_for_left_leaf(inode->i_sb, 3440 ret = ocfs2_find_cpos_for_left_leaf(ocfs2_metadata_cache_get_super(et->et_ci),
3442 right_path, &left_cpos); 3441 right_path, &left_cpos);
3443 if (ret) { 3442 if (ret) {
3444 mlog_errno(ret); 3443 mlog_errno(ret);
@@ -3455,7 +3454,7 @@ static int ocfs2_get_left_path(struct inode *inode,
3455 goto out; 3454 goto out;
3456 } 3455 }
3457 3456
3458 ret = ocfs2_find_path(INODE_CACHE(inode), left_path, left_cpos); 3457 ret = ocfs2_find_path(et->et_ci, left_path, left_cpos);
3459 if (ret) { 3458 if (ret) {
3460 mlog_errno(ret); 3459 mlog_errno(ret);
3461 goto out; 3460 goto out;
@@ -3478,12 +3477,11 @@ out:
3478 * remove the rightmost leaf extent block in the right_path and change 3477 * remove the rightmost leaf extent block in the right_path and change
3479 * the right path to indicate the new rightmost path. 3478 * the right path to indicate the new rightmost path.
3480 */ 3479 */
3481static int ocfs2_merge_rec_left(struct inode *inode, 3480static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
3482 struct ocfs2_path *right_path,
3483 handle_t *handle, 3481 handle_t *handle,
3482 struct ocfs2_extent_tree *et,
3484 struct ocfs2_extent_rec *split_rec, 3483 struct ocfs2_extent_rec *split_rec,
3485 struct ocfs2_cached_dealloc_ctxt *dealloc, 3484 struct ocfs2_cached_dealloc_ctxt *dealloc,
3486 struct ocfs2_extent_tree *et,
3487 int index) 3485 int index)
3488{ 3486{
3489 int ret, i, subtree_index = 0, has_empty_extent = 0; 3487 int ret, i, subtree_index = 0, has_empty_extent = 0;
@@ -3501,7 +3499,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3501 right_rec = &el->l_recs[index]; 3499 right_rec = &el->l_recs[index];
3502 if (index == 0) { 3500 if (index == 0) {
3503 /* we meet with a cross extent block merge. */ 3501 /* we meet with a cross extent block merge. */
3504 ret = ocfs2_get_left_path(inode, right_path, &left_path); 3502 ret = ocfs2_get_left_path(et, right_path, &left_path);
3505 if (ret) { 3503 if (ret) {
3506 mlog_errno(ret); 3504 mlog_errno(ret);
3507 goto out; 3505 goto out;
@@ -3531,7 +3529,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3531 root_bh = left_path->p_node[subtree_index].bh; 3529 root_bh = left_path->p_node[subtree_index].bh;
3532 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3530 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
3533 3531
3534 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path, 3532 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, right_path,
3535 subtree_index); 3533 subtree_index);
3536 if (ret) { 3534 if (ret) {
3537 mlog_errno(ret); 3535 mlog_errno(ret);
@@ -3540,14 +3538,14 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3540 3538
3541 for (i = subtree_index + 1; 3539 for (i = subtree_index + 1;
3542 i < path_num_items(right_path); i++) { 3540 i < path_num_items(right_path); i++) {
3543 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), 3541 ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
3544 right_path, i); 3542 right_path, i);
3545 if (ret) { 3543 if (ret) {
3546 mlog_errno(ret); 3544 mlog_errno(ret);
3547 goto out; 3545 goto out;
3548 } 3546 }
3549 3547
3550 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), 3548 ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
3551 left_path, i); 3549 left_path, i);
3552 if (ret) { 3550 if (ret) {
3553 mlog_errno(ret); 3551 mlog_errno(ret);
@@ -3560,7 +3558,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3560 has_empty_extent = 1; 3558 has_empty_extent = 1;
3561 } 3559 }
3562 3560
3563 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path, 3561 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, right_path,
3564 path_num_items(right_path) - 1); 3562 path_num_items(right_path) - 1);
3565 if (ret) { 3563 if (ret) {
3566 mlog_errno(ret); 3564 mlog_errno(ret);
@@ -3579,7 +3577,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3579 3577
3580 le32_add_cpu(&right_rec->e_cpos, split_clusters); 3578 le32_add_cpu(&right_rec->e_cpos, split_clusters);
3581 le64_add_cpu(&right_rec->e_blkno, 3579 le64_add_cpu(&right_rec->e_blkno,
3582 ocfs2_clusters_to_blocks(inode->i_sb, split_clusters)); 3580 ocfs2_clusters_to_blocks(ocfs2_metadata_cache_get_super(et->et_ci),
3581 split_clusters));
3583 le16_add_cpu(&right_rec->e_leaf_clusters, -split_clusters); 3582 le16_add_cpu(&right_rec->e_leaf_clusters, -split_clusters);
3584 3583
3585 ocfs2_cleanup_merge(el, index); 3584 ocfs2_cleanup_merge(el, index);
@@ -3677,8 +3676,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3677 * prevoius extent block. It is more efficient and easier 3676 * prevoius extent block. It is more efficient and easier
3678 * if we do merge_right first and merge_left later. 3677 * if we do merge_right first and merge_left later.
3679 */ 3678 */
3680 ret = ocfs2_merge_rec_right(inode, path, 3679 ret = ocfs2_merge_rec_right(path, handle, et, split_rec,
3681 handle, et, split_rec,
3682 split_index); 3680 split_index);
3683 if (ret) { 3681 if (ret) {
3684 mlog_errno(ret); 3682 mlog_errno(ret);
@@ -3703,10 +3701,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3703 * Note that we don't pass split_rec here on purpose - 3701 * Note that we don't pass split_rec here on purpose -
3704 * we've merged it into the rec already. 3702 * we've merged it into the rec already.
3705 */ 3703 */
3706 ret = ocfs2_merge_rec_left(inode, path, 3704 ret = ocfs2_merge_rec_left(path, handle, et, rec,
3707 handle, rec, 3705 dealloc, split_index);
3708 dealloc, et,
3709 split_index);
3710 3706
3711 if (ret) { 3707 if (ret) {
3712 mlog_errno(ret); 3708 mlog_errno(ret);
@@ -3730,17 +3726,15 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3730 * the record on the left (hence the left merge). 3726 * the record on the left (hence the left merge).
3731 */ 3727 */
3732 if (ctxt->c_contig_type == CONTIG_RIGHT) { 3728 if (ctxt->c_contig_type == CONTIG_RIGHT) {
3733 ret = ocfs2_merge_rec_left(inode, 3729 ret = ocfs2_merge_rec_left(path, handle, et,
3734 path, 3730 split_rec, dealloc,
3735 handle, split_rec,
3736 dealloc, et,
3737 split_index); 3731 split_index);
3738 if (ret) { 3732 if (ret) {
3739 mlog_errno(ret); 3733 mlog_errno(ret);
3740 goto out; 3734 goto out;
3741 } 3735 }
3742 } else { 3736 } else {
3743 ret = ocfs2_merge_rec_right(inode, path, handle, 3737 ret = ocfs2_merge_rec_right(path, handle,
3744 et, split_rec, 3738 et, split_rec,
3745 split_index); 3739 split_index);
3746 if (ret) { 3740 if (ret) {