|
@@ -4312,7 +4312,8 @@ out:
|
|
}
|
|
}
|
|
|
|
|
|
static enum ocfs2_contig_type
|
|
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_list *el, int index,
|
|
struct ocfs2_extent_rec *split_rec)
|
|
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 ocfs2_path *left_path = NULL, *right_path = NULL;
|
|
struct buffer_head *bh;
|
|
struct buffer_head *bh;
|
|
struct ocfs2_extent_block *eb;
|
|
struct ocfs2_extent_block *eb;
|
|
|
|
+ struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
|
|
|
|
|
|
if (index > 0) {
|
|
if (index > 0) {
|
|
rec = &el->l_recs[index - 1];
|
|
rec = &el->l_recs[index - 1];
|
|
} else if (path->p_tree_depth > 0) {
|
|
} 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)
|
|
if (status)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
@@ -4338,8 +4339,8 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
|
|
if (!left_path)
|
|
if (!left_path)
|
|
goto out;
|
|
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)
|
|
if (status)
|
|
goto out;
|
|
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)) {
|
|
le16_to_cpu(new_el->l_count)) {
|
|
bh = path_leaf_bh(left_path);
|
|
bh = path_leaf_bh(left_path);
|
|
eb = (struct ocfs2_extent_block *)bh->b_data;
|
|
eb = (struct ocfs2_extent_block *)bh->b_data;
|
|
- ocfs2_error(inode->i_sb,
|
|
|
|
|
|
+ ocfs2_error(sb,
|
|
"Extent block #%llu has an "
|
|
"Extent block #%llu has an "
|
|
"invalid l_next_free_rec of "
|
|
"invalid l_next_free_rec of "
|
|
"%d. It should have "
|
|
"%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)
|
|
if (split_rec->e_cpos == el->l_recs[index].e_cpos)
|
|
ret = CONTIG_RIGHT;
|
|
ret = CONTIG_RIGHT;
|
|
} else {
|
|
} 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];
|
|
rec = &el->l_recs[index + 1];
|
|
else if (le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count) &&
|
|
else if (le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count) &&
|
|
path->p_tree_depth > 0) {
|
|
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)
|
|
if (status)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
@@ -4395,7 +4395,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
|
|
if (!right_path)
|
|
if (!right_path)
|
|
goto out;
|
|
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)
|
|
if (status)
|
|
goto out;
|
|
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) {
|
|
if (le16_to_cpu(new_el->l_next_free_rec) <= 1) {
|
|
bh = path_leaf_bh(right_path);
|
|
bh = path_leaf_bh(right_path);
|
|
eb = (struct ocfs2_extent_block *)bh->b_data;
|
|
eb = (struct ocfs2_extent_block *)bh->b_data;
|
|
- ocfs2_error(inode->i_sb,
|
|
|
|
|
|
+ ocfs2_error(sb,
|
|
"Extent block #%llu has an "
|
|
"Extent block #%llu has an "
|
|
"invalid l_next_free_rec of %d",
|
|
"invalid l_next_free_rec of %d",
|
|
(unsigned long long)le64_to_cpu(eb->h_blkno),
|
|
(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) {
|
|
if (rec) {
|
|
enum ocfs2_contig_type contig_type;
|
|
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)
|
|
if (contig_type == CONTIG_LEFT && ret == CONTIG_RIGHT)
|
|
ret = CONTIG_LEFTRIGHT;
|
|
ret = CONTIG_LEFTRIGHT;
|
|
@@ -5035,7 +5035,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
|
|
goto out;
|
|
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_index,
|
|
split_rec);
|
|
split_rec);
|
|
|
|
|