aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-12 22:10:13 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:07:55 -0400
commit5c601aba8c5d9d5f944cf02b59e3288dd72ae6cf (patch)
tree7b2a8f2daecfa433a6fa73a7cfecd594fe87dfaf /fs/ocfs2/alloc.c
parent4619c73e7c9bd10bac6b60925fa28d5a2eeaf6ed (diff)
ocfs2: Get inode out of ocfs2_rotate_subtree_root_right().
Pass the ocfs2_extent_list down through ocfs2_rotate_tree_right() and get rid of struct inode in ocfs2_rotate_subtree_root_right(). Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 4a8e9717f961..7a04e1791d1a 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -2062,8 +2062,8 @@ static void ocfs2_complete_edge_insert(handle_t *handle,
2062 mlog_errno(ret); 2062 mlog_errno(ret);
2063} 2063}
2064 2064
2065static int ocfs2_rotate_subtree_right(struct inode *inode, 2065static int ocfs2_rotate_subtree_right(handle_t *handle,
2066 handle_t *handle, 2066 struct ocfs2_extent_tree *et,
2067 struct ocfs2_path *left_path, 2067 struct ocfs2_path *left_path,
2068 struct ocfs2_path *right_path, 2068 struct ocfs2_path *right_path,
2069 int subtree_index) 2069 int subtree_index)
@@ -2079,10 +2079,10 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
2079 left_el = path_leaf_el(left_path); 2079 left_el = path_leaf_el(left_path);
2080 2080
2081 if (left_el->l_next_free_rec != left_el->l_count) { 2081 if (left_el->l_next_free_rec != left_el->l_count) {
2082 ocfs2_error(inode->i_sb, 2082 ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
2083 "Inode %llu has non-full interior leaf node %llu" 2083 "Inode %llu has non-full interior leaf node %llu"
2084 "(next free = %u)", 2084 "(next free = %u)",
2085 (unsigned long long)OCFS2_I(inode)->ip_blkno, 2085 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
2086 (unsigned long long)left_leaf_bh->b_blocknr, 2086 (unsigned long long)left_leaf_bh->b_blocknr,
2087 le16_to_cpu(left_el->l_next_free_rec)); 2087 le16_to_cpu(left_el->l_next_free_rec));
2088 return -EROFS; 2088 return -EROFS;
@@ -2098,7 +2098,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
2098 root_bh = left_path->p_node[subtree_index].bh; 2098 root_bh = left_path->p_node[subtree_index].bh;
2099 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 2099 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
2100 2100
2101 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path, 2101 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, right_path,
2102 subtree_index); 2102 subtree_index);
2103 if (ret) { 2103 if (ret) {
2104 mlog_errno(ret); 2104 mlog_errno(ret);
@@ -2106,14 +2106,14 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
2106 } 2106 }
2107 2107
2108 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { 2108 for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
2109 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), 2109 ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
2110 right_path, i); 2110 right_path, i);
2111 if (ret) { 2111 if (ret) {
2112 mlog_errno(ret); 2112 mlog_errno(ret);
2113 goto out; 2113 goto out;
2114 } 2114 }
2115 2115
2116 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), 2116 ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
2117 left_path, i); 2117 left_path, i);
2118 if (ret) { 2118 if (ret) {
2119 mlog_errno(ret); 2119 mlog_errno(ret);
@@ -2127,7 +2127,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
2127 /* This is a code error, not a disk corruption. */ 2127 /* This is a code error, not a disk corruption. */
2128 mlog_bug_on_msg(!right_el->l_next_free_rec, "Inode %llu: Rotate fails " 2128 mlog_bug_on_msg(!right_el->l_next_free_rec, "Inode %llu: Rotate fails "
2129 "because rightmost leaf block %llu is empty\n", 2129 "because rightmost leaf block %llu is empty\n",
2130 (unsigned long long)OCFS2_I(inode)->ip_blkno, 2130 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
2131 (unsigned long long)right_leaf_bh->b_blocknr); 2131 (unsigned long long)right_leaf_bh->b_blocknr);
2132 2132
2133 ocfs2_create_empty_extent(right_el); 2133 ocfs2_create_empty_extent(right_el);
@@ -2325,8 +2325,8 @@ static int ocfs2_leftmost_rec_contains(struct ocfs2_extent_list *el, u32 cpos)
2325 * *ret_left_path will contain a valid path which can be passed to 2325 * *ret_left_path will contain a valid path which can be passed to
2326 * ocfs2_insert_path(). 2326 * ocfs2_insert_path().
2327 */ 2327 */
2328static int ocfs2_rotate_tree_right(struct inode *inode, 2328static int ocfs2_rotate_tree_right(struct inode *inode, handle_t *handle,
2329 handle_t *handle, 2329 struct ocfs2_extent_tree *et,
2330 enum ocfs2_split_type split, 2330 enum ocfs2_split_type split,
2331 u32 insert_cpos, 2331 u32 insert_cpos,
2332 struct ocfs2_path *right_path, 2332 struct ocfs2_path *right_path,
@@ -2335,6 +2335,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2335 int ret, start, orig_credits = handle->h_buffer_credits; 2335 int ret, start, orig_credits = handle->h_buffer_credits;
2336 u32 cpos; 2336 u32 cpos;
2337 struct ocfs2_path *left_path = NULL; 2337 struct ocfs2_path *left_path = NULL;
2338 struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
2338 2339
2339 *ret_left_path = NULL; 2340 *ret_left_path = NULL;
2340 2341
@@ -2345,7 +2346,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2345 goto out; 2346 goto out;
2346 } 2347 }
2347 2348
2348 ret = ocfs2_find_cpos_for_left_leaf(inode->i_sb, right_path, &cpos); 2349 ret = ocfs2_find_cpos_for_left_leaf(sb, right_path, &cpos);
2349 if (ret) { 2350 if (ret) {
2350 mlog_errno(ret); 2351 mlog_errno(ret);
2351 goto out; 2352 goto out;
@@ -2383,7 +2384,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2383 mlog(0, "Rotating a tree: ins. cpos: %u, left path cpos: %u\n", 2384 mlog(0, "Rotating a tree: ins. cpos: %u, left path cpos: %u\n",
2384 insert_cpos, cpos); 2385 insert_cpos, cpos);
2385 2386
2386 ret = ocfs2_find_path(INODE_CACHE(inode), left_path, cpos); 2387 ret = ocfs2_find_path(et->et_ci, left_path, cpos);
2387 if (ret) { 2388 if (ret) {
2388 mlog_errno(ret); 2389 mlog_errno(ret);
2389 goto out; 2390 goto out;
@@ -2391,10 +2392,11 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2391 2392
2392 mlog_bug_on_msg(path_leaf_bh(left_path) == 2393 mlog_bug_on_msg(path_leaf_bh(left_path) ==
2393 path_leaf_bh(right_path), 2394 path_leaf_bh(right_path),
2394 "Inode %lu: error during insert of %u " 2395 "Owner %llu: error during insert of %u "
2395 "(left path cpos %u) results in two identical " 2396 "(left path cpos %u) results in two identical "
2396 "paths ending at %llu\n", 2397 "paths ending at %llu\n",
2397 inode->i_ino, insert_cpos, cpos, 2398 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
2399 insert_cpos, cpos,
2398 (unsigned long long) 2400 (unsigned long long)
2399 path_leaf_bh(left_path)->b_blocknr); 2401 path_leaf_bh(left_path)->b_blocknr);
2400 2402
@@ -2434,7 +2436,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2434 goto out; 2436 goto out;
2435 } 2437 }
2436 2438
2437 ret = ocfs2_rotate_subtree_right(inode, handle, left_path, 2439 ret = ocfs2_rotate_subtree_right(handle, et, left_path,
2438 right_path, start); 2440 right_path, start);
2439 if (ret) { 2441 if (ret) {
2440 mlog_errno(ret); 2442 mlog_errno(ret);
@@ -2466,8 +2468,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2466 */ 2468 */
2467 ocfs2_mv_path(right_path, left_path); 2469 ocfs2_mv_path(right_path, left_path);
2468 2470
2469 ret = ocfs2_find_cpos_for_left_leaf(inode->i_sb, right_path, 2471 ret = ocfs2_find_cpos_for_left_leaf(sb, right_path, &cpos);
2470 &cpos);
2471 if (ret) { 2472 if (ret) {
2472 mlog_errno(ret); 2473 mlog_errno(ret);
2473 goto out; 2474 goto out;
@@ -4268,7 +4269,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4268 * can wind up skipping both of these two special cases... 4269 * can wind up skipping both of these two special cases...
4269 */ 4270 */
4270 if (rotate) { 4271 if (rotate) {
4271 ret = ocfs2_rotate_tree_right(inode, handle, type->ins_split, 4272 ret = ocfs2_rotate_tree_right(inode, handle, et, type->ins_split,
4272 le32_to_cpu(insert_rec->e_cpos), 4273 le32_to_cpu(insert_rec->e_cpos),
4273 right_path, &left_path); 4274 right_path, &left_path);
4274 if (ret) { 4275 if (ret) {