Commit 70f18c08 authored by Joel Becker's avatar Joel Becker

ocfs2: ocfs2_rotate_tree_left() no longer needs struct inode.

It already gets ocfs2_extent_tree, so we can just use that.  This chains
to the same modification for ocfs2_remove_rightmost_path() and
ocfs2_rotate_rightmost_leaf_left().
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent e46f74dc
...@@ -2843,8 +2843,8 @@ static int ocfs2_find_cpos_for_right_leaf(struct super_block *sb, ...@@ -2843,8 +2843,8 @@ static int ocfs2_find_cpos_for_right_leaf(struct super_block *sb,
return ret; return ret;
} }
static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, static int ocfs2_rotate_rightmost_leaf_left(handle_t *handle,
handle_t *handle, struct ocfs2_extent_tree *et,
struct ocfs2_path *path) struct ocfs2_path *path)
{ {
int ret; int ret;
...@@ -2854,7 +2854,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, ...@@ -2854,7 +2854,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
if (!ocfs2_is_empty_extent(&el->l_recs[0])) if (!ocfs2_is_empty_extent(&el->l_recs[0]))
return 0; return 0;
ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path, ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
path_num_items(path) - 1); path_num_items(path) - 1);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
...@@ -2988,10 +2988,10 @@ static int __ocfs2_rotate_tree_left(handle_t *handle, ...@@ -2988,10 +2988,10 @@ static int __ocfs2_rotate_tree_left(handle_t *handle,
return ret; return ret;
} }
static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, static int ocfs2_remove_rightmost_path(handle_t *handle,
struct ocfs2_extent_tree *et,
struct ocfs2_path *path, struct ocfs2_path *path,
struct ocfs2_cached_dealloc_ctxt *dealloc, struct ocfs2_cached_dealloc_ctxt *dealloc)
struct ocfs2_extent_tree *et)
{ {
int ret, subtree_index; int ret, subtree_index;
u32 cpos; u32 cpos;
...@@ -3070,7 +3070,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, ...@@ -3070,7 +3070,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
* 'path' is also the leftmost path which * 'path' is also the leftmost path which
* means it must be the only one. This gets * means it must be the only one. This gets
* handled differently because we want to * handled differently because we want to
* revert the inode back to having extents * revert the root back to having extents
* in-line. * in-line.
*/ */
ocfs2_unlink_path(handle, et, dealloc, path, 1); ocfs2_unlink_path(handle, et, dealloc, path, 1);
...@@ -3106,10 +3106,10 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, ...@@ -3106,10 +3106,10 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
* the rightmost tree leaf record is removed so the caller is * the rightmost tree leaf record is removed so the caller is
* responsible for detecting and correcting that. * responsible for detecting and correcting that.
*/ */
static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle, static int ocfs2_rotate_tree_left(handle_t *handle,
struct ocfs2_extent_tree *et,
struct ocfs2_path *path, struct ocfs2_path *path,
struct ocfs2_cached_dealloc_ctxt *dealloc, struct ocfs2_cached_dealloc_ctxt *dealloc)
struct ocfs2_extent_tree *et)
{ {
int ret, orig_credits = handle->h_buffer_credits; int ret, orig_credits = handle->h_buffer_credits;
struct ocfs2_path *tmp_path = NULL, *restart_path = NULL; struct ocfs2_path *tmp_path = NULL, *restart_path = NULL;
...@@ -3126,8 +3126,7 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle, ...@@ -3126,8 +3126,7 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle,
* Inline extents. This is trivially handled, so do * Inline extents. This is trivially handled, so do
* it up front. * it up front.
*/ */
ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, ret = ocfs2_rotate_rightmost_leaf_left(handle, et, path);
path);
if (ret) if (ret)
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3143,7 +3142,7 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle, ...@@ -3143,7 +3142,7 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle,
* *
* 1) is handled via ocfs2_rotate_rightmost_leaf_left() * 1) is handled via ocfs2_rotate_rightmost_leaf_left()
* 2a) we need the left branch so that we can update it with the unlink * 2a) we need the left branch so that we can update it with the unlink
* 2b) we need to bring the inode back to inline extents. * 2b) we need to bring the root back to inline extents.
*/ */
eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data; eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
...@@ -3159,9 +3158,9 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle, ...@@ -3159,9 +3158,9 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle,
if (le16_to_cpu(el->l_next_free_rec) == 0) { if (le16_to_cpu(el->l_next_free_rec) == 0) {
ret = -EIO; ret = -EIO;
ocfs2_error(inode->i_sb, ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
"Inode %llu has empty extent block at %llu", "Owner %llu has empty extent block at %llu",
(unsigned long long)OCFS2_I(inode)->ip_blkno, (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
(unsigned long long)le64_to_cpu(eb->h_blkno)); (unsigned long long)le64_to_cpu(eb->h_blkno));
goto out; goto out;
} }
...@@ -3175,8 +3174,8 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle, ...@@ -3175,8 +3174,8 @@ static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle,
* nonempty list. * nonempty list.
*/ */
ret = ocfs2_remove_rightmost_path(inode, handle, path, ret = ocfs2_remove_rightmost_path(handle, et, path,
dealloc, et); dealloc);
if (ret) if (ret)
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3602,9 +3601,9 @@ static int ocfs2_merge_rec_left(struct inode *inode, ...@@ -3602,9 +3601,9 @@ static int ocfs2_merge_rec_left(struct inode *inode,
if (le16_to_cpu(right_rec->e_leaf_clusters) == 0 && if (le16_to_cpu(right_rec->e_leaf_clusters) == 0 &&
le16_to_cpu(el->l_next_free_rec) == 1) { le16_to_cpu(el->l_next_free_rec) == 1) {
ret = ocfs2_remove_rightmost_path(inode, handle, ret = ocfs2_remove_rightmost_path(handle, et,
right_path, right_path,
dealloc, et); dealloc);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3649,8 +3648,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3649,8 +3648,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
* extents - having more than one in a leaf is * extents - having more than one in a leaf is
* illegal. * illegal.
*/ */
ret = ocfs2_rotate_tree_left(inode, handle, path, ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
dealloc, et);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3693,8 +3691,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3693,8 +3691,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
BUG_ON(!ocfs2_is_empty_extent(&el->l_recs[0])); BUG_ON(!ocfs2_is_empty_extent(&el->l_recs[0]));
/* The merge left us with an empty extent, remove it. */ /* The merge left us with an empty extent, remove it. */
ret = ocfs2_rotate_tree_left(inode, handle, path, ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
dealloc, et);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -3716,8 +3713,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3716,8 +3713,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
goto out; goto out;
} }
ret = ocfs2_rotate_tree_left(inode, handle, path, ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
dealloc, et);
/* /*
* Error from this last rotate is not critical, so * Error from this last rotate is not critical, so
* print but don't bubble it up. * print but don't bubble it up.
...@@ -3758,8 +3754,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, ...@@ -3758,8 +3754,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
* The merge may have left an empty extent in * The merge may have left an empty extent in
* our leaf. Try to rotate it away. * our leaf. Try to rotate it away.
*/ */
ret = ocfs2_rotate_tree_left(inode, handle, path, ret = ocfs2_rotate_tree_left(handle, et, path,
dealloc, et); dealloc);
if (ret) if (ret)
mlog_errno(ret); mlog_errno(ret);
ret = 0; ret = 0;
...@@ -5259,7 +5255,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle, ...@@ -5259,7 +5255,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
struct ocfs2_extent_block *eb; struct ocfs2_extent_block *eb;
if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) { if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) {
ret = ocfs2_rotate_tree_left(inode, handle, path, dealloc, et); ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
...@@ -5390,7 +5386,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle, ...@@ -5390,7 +5386,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
ocfs2_journal_dirty(handle, path_leaf_bh(path)); ocfs2_journal_dirty(handle, path_leaf_bh(path));
ret = ocfs2_rotate_tree_left(inode, handle, path, dealloc, et); ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
......
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