Commit 4fe82c31 authored by Joel Becker's avatar Joel Becker

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: default avatarJoel Becker <joel.becker@oracle.com>
parent 70f18c08
...@@ -3250,7 +3250,7 @@ static void ocfs2_cleanup_merge(struct ocfs2_extent_list *el, ...@@ -3250,7 +3250,7 @@ static void ocfs2_cleanup_merge(struct ocfs2_extent_list *el,
} }
} }
static int ocfs2_get_right_path(struct inode *inode, static int ocfs2_get_right_path(struct ocfs2_extent_tree *et,
struct ocfs2_path *left_path, struct ocfs2_path *left_path,
struct ocfs2_path **ret_right_path) struct ocfs2_path **ret_right_path)
{ {
...@@ -3267,8 +3267,8 @@ static int ocfs2_get_right_path(struct inode *inode, ...@@ -3267,8 +3267,8 @@ static int ocfs2_get_right_path(struct inode *inode,
left_el = path_leaf_el(left_path); left_el = path_leaf_el(left_path);
BUG_ON(left_el->l_next_free_rec != left_el->l_count); BUG_ON(left_el->l_next_free_rec != left_el->l_count);
ret = ocfs2_find_cpos_for_right_leaf(inode->i_sb, left_path, ret = ocfs2_find_cpos_for_right_leaf(ocfs2_metadata_cache_get_super(et->et_ci),
&right_cpos); left_path, &right_cpos);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3284,7 +3284,7 @@ static int ocfs2_get_right_path(struct inode *inode, ...@@ -3284,7 +3284,7 @@ static int ocfs2_get_right_path(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_find_path(INODE_CACHE(inode), right_path, right_cpos); ret = ocfs2_find_path(et->et_ci, right_path, right_cpos);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3304,8 +3304,7 @@ out: ...@@ -3304,8 +3304,7 @@ out:
* For index == l_count - 1, the "next" means the 1st extent rec of the * For index == l_count - 1, the "next" means the 1st extent rec of the
* next extent block. * next extent block.
*/ */
static int ocfs2_merge_rec_right(struct inode *inode, static int ocfs2_merge_rec_right(struct ocfs2_path *left_path,
struct ocfs2_path *left_path,
handle_t *handle, handle_t *handle,
struct ocfs2_extent_tree *et, struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *split_rec, struct ocfs2_extent_rec *split_rec,
...@@ -3328,7 +3327,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, ...@@ -3328,7 +3327,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,
if (index == le16_to_cpu(el->l_next_free_rec) - 1 && if (index == le16_to_cpu(el->l_next_free_rec) - 1 &&
le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) { le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) {
/* we meet with a cross extent block merge. */ /* we meet with a cross extent block merge. */
ret = ocfs2_get_right_path(inode, left_path, &right_path); ret = ocfs2_get_right_path(et, left_path, &right_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3425,7 +3424,7 @@ out: ...@@ -3425,7 +3424,7 @@ out:
return ret; return ret;
} }
static int ocfs2_get_left_path(struct inode *inode, static int ocfs2_get_left_path(struct ocfs2_extent_tree *et,
struct ocfs2_path *right_path, struct ocfs2_path *right_path,
struct ocfs2_path **ret_left_path) struct ocfs2_path **ret_left_path)
{ {
...@@ -3438,7 +3437,7 @@ static int ocfs2_get_left_path(struct inode *inode, ...@@ -3438,7 +3437,7 @@ static int ocfs2_get_left_path(struct inode *inode,
/* This function shouldn't be called for non-trees. */ /* This function shouldn't be called for non-trees. */
BUG_ON(right_path->p_tree_depth == 0); BUG_ON(right_path->p_tree_depth == 0);
ret = ocfs2_find_cpos_for_left_leaf(inode->i_sb, ret = ocfs2_find_cpos_for_left_leaf(ocfs2_metadata_cache_get_super(et->et_ci),
right_path, &left_cpos); right_path, &left_cpos);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3455,7 +3454,7 @@ static int ocfs2_get_left_path(struct inode *inode, ...@@ -3455,7 +3454,7 @@ static int ocfs2_get_left_path(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_find_path(INODE_CACHE(inode), left_path, left_cpos); ret = ocfs2_find_path(et->et_ci, left_path, left_cpos);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3478,12 +3477,11 @@ out: ...@@ -3478,12 +3477,11 @@ out:
* remove the rightmost leaf extent block in the right_path and change * remove the rightmost leaf extent block in the right_path and change
* the right path to indicate the new rightmost path. * the right path to indicate the new rightmost path.
*/ */
static int ocfs2_merge_rec_left(struct inode *inode, static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
struct ocfs2_path *right_path,
handle_t *handle, handle_t *handle,
struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *split_rec, struct ocfs2_extent_rec *split_rec,
struct ocfs2_cached_dealloc_ctxt *dealloc, struct ocfs2_cached_dealloc_ctxt *dealloc,
struct ocfs2_extent_tree *et,
int index) int index)
{ {
int ret, i, subtree_index = 0, has_empty_extent = 0; int ret, i, subtree_index = 0, has_empty_extent = 0;
...@@ -3501,7 +3499,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, ...@@ -3501,7 +3499,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
right_rec = &el->l_recs[index]; right_rec = &el->l_recs[index];
if (index == 0) { if (index == 0) {
/* we meet with a cross extent block merge. */ /* we meet with a cross extent block merge. */
ret = ocfs2_get_left_path(inode, right_path, &left_path); ret = ocfs2_get_left_path(et, right_path, &left_path);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3531,7 +3529,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, ...@@ -3531,7 +3529,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
root_bh = left_path->p_node[subtree_index].bh; root_bh = left_path->p_node[subtree_index].bh;
BUG_ON(root_bh != right_path->p_node[subtree_index].bh); BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path, ret = ocfs2_path_bh_journal_access(handle, et->et_ci, right_path,
subtree_index); subtree_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3540,14 +3538,14 @@ static int ocfs2_merge_rec_left(struct inode *inode, ...@@ -3540,14 +3538,14 @@ static int ocfs2_merge_rec_left(struct inode *inode,
for (i = subtree_index + 1; for (i = subtree_index + 1;
i < path_num_items(right_path); i++) { i < path_num_items(right_path); i++) {
ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
right_path, i); right_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), ret = ocfs2_path_bh_journal_access(handle, et->et_ci,
left_path, i); left_path, i);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3560,7 +3558,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, ...@@ -3560,7 +3558,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,
has_empty_extent = 1; has_empty_extent = 1;
} }
ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), right_path, ret = ocfs2_path_bh_journal_access(handle, et->et_ci, right_path,
path_num_items(right_path) - 1); path_num_items(right_path) - 1);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3579,7 +3577,8 @@ static int ocfs2_merge_rec_left(struct inode *inode, ...@@ -3579,7 +3577,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,
le32_add_cpu(&right_rec->e_cpos, split_clusters); le32_add_cpu(&right_rec->e_cpos, split_clusters);
le64_add_cpu(&right_rec->e_blkno, le64_add_cpu(&right_rec->e_blkno,
ocfs2_clusters_to_blocks(inode->i_sb, split_clusters)); ocfs2_clusters_to_blocks(ocfs2_metadata_cache_get_super(et->et_ci),
split_clusters));
le16_add_cpu(&right_rec->e_leaf_clusters, -split_clusters); le16_add_cpu(&right_rec->e_leaf_clusters, -split_clusters);
ocfs2_cleanup_merge(el, index); ocfs2_cleanup_merge(el, index);
...@@ -3677,8 +3676,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3677,8 +3676,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
* prevoius extent block. It is more efficient and easier * prevoius extent block. It is more efficient and easier
* if we do merge_right first and merge_left later. * if we do merge_right first and merge_left later.
*/ */
ret = ocfs2_merge_rec_right(inode, path, ret = ocfs2_merge_rec_right(path, handle, et, split_rec,
handle, et, split_rec,
split_index); split_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3703,10 +3701,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3703,10 +3701,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
* Note that we don't pass split_rec here on purpose - * Note that we don't pass split_rec here on purpose -
* we've merged it into the rec already. * we've merged it into the rec already.
*/ */
ret = ocfs2_merge_rec_left(inode, path, ret = ocfs2_merge_rec_left(path, handle, et, rec,
handle, rec, dealloc, split_index);
dealloc, et,
split_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -3730,17 +3726,15 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3730,17 +3726,15 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
* the record on the left (hence the left merge). * the record on the left (hence the left merge).
*/ */
if (ctxt->c_contig_type == CONTIG_RIGHT) { if (ctxt->c_contig_type == CONTIG_RIGHT) {
ret = ocfs2_merge_rec_left(inode, ret = ocfs2_merge_rec_left(path, handle, et,
path, split_rec, dealloc,
handle, split_rec,
dealloc, et,
split_index); split_index);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} }
} else { } else {
ret = ocfs2_merge_rec_right(inode, path, handle, ret = ocfs2_merge_rec_right(path, handle,
et, split_rec, et, split_rec,
split_index); split_index);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment