ocfs2: Swap inode for extent_tree in ocfs2_figure_merge_contig_type().
authorJoel Becker <joel.becker@oracle.com>
Fri, 13 Feb 2009 11:09:54 +0000 (03:09 -0800)
committerJoel Becker <joel.becker@oracle.com>
Fri, 4 Sep 2009 23:08:07 +0000 (16:08 -0700)
We don't want struct inode in generic btree operations.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
fs/ocfs2/alloc.c

index 2431bbb..9b79150 100644 (file)
@@ -4312,7 +4312,8 @@ out:
 }
 
 static enum ocfs2_contig_type
-ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
+ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et,
+                              struct ocfs2_path *path,
                               struct ocfs2_extent_list *el, int index,
                               struct ocfs2_extent_rec *split_rec)
 {
@@ -4324,12 +4325,12 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
        struct ocfs2_path *left_path = NULL, *right_path = NULL;
        struct buffer_head *bh;
        struct ocfs2_extent_block *eb;
+       struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
 
        if (index > 0) {
                rec = &el->l_recs[index - 1];
        } else if (path->p_tree_depth > 0) {
-               status = ocfs2_find_cpos_for_left_leaf(inode->i_sb,
-                                                      path, &left_cpos);
+               status = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos);
                if (status)
                        goto out;
 
@@ -4338,8 +4339,8 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
                        if (!left_path)
                                goto out;
 
-                       status = ocfs2_find_path(INODE_CACHE(inode),
-                                                left_path, left_cpos);
+                       status = ocfs2_find_path(et->et_ci, left_path,
+                                                left_cpos);
                        if (status)
                                goto out;
 
@@ -4349,7 +4350,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
                            le16_to_cpu(new_el->l_count)) {
                                bh = path_leaf_bh(left_path);
                                eb = (struct ocfs2_extent_block *)bh->b_data;
-                               ocfs2_error(inode->i_sb,
+                               ocfs2_error(sb,
                                            "Extent block #%llu has an "
                                            "invalid l_next_free_rec of "
                                            "%d.  It should have "
@@ -4374,7 +4375,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
                        if (split_rec->e_cpos == el->l_recs[index].e_cpos)
                                ret = CONTIG_RIGHT;
                } else {
-                       ret = ocfs2_extent_contig(inode->i_sb, rec, split_rec);
+                       ret = ocfs2_extent_contig(sb, rec, split_rec);
                }
        }
 
@@ -4383,8 +4384,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
                rec = &el->l_recs[index + 1];
        else if (le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count) &&
                 path->p_tree_depth > 0) {
-               status = ocfs2_find_cpos_for_right_leaf(inode->i_sb,
-                                                       path, &right_cpos);
+               status = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos);
                if (status)
                        goto out;
 
@@ -4395,7 +4395,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
                if (!right_path)
                        goto out;
 
-               status = ocfs2_find_path(INODE_CACHE(inode), right_path, right_cpos);
+               status = ocfs2_find_path(et->et_ci, right_path, right_cpos);
                if (status)
                        goto out;
 
@@ -4405,7 +4405,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
                        if (le16_to_cpu(new_el->l_next_free_rec) <= 1) {
                                bh = path_leaf_bh(right_path);
                                eb = (struct ocfs2_extent_block *)bh->b_data;
-                               ocfs2_error(inode->i_sb,
+                               ocfs2_error(sb,
                                            "Extent block #%llu has an "
                                            "invalid l_next_free_rec of %d",
                                            (unsigned long long)le64_to_cpu(eb->h_blkno),
@@ -4420,7 +4420,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
        if (rec) {
                enum ocfs2_contig_type contig_type;
 
-               contig_type = ocfs2_extent_contig(inode->i_sb, rec, split_rec);
+               contig_type = ocfs2_extent_contig(sb, rec, split_rec);
 
                if (contig_type == CONTIG_LEFT && ret == CONTIG_RIGHT)
                        ret = CONTIG_LEFTRIGHT;
@@ -5035,7 +5035,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
                goto out;
        }
 
-       ctxt.c_contig_type = ocfs2_figure_merge_contig_type(inode, path, el,
+       ctxt.c_contig_type = ocfs2_figure_merge_contig_type(et, path, el,
                                                            split_index,
                                                            split_rec);