aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 6b27f74bb346..c22ff49b5e33 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -532,6 +532,16 @@ static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh,
532 return path; 532 return path;
533} 533}
534 534
535static struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path)
536{
537 return ocfs2_new_path(path_root_bh(path), path_root_el(path));
538}
539
540static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et)
541{
542 return ocfs2_new_path(et->et_root_bh, et->et_root_el);
543}
544
535/* 545/*
536 * Convenience function to journal all components in a path. 546 * Convenience function to journal all components in a path.
537 */ 547 */
@@ -2150,8 +2160,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2150 2160
2151 *ret_left_path = NULL; 2161 *ret_left_path = NULL;
2152 2162
2153 left_path = ocfs2_new_path(path_root_bh(right_path), 2163 left_path = ocfs2_new_path_from_path(right_path);
2154 path_root_el(right_path));
2155 if (!left_path) { 2164 if (!left_path) {
2156 ret = -ENOMEM; 2165 ret = -ENOMEM;
2157 mlog_errno(ret); 2166 mlog_errno(ret);
@@ -2692,8 +2701,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2692 goto out; 2701 goto out;
2693 } 2702 }
2694 2703
2695 left_path = ocfs2_new_path(path_root_bh(path), 2704 left_path = ocfs2_new_path_from_path(path);
2696 path_root_el(path));
2697 if (!left_path) { 2705 if (!left_path) {
2698 ret = -ENOMEM; 2706 ret = -ENOMEM;
2699 mlog_errno(ret); 2707 mlog_errno(ret);
@@ -2702,8 +2710,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2702 2710
2703 ocfs2_cp_path(left_path, path); 2711 ocfs2_cp_path(left_path, path);
2704 2712
2705 right_path = ocfs2_new_path(path_root_bh(path), 2713 right_path = ocfs2_new_path_from_path(path);
2706 path_root_el(path));
2707 if (!right_path) { 2714 if (!right_path) {
2708 ret = -ENOMEM; 2715 ret = -ENOMEM;
2709 mlog_errno(ret); 2716 mlog_errno(ret);
@@ -2833,8 +2840,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
2833 * We have a path to the left of this one - it needs 2840 * We have a path to the left of this one - it needs
2834 * an update too. 2841 * an update too.
2835 */ 2842 */
2836 left_path = ocfs2_new_path(path_root_bh(path), 2843 left_path = ocfs2_new_path_from_path(path);
2837 path_root_el(path));
2838 if (!left_path) { 2844 if (!left_path) {
2839 ret = -ENOMEM; 2845 ret = -ENOMEM;
2840 mlog_errno(ret); 2846 mlog_errno(ret);
@@ -3075,8 +3081,7 @@ static int ocfs2_get_right_path(struct inode *inode,
3075 /* This function shouldn't be called for the rightmost leaf. */ 3081 /* This function shouldn't be called for the rightmost leaf. */
3076 BUG_ON(right_cpos == 0); 3082 BUG_ON(right_cpos == 0);
3077 3083
3078 right_path = ocfs2_new_path(path_root_bh(left_path), 3084 right_path = ocfs2_new_path_from_path(left_path);
3079 path_root_el(left_path));
3080 if (!right_path) { 3085 if (!right_path) {
3081 ret = -ENOMEM; 3086 ret = -ENOMEM;
3082 mlog_errno(ret); 3087 mlog_errno(ret);
@@ -3247,8 +3252,7 @@ static int ocfs2_get_left_path(struct inode *inode,
3247 /* This function shouldn't be called for the leftmost leaf. */ 3252 /* This function shouldn't be called for the leftmost leaf. */
3248 BUG_ON(left_cpos == 0); 3253 BUG_ON(left_cpos == 0);
3249 3254
3250 left_path = ocfs2_new_path(path_root_bh(right_path), 3255 left_path = ocfs2_new_path_from_path(right_path);
3251 path_root_el(right_path));
3252 if (!left_path) { 3256 if (!left_path) {
3253 ret = -ENOMEM; 3257 ret = -ENOMEM;
3254 mlog_errno(ret); 3258 mlog_errno(ret);
@@ -3780,8 +3784,7 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle,
3780 * leftmost leaf. 3784 * leftmost leaf.
3781 */ 3785 */
3782 if (left_cpos) { 3786 if (left_cpos) {
3783 left_path = ocfs2_new_path(path_root_bh(right_path), 3787 left_path = ocfs2_new_path_from_path(right_path);
3784 path_root_el(right_path));
3785 if (!left_path) { 3788 if (!left_path) {
3786 ret = -ENOMEM; 3789 ret = -ENOMEM;
3787 mlog_errno(ret); 3790 mlog_errno(ret);
@@ -4018,7 +4021,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4018 goto out_update_clusters; 4021 goto out_update_clusters;
4019 } 4022 }
4020 4023
4021 right_path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 4024 right_path = ocfs2_new_path_from_et(et);
4022 if (!right_path) { 4025 if (!right_path) {
4023 ret = -ENOMEM; 4026 ret = -ENOMEM;
4024 mlog_errno(ret); 4027 mlog_errno(ret);
@@ -4130,8 +4133,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
4130 goto out; 4133 goto out;
4131 4134
4132 if (left_cpos != 0) { 4135 if (left_cpos != 0) {
4133 left_path = ocfs2_new_path(path_root_bh(path), 4136 left_path = ocfs2_new_path_from_path(path);
4134 path_root_el(path));
4135 if (!left_path) 4137 if (!left_path)
4136 goto out; 4138 goto out;
4137 4139
@@ -4187,8 +4189,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
4187 if (right_cpos == 0) 4189 if (right_cpos == 0)
4188 goto out; 4190 goto out;
4189 4191
4190 right_path = ocfs2_new_path(path_root_bh(path), 4192 right_path = ocfs2_new_path_from_path(path);
4191 path_root_el(path));
4192 if (!right_path) 4193 if (!right_path)
4193 goto out; 4194 goto out;
4194 4195
@@ -4381,7 +4382,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,
4381 return 0; 4382 return 0;
4382 } 4383 }
4383 4384
4384 path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 4385 path = ocfs2_new_path_from_et(et);
4385 if (!path) { 4386 if (!path) {
4386 ret = -ENOMEM; 4387 ret = -ENOMEM;
4387 mlog_errno(ret); 4388 mlog_errno(ret);
@@ -4910,7 +4911,7 @@ int ocfs2_mark_extent_written(struct inode *inode,
4910 if (et->et_ops == &ocfs2_dinode_et_ops) 4911 if (et->et_ops == &ocfs2_dinode_et_ops)
4911 ocfs2_extent_map_trunc(inode, 0); 4912 ocfs2_extent_map_trunc(inode, 0);
4912 4913
4913 left_path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 4914 left_path = ocfs2_new_path_from_et(et);
4914 if (!left_path) { 4915 if (!left_path) {
4915 ret = -ENOMEM; 4916 ret = -ENOMEM;
4916 mlog_errno(ret); 4917 mlog_errno(ret);
@@ -5082,8 +5083,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5082 } 5083 }
5083 5084
5084 if (left_cpos && le16_to_cpu(el->l_next_free_rec) > 1) { 5085 if (left_cpos && le16_to_cpu(el->l_next_free_rec) > 1) {
5085 left_path = ocfs2_new_path(path_root_bh(path), 5086 left_path = ocfs2_new_path_from_path(path);
5086 path_root_el(path));
5087 if (!left_path) { 5087 if (!left_path) {
5088 ret = -ENOMEM; 5088 ret = -ENOMEM;
5089 mlog_errno(ret); 5089 mlog_errno(ret);
@@ -5192,7 +5192,7 @@ int ocfs2_remove_extent(struct inode *inode,
5192 5192
5193 ocfs2_extent_map_trunc(inode, 0); 5193 ocfs2_extent_map_trunc(inode, 0);
5194 5194
5195 path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 5195 path = ocfs2_new_path_from_et(et);
5196 if (!path) { 5196 if (!path) {
5197 ret = -ENOMEM; 5197 ret = -ENOMEM;
5198 mlog_errno(ret); 5198 mlog_errno(ret);