aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2009-02-13 05:09:31 -0500
committerJoel Becker <joel.becker@oracle.com>2009-09-04 19:08:00 -0400
commit70f18c08b476e315c8ee17ea34b55ea1957e7e7d (patch)
treee53645ea3a3ff2e3d45a31c0f963815f3cfa7fb9 /fs/ocfs2/alloc.c
parente46f74dc357947e2aed9bdd63cf335c5fd23810b (diff)
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: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 12dbd6ee6faf..d348cfb509e4 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -2843,8 +2843,8 @@ out:
2843 return ret; 2843 return ret;
2844} 2844}
2845 2845
2846static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, 2846static int ocfs2_rotate_rightmost_leaf_left(handle_t *handle,
2847 handle_t *handle, 2847 struct ocfs2_extent_tree *et,
2848 struct ocfs2_path *path) 2848 struct ocfs2_path *path)
2849{ 2849{
2850 int ret; 2850 int ret;
@@ -2854,7 +2854,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
2854 if (!ocfs2_is_empty_extent(&el->l_recs[0])) 2854 if (!ocfs2_is_empty_extent(&el->l_recs[0]))
2855 return 0; 2855 return 0;
2856 2856
2857 ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path, 2857 ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
2858 path_num_items(path) - 1); 2858 path_num_items(path) - 1);
2859 if (ret) { 2859 if (ret) {
2860 mlog_errno(ret); 2860 mlog_errno(ret);
@@ -2988,10 +2988,10 @@ out:
2988 return ret; 2988 return ret;
2989} 2989}
2990 2990
2991static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, 2991static int ocfs2_remove_rightmost_path(handle_t *handle,
2992 struct ocfs2_extent_tree *et,
2992 struct ocfs2_path *path, 2993 struct ocfs2_path *path,
2993 struct ocfs2_cached_dealloc_ctxt *dealloc, 2994 struct ocfs2_cached_dealloc_ctxt *dealloc)
2994 struct ocfs2_extent_tree *et)
2995{ 2995{
2996 int ret, subtree_index; 2996 int ret, subtree_index;
2997 u32 cpos; 2997 u32 cpos;
@@ -3070,7 +3070,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
3070 * 'path' is also the leftmost path which 3070 * 'path' is also the leftmost path which
3071 * means it must be the only one. This gets 3071 * means it must be the only one. This gets
3072 * handled differently because we want to 3072 * handled differently because we want to
3073 * revert the inode back to having extents 3073 * revert the root back to having extents
3074 * in-line. 3074 * in-line.
3075 */ 3075 */
3076 ocfs2_unlink_path(handle, et, dealloc, path, 1); 3076 ocfs2_unlink_path(handle, et, dealloc, path, 1);
@@ -3106,10 +3106,10 @@ out:
3106 * the rightmost tree leaf record is removed so the caller is 3106 * the rightmost tree leaf record is removed so the caller is
3107 * responsible for detecting and correcting that. 3107 * responsible for detecting and correcting that.
3108 */ 3108 */
3109static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle, 3109static int ocfs2_rotate_tree_left(handle_t *handle,
3110 struct ocfs2_extent_tree *et,
3110 struct ocfs2_path *path, 3111 struct ocfs2_path *path,
3111 struct ocfs2_cached_dealloc_ctxt *dealloc, 3112 struct ocfs2_cached_dealloc_ctxt *dealloc)
3112 struct ocfs2_extent_tree *et)
3113{ 3113{
3114 int ret, orig_credits = handle->h_buffer_credits; 3114 int ret, orig_credits = handle->h_buffer_credits;
3115 struct ocfs2_path *tmp_path = NULL, *restart_path = NULL; 3115 struct ocfs2_path *tmp_path = NULL, *restart_path = NULL;
@@ -3126,8 +3126,7 @@ rightmost_no_delete:
3126 * Inline extents. This is trivially handled, so do 3126 * Inline extents. This is trivially handled, so do
3127 * it up front. 3127 * it up front.
3128 */ 3128 */
3129 ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, 3129 ret = ocfs2_rotate_rightmost_leaf_left(handle, et, path);
3130 path);
3131 if (ret) 3130 if (ret)
3132 mlog_errno(ret); 3131 mlog_errno(ret);
3133 goto out; 3132 goto out;
@@ -3143,7 +3142,7 @@ rightmost_no_delete:
3143 * 3142 *
3144 * 1) is handled via ocfs2_rotate_rightmost_leaf_left() 3143 * 1) is handled via ocfs2_rotate_rightmost_leaf_left()
3145 * 2a) we need the left branch so that we can update it with the unlink 3144 * 2a) we need the left branch so that we can update it with the unlink
3146 * 2b) we need to bring the inode back to inline extents. 3145 * 2b) we need to bring the root back to inline extents.
3147 */ 3146 */
3148 3147
3149 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data; 3148 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
@@ -3159,9 +3158,9 @@ rightmost_no_delete:
3159 3158
3160 if (le16_to_cpu(el->l_next_free_rec) == 0) { 3159 if (le16_to_cpu(el->l_next_free_rec) == 0) {
3161 ret = -EIO; 3160 ret = -EIO;
3162 ocfs2_error(inode->i_sb, 3161 ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
3163 "Inode %llu has empty extent block at %llu", 3162 "Owner %llu has empty extent block at %llu",
3164 (unsigned long long)OCFS2_I(inode)->ip_blkno, 3163 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
3165 (unsigned long long)le64_to_cpu(eb->h_blkno)); 3164 (unsigned long long)le64_to_cpu(eb->h_blkno));
3166 goto out; 3165 goto out;
3167 } 3166 }
@@ -3175,8 +3174,8 @@ rightmost_no_delete:
3175 * nonempty list. 3174 * nonempty list.
3176 */ 3175 */
3177 3176
3178 ret = ocfs2_remove_rightmost_path(inode, handle, path, 3177 ret = ocfs2_remove_rightmost_path(handle, et, path,
3179 dealloc, et); 3178 dealloc);
3180 if (ret) 3179 if (ret)
3181 mlog_errno(ret); 3180 mlog_errno(ret);
3182 goto out; 3181 goto out;
@@ -3602,9 +3601,9 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3602 if (le16_to_cpu(right_rec->e_leaf_clusters) == 0 && 3601 if (le16_to_cpu(right_rec->e_leaf_clusters) == 0 &&
3603 le16_to_cpu(el->l_next_free_rec) == 1) { 3602 le16_to_cpu(el->l_next_free_rec) == 1) {
3604 3603
3605 ret = ocfs2_remove_rightmost_path(inode, handle, 3604 ret = ocfs2_remove_rightmost_path(handle, et,
3606 right_path, 3605 right_path,
3607 dealloc, et); 3606 dealloc);
3608 if (ret) { 3607 if (ret) {
3609 mlog_errno(ret); 3608 mlog_errno(ret);
3610 goto out; 3609 goto out;
@@ -3649,8 +3648,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3649 * extents - having more than one in a leaf is 3648 * extents - having more than one in a leaf is
3650 * illegal. 3649 * illegal.
3651 */ 3650 */
3652 ret = ocfs2_rotate_tree_left(inode, handle, path, 3651 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3653 dealloc, et);
3654 if (ret) { 3652 if (ret) {
3655 mlog_errno(ret); 3653 mlog_errno(ret);
3656 goto out; 3654 goto out;
@@ -3693,8 +3691,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3693 BUG_ON(!ocfs2_is_empty_extent(&el->l_recs[0])); 3691 BUG_ON(!ocfs2_is_empty_extent(&el->l_recs[0]));
3694 3692
3695 /* The merge left us with an empty extent, remove it. */ 3693 /* The merge left us with an empty extent, remove it. */
3696 ret = ocfs2_rotate_tree_left(inode, handle, path, 3694 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3697 dealloc, et);
3698 if (ret) { 3695 if (ret) {
3699 mlog_errno(ret); 3696 mlog_errno(ret);
3700 goto out; 3697 goto out;
@@ -3716,8 +3713,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3716 goto out; 3713 goto out;
3717 } 3714 }
3718 3715
3719 ret = ocfs2_rotate_tree_left(inode, handle, path, 3716 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
3720 dealloc, et);
3721 /* 3717 /*
3722 * Error from this last rotate is not critical, so 3718 * Error from this last rotate is not critical, so
3723 * print but don't bubble it up. 3719 * print but don't bubble it up.
@@ -3758,8 +3754,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
3758 * The merge may have left an empty extent in 3754 * The merge may have left an empty extent in
3759 * our leaf. Try to rotate it away. 3755 * our leaf. Try to rotate it away.
3760 */ 3756 */
3761 ret = ocfs2_rotate_tree_left(inode, handle, path, 3757 ret = ocfs2_rotate_tree_left(handle, et, path,
3762 dealloc, et); 3758 dealloc);
3763 if (ret) 3759 if (ret)
3764 mlog_errno(ret); 3760 mlog_errno(ret);
3765 ret = 0; 3761 ret = 0;
@@ -5259,7 +5255,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5259 struct ocfs2_extent_block *eb; 5255 struct ocfs2_extent_block *eb;
5260 5256
5261 if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) { 5257 if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) {
5262 ret = ocfs2_rotate_tree_left(inode, handle, path, dealloc, et); 5258 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5263 if (ret) { 5259 if (ret) {
5264 mlog_errno(ret); 5260 mlog_errno(ret);
5265 goto out; 5261 goto out;
@@ -5390,7 +5386,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5390 5386
5391 ocfs2_journal_dirty(handle, path_leaf_bh(path)); 5387 ocfs2_journal_dirty(handle, path_leaf_bh(path));
5392 5388
5393 ret = ocfs2_rotate_tree_left(inode, handle, path, dealloc, et); 5389 ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
5394 if (ret) { 5390 if (ret) {
5395 mlog_errno(ret); 5391 mlog_errno(ret);
5396 goto out; 5392 goto out;