aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-12 22:20:13 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:55 -0400
commit7dc028056750328e74ca807041c822068384fe16 (patch)
tree507d64e5d1136afea9ad54b9011fea4dfbe8b15f
parent5c601aba8c5d9d5f944cf02b59e3288dd72ae6cf (diff)
ocfs2: Pass ocfs2_extent_tree to ocfs2_get_subtree_root()
Get rid of the inode argument. Use extent_tree instead. This means a few more functions have to pass an extent_tree around. Signed-off-by: Joel Becker <joel.becker@oracle.com>
-rw-r--r--fs/ocfs2/alloc.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 7a04e1791d1a..c3edd02c74e8 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1691,7 +1691,7 @@ set_and_inc:
1691 * 1691 *
1692 * The array index of the subtree root is passed back. 1692 * The array index of the subtree root is passed back.
1693 */ 1693 */
1694static int ocfs2_find_subtree_root(struct inode *inode, 1694static int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et,
1695 struct ocfs2_path *left, 1695 struct ocfs2_path *left,
1696 struct ocfs2_path *right) 1696 struct ocfs2_path *right)
1697{ 1697{
@@ -1709,10 +1709,10 @@ static int ocfs2_find_subtree_root(struct inode *inode,
1709 * The caller didn't pass two adjacent paths. 1709 * The caller didn't pass two adjacent paths.
1710 */ 1710 */
1711 mlog_bug_on_msg(i > left->p_tree_depth, 1711 mlog_bug_on_msg(i > left->p_tree_depth,
1712 "Inode %lu, left depth %u, right depth %u\n" 1712 "Owner %llu, left depth %u, right depth %u\n"
1713 "left leaf blk %llu, right leaf blk %llu\n", 1713 "left leaf blk %llu, right leaf blk %llu\n",
1714 inode->i_ino, left->p_tree_depth, 1714 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
1715 right->p_tree_depth, 1715 left->p_tree_depth, right->p_tree_depth,
1716 (unsigned long long)path_leaf_bh(left)->b_blocknr, 1716 (unsigned long long)path_leaf_bh(left)->b_blocknr,
1717 (unsigned long long)path_leaf_bh(right)->b_blocknr); 1717 (unsigned long long)path_leaf_bh(right)->b_blocknr);
1718 } while (left->p_node[i].bh->b_blocknr == 1718 } while (left->p_node[i].bh->b_blocknr ==
@@ -2422,7 +2422,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode, handle_t *handle,
2422 goto out_ret_path; 2422 goto out_ret_path;
2423 } 2423 }
2424 2424
2425 start = ocfs2_find_subtree_root(inode, left_path, right_path); 2425 start = ocfs2_find_subtree_root(et, left_path, right_path);
2426 2426
2427 mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", 2427 mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n",
2428 start, 2428 start,
@@ -2933,7 +2933,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2933 goto out; 2933 goto out;
2934 } 2934 }
2935 2935
2936 subtree_root = ocfs2_find_subtree_root(inode, left_path, 2936 subtree_root = ocfs2_find_subtree_root(et, left_path,
2937 right_path); 2937 right_path);
2938 2938
2939 mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", 2939 mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n",
@@ -3068,7 +3068,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
3068 goto out; 3068 goto out;
3069 } 3069 }
3070 3070
3071 subtree_index = ocfs2_find_subtree_root(inode, left_path, path); 3071 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
3072 3072
3073 ocfs2_unlink_subtree(handle, et, left_path, path, 3073 ocfs2_unlink_subtree(handle, et, left_path, path,
3074 subtree_index, dealloc); 3074 subtree_index, dealloc);
@@ -3324,6 +3324,7 @@ out:
3324static int ocfs2_merge_rec_right(struct inode *inode, 3324static int ocfs2_merge_rec_right(struct inode *inode,
3325 struct ocfs2_path *left_path, 3325 struct ocfs2_path *left_path,
3326 handle_t *handle, 3326 handle_t *handle,
3327 struct ocfs2_extent_tree *et,
3327 struct ocfs2_extent_rec *split_rec, 3328 struct ocfs2_extent_rec *split_rec,
3328 int index) 3329 int index)
3329{ 3330{
@@ -3363,8 +3364,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3363 le16_to_cpu(left_rec->e_leaf_clusters) != 3364 le16_to_cpu(left_rec->e_leaf_clusters) !=
3364 le32_to_cpu(right_rec->e_cpos)); 3365 le32_to_cpu(right_rec->e_cpos));
3365 3366
3366 subtree_index = ocfs2_find_subtree_root(inode, 3367 subtree_index = ocfs2_find_subtree_root(et, left_path,
3367 left_path, right_path); 3368 right_path);
3368 3369
3369 ret = ocfs2_extend_rotate_transaction(handle, subtree_index, 3370 ret = ocfs2_extend_rotate_transaction(handle, subtree_index,
3370 handle->h_buffer_credits, 3371 handle->h_buffer_credits,
@@ -3377,7 +3378,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3377 root_bh = left_path->p_node[subtree_index].bh; 3378 root_bh = left_path->p_node[subtree_index].bh;
3378 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3379 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
3379 3380
3380 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path, 3381 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, right_path,
3381 subtree_index); 3382 subtree_index);
3382 if (ret) { 3383 if (ret) {
3383 mlog_errno(ret); 3384 mlog_errno(ret);
@@ -3386,14 +3387,14 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3386 3387
3387 for (i = subtree_index + 1; 3388 for (i = subtree_index + 1;
3388 i < path_num_items(right_path); i++) { 3389 i < path_num_items(right_path); i++) {
3389 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), 3390 ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
3390 right_path, i); 3391 right_path, i);
3391 if (ret) { 3392 if (ret) {
3392 mlog_errno(ret); 3393 mlog_errno(ret);
3393 goto out; 3394 goto out;
3394 } 3395 }
3395 3396
3396 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), 3397 ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
3397 left_path, i); 3398 left_path, i);
3398 if (ret) { 3399 if (ret) {
3399 mlog_errno(ret); 3400 mlog_errno(ret);
@@ -3406,7 +3407,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3406 right_rec = &el->l_recs[index + 1]; 3407 right_rec = &el->l_recs[index + 1];
3407 } 3408 }
3408 3409
3409 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), left_path, 3410 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, left_path,
3410 path_num_items(left_path) - 1); 3411 path_num_items(left_path) - 1);
3411 if (ret) { 3412 if (ret) {
3412 mlog_errno(ret); 3413 mlog_errno(ret);
@@ -3417,7 +3418,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3417 3418
3418 le32_add_cpu(&right_rec->e_cpos, -split_clusters); 3419 le32_add_cpu(&right_rec->e_cpos, -split_clusters);
3419 le64_add_cpu(&right_rec->e_blkno, 3420 le64_add_cpu(&right_rec->e_blkno,
3420 -ocfs2_clusters_to_blocks(inode->i_sb, split_clusters)); 3421 -ocfs2_clusters_to_blocks(ocfs2_metadata_cache_get_super(et->et_ci),
3422 split_clusters));
3421 le16_add_cpu(&right_rec->e_leaf_clusters, split_clusters); 3423 le16_add_cpu(&right_rec->e_leaf_clusters, split_clusters);
3422 3424
3423 ocfs2_cleanup_merge(el, index); 3425 ocfs2_cleanup_merge(el, index);
@@ -3532,8 +3534,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3532 le16_to_cpu(left_rec->e_leaf_clusters) != 3534 le16_to_cpu(left_rec->e_leaf_clusters) !=
3533 le32_to_cpu(split_rec->e_cpos)); 3535 le32_to_cpu(split_rec->e_cpos));
3534 3536
3535 subtree_index = ocfs2_find_subtree_root(inode, 3537 subtree_index = ocfs2_find_subtree_root(et, left_path,
3536 left_path, right_path); 3538 right_path);
3537 3539
3538 ret = ocfs2_extend_rotate_transaction(handle, subtree_index, 3540 ret = ocfs2_extend_rotate_transaction(handle, subtree_index,
3539 handle->h_buffer_credits, 3541 handle->h_buffer_credits,
@@ -3694,7 +3696,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3694 * if we do merge_right first and merge_left later. 3696 * if we do merge_right first and merge_left later.
3695 */ 3697 */
3696 ret = ocfs2_merge_rec_right(inode, path, 3698 ret = ocfs2_merge_rec_right(inode, path,
3697 handle, split_rec, 3699 handle, et, split_rec,
3698 split_index); 3700 split_index);
3699 if (ret) { 3701 if (ret) {
3700 mlog_errno(ret); 3702 mlog_errno(ret);
@@ -3758,9 +3760,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3758 goto out; 3760 goto out;
3759 } 3761 }
3760 } else { 3762 } else {
3761 ret = ocfs2_merge_rec_right(inode, 3763 ret = ocfs2_merge_rec_right(inode, path, handle,
3762 path, 3764 et, split_rec,
3763 handle, split_rec,
3764 split_index); 3765 split_index);
3765 if (ret) { 3766 if (ret) {
3766 mlog_errno(ret); 3767 mlog_errno(ret);
@@ -4118,6 +4119,7 @@ static void ocfs2_split_record(struct inode *inode,
4118 */ 4119 */
4119static int ocfs2_insert_path(struct inode *inode, 4120static int ocfs2_insert_path(struct inode *inode,
4120 handle_t *handle, 4121 handle_t *handle,
4122 struct ocfs2_extent_tree *et,
4121 struct ocfs2_path *left_path, 4123 struct ocfs2_path *left_path,
4122 struct ocfs2_path *right_path, 4124 struct ocfs2_path *right_path,
4123 struct ocfs2_extent_rec *insert_rec, 4125 struct ocfs2_extent_rec *insert_rec,
@@ -4143,7 +4145,7 @@ static int ocfs2_insert_path(struct inode *inode,
4143 goto out; 4145 goto out;
4144 } 4146 }
4145 4147
4146 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, left_path); 4148 ret = ocfs2_journal_access_path(et->et_ci, handle, left_path);
4147 if (ret < 0) { 4149 if (ret < 0) {
4148 mlog_errno(ret); 4150 mlog_errno(ret);
4149 goto out; 4151 goto out;
@@ -4154,7 +4156,7 @@ static int ocfs2_insert_path(struct inode *inode,
4154 * Pass both paths to the journal. The majority of inserts 4156 * Pass both paths to the journal. The majority of inserts
4155 * will be touching all components anyway. 4157 * will be touching all components anyway.
4156 */ 4158 */
4157 ret = ocfs2_journal_access_path(INODE_CACHE(inode), handle, right_path); 4159 ret = ocfs2_journal_access_path(et->et_ci, handle, right_path);
4158 if (ret < 0) { 4160 if (ret < 0) {
4159 mlog_errno(ret); 4161 mlog_errno(ret);
4160 goto out; 4162 goto out;
@@ -4194,7 +4196,7 @@ static int ocfs2_insert_path(struct inode *inode,
4194 * 4196 *
4195 * XXX: Should we extend the transaction here? 4197 * XXX: Should we extend the transaction here?
4196 */ 4198 */
4197 subtree_index = ocfs2_find_subtree_root(inode, left_path, 4199 subtree_index = ocfs2_find_subtree_root(et, left_path,
4198 right_path); 4200 right_path);
4199 ocfs2_complete_edge_insert(handle, left_path, right_path, 4201 ocfs2_complete_edge_insert(handle, left_path, right_path,
4200 subtree_index); 4202 subtree_index);
@@ -4297,7 +4299,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4297 } 4299 }
4298 } 4300 }
4299 4301
4300 ret = ocfs2_insert_path(inode, handle, left_path, right_path, 4302 ret = ocfs2_insert_path(inode, handle, et, left_path, right_path,
4301 insert_rec, type); 4303 insert_rec, type);
4302 if (ret) { 4304 if (ret) {
4303 mlog_errno(ret); 4305 mlog_errno(ret);
@@ -5397,7 +5399,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5397 if (left_path) { 5399 if (left_path) {
5398 int subtree_index; 5400 int subtree_index;
5399 5401
5400 subtree_index = ocfs2_find_subtree_root(inode, left_path, path); 5402 subtree_index = ocfs2_find_subtree_root(et, left_path, path);
5401 ocfs2_complete_edge_insert(handle, left_path, path, 5403 ocfs2_complete_edge_insert(handle, left_path, path,
5402 subtree_index); 5404 subtree_index);
5403 } 5405 }