diff options
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 164 |
1 files changed, 34 insertions, 130 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 9f8bd913c51e..89e994dad026 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -1061,11 +1061,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, | |||
1061 | 1061 | ||
1062 | /* We'll also be dirtied by the caller, so | 1062 | /* We'll also be dirtied by the caller, so |
1063 | * this isn't absolutely necessary. */ | 1063 | * this isn't absolutely necessary. */ |
1064 | status = ocfs2_journal_dirty(handle, bhs[i]); | 1064 | ocfs2_journal_dirty(handle, bhs[i]); |
1065 | if (status < 0) { | ||
1066 | mlog_errno(status); | ||
1067 | goto bail; | ||
1068 | } | ||
1069 | } | 1065 | } |
1070 | 1066 | ||
1071 | count += num_got; | 1067 | count += num_got; |
@@ -1270,12 +1266,7 @@ static int ocfs2_add_branch(handle_t *handle, | |||
1270 | if (!eb_el->l_tree_depth) | 1266 | if (!eb_el->l_tree_depth) |
1271 | new_last_eb_blk = le64_to_cpu(eb->h_blkno); | 1267 | new_last_eb_blk = le64_to_cpu(eb->h_blkno); |
1272 | 1268 | ||
1273 | status = ocfs2_journal_dirty(handle, bh); | 1269 | ocfs2_journal_dirty(handle, bh); |
1274 | if (status < 0) { | ||
1275 | mlog_errno(status); | ||
1276 | goto bail; | ||
1277 | } | ||
1278 | |||
1279 | next_blkno = le64_to_cpu(eb->h_blkno); | 1270 | next_blkno = le64_to_cpu(eb->h_blkno); |
1280 | } | 1271 | } |
1281 | 1272 | ||
@@ -1321,17 +1312,10 @@ static int ocfs2_add_branch(handle_t *handle, | |||
1321 | eb = (struct ocfs2_extent_block *) (*last_eb_bh)->b_data; | 1312 | eb = (struct ocfs2_extent_block *) (*last_eb_bh)->b_data; |
1322 | eb->h_next_leaf_blk = cpu_to_le64(new_last_eb_blk); | 1313 | eb->h_next_leaf_blk = cpu_to_le64(new_last_eb_blk); |
1323 | 1314 | ||
1324 | status = ocfs2_journal_dirty(handle, *last_eb_bh); | 1315 | ocfs2_journal_dirty(handle, *last_eb_bh); |
1325 | if (status < 0) | 1316 | ocfs2_journal_dirty(handle, et->et_root_bh); |
1326 | mlog_errno(status); | 1317 | if (eb_bh) |
1327 | status = ocfs2_journal_dirty(handle, et->et_root_bh); | 1318 | ocfs2_journal_dirty(handle, eb_bh); |
1328 | if (status < 0) | ||
1329 | mlog_errno(status); | ||
1330 | if (eb_bh) { | ||
1331 | status = ocfs2_journal_dirty(handle, eb_bh); | ||
1332 | if (status < 0) | ||
1333 | mlog_errno(status); | ||
1334 | } | ||
1335 | 1319 | ||
1336 | /* | 1320 | /* |
1337 | * Some callers want to track the rightmost leaf so pass it | 1321 | * Some callers want to track the rightmost leaf so pass it |
@@ -1399,11 +1383,7 @@ static int ocfs2_shift_tree_depth(handle_t *handle, | |||
1399 | for (i = 0; i < le16_to_cpu(root_el->l_next_free_rec); i++) | 1383 | for (i = 0; i < le16_to_cpu(root_el->l_next_free_rec); i++) |
1400 | eb_el->l_recs[i] = root_el->l_recs[i]; | 1384 | eb_el->l_recs[i] = root_el->l_recs[i]; |
1401 | 1385 | ||
1402 | status = ocfs2_journal_dirty(handle, new_eb_bh); | 1386 | ocfs2_journal_dirty(handle, new_eb_bh); |
1403 | if (status < 0) { | ||
1404 | mlog_errno(status); | ||
1405 | goto bail; | ||
1406 | } | ||
1407 | 1387 | ||
1408 | status = ocfs2_et_root_journal_access(handle, et, | 1388 | status = ocfs2_et_root_journal_access(handle, et, |
1409 | OCFS2_JOURNAL_ACCESS_WRITE); | 1389 | OCFS2_JOURNAL_ACCESS_WRITE); |
@@ -1428,11 +1408,7 @@ static int ocfs2_shift_tree_depth(handle_t *handle, | |||
1428 | if (root_el->l_tree_depth == cpu_to_le16(1)) | 1408 | if (root_el->l_tree_depth == cpu_to_le16(1)) |
1429 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 1409 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
1430 | 1410 | ||
1431 | status = ocfs2_journal_dirty(handle, et->et_root_bh); | 1411 | ocfs2_journal_dirty(handle, et->et_root_bh); |
1432 | if (status < 0) { | ||
1433 | mlog_errno(status); | ||
1434 | goto bail; | ||
1435 | } | ||
1436 | 1412 | ||
1437 | *ret_new_eb_bh = new_eb_bh; | 1413 | *ret_new_eb_bh = new_eb_bh; |
1438 | new_eb_bh = NULL; | 1414 | new_eb_bh = NULL; |
@@ -2064,7 +2040,7 @@ static void ocfs2_complete_edge_insert(handle_t *handle, | |||
2064 | struct ocfs2_path *right_path, | 2040 | struct ocfs2_path *right_path, |
2065 | int subtree_index) | 2041 | int subtree_index) |
2066 | { | 2042 | { |
2067 | int ret, i, idx; | 2043 | int i, idx; |
2068 | struct ocfs2_extent_list *el, *left_el, *right_el; | 2044 | struct ocfs2_extent_list *el, *left_el, *right_el; |
2069 | struct ocfs2_extent_rec *left_rec, *right_rec; | 2045 | struct ocfs2_extent_rec *left_rec, *right_rec; |
2070 | struct buffer_head *root_bh = left_path->p_node[subtree_index].bh; | 2046 | struct buffer_head *root_bh = left_path->p_node[subtree_index].bh; |
@@ -2102,13 +2078,8 @@ static void ocfs2_complete_edge_insert(handle_t *handle, | |||
2102 | ocfs2_adjust_adjacent_records(left_rec, left_el, right_rec, | 2078 | ocfs2_adjust_adjacent_records(left_rec, left_el, right_rec, |
2103 | right_el); | 2079 | right_el); |
2104 | 2080 | ||
2105 | ret = ocfs2_journal_dirty(handle, left_path->p_node[i].bh); | 2081 | ocfs2_journal_dirty(handle, left_path->p_node[i].bh); |
2106 | if (ret) | 2082 | ocfs2_journal_dirty(handle, right_path->p_node[i].bh); |
2107 | mlog_errno(ret); | ||
2108 | |||
2109 | ret = ocfs2_journal_dirty(handle, right_path->p_node[i].bh); | ||
2110 | if (ret) | ||
2111 | mlog_errno(ret); | ||
2112 | 2083 | ||
2113 | /* | 2084 | /* |
2114 | * Setup our list pointers now so that the current | 2085 | * Setup our list pointers now so that the current |
@@ -2132,9 +2103,7 @@ static void ocfs2_complete_edge_insert(handle_t *handle, | |||
2132 | 2103 | ||
2133 | root_bh = left_path->p_node[subtree_index].bh; | 2104 | root_bh = left_path->p_node[subtree_index].bh; |
2134 | 2105 | ||
2135 | ret = ocfs2_journal_dirty(handle, root_bh); | 2106 | ocfs2_journal_dirty(handle, root_bh); |
2136 | if (ret) | ||
2137 | mlog_errno(ret); | ||
2138 | } | 2107 | } |
2139 | 2108 | ||
2140 | static int ocfs2_rotate_subtree_right(handle_t *handle, | 2109 | static int ocfs2_rotate_subtree_right(handle_t *handle, |
@@ -2207,11 +2176,7 @@ static int ocfs2_rotate_subtree_right(handle_t *handle, | |||
2207 | 2176 | ||
2208 | ocfs2_create_empty_extent(right_el); | 2177 | ocfs2_create_empty_extent(right_el); |
2209 | 2178 | ||
2210 | ret = ocfs2_journal_dirty(handle, right_leaf_bh); | 2179 | ocfs2_journal_dirty(handle, right_leaf_bh); |
2211 | if (ret) { | ||
2212 | mlog_errno(ret); | ||
2213 | goto out; | ||
2214 | } | ||
2215 | 2180 | ||
2216 | /* Do the copy now. */ | 2181 | /* Do the copy now. */ |
2217 | i = le16_to_cpu(left_el->l_next_free_rec) - 1; | 2182 | i = le16_to_cpu(left_el->l_next_free_rec) - 1; |
@@ -2230,11 +2195,7 @@ static int ocfs2_rotate_subtree_right(handle_t *handle, | |||
2230 | memset(&left_el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec)); | 2195 | memset(&left_el->l_recs[0], 0, sizeof(struct ocfs2_extent_rec)); |
2231 | le16_add_cpu(&left_el->l_next_free_rec, 1); | 2196 | le16_add_cpu(&left_el->l_next_free_rec, 1); |
2232 | 2197 | ||
2233 | ret = ocfs2_journal_dirty(handle, left_leaf_bh); | 2198 | ocfs2_journal_dirty(handle, left_leaf_bh); |
2234 | if (ret) { | ||
2235 | mlog_errno(ret); | ||
2236 | goto out; | ||
2237 | } | ||
2238 | 2199 | ||
2239 | ocfs2_complete_edge_insert(handle, left_path, right_path, | 2200 | ocfs2_complete_edge_insert(handle, left_path, right_path, |
2240 | subtree_index); | 2201 | subtree_index); |
@@ -2823,12 +2784,8 @@ static int ocfs2_rotate_subtree_left(handle_t *handle, | |||
2823 | ocfs2_remove_empty_extent(right_leaf_el); | 2784 | ocfs2_remove_empty_extent(right_leaf_el); |
2824 | } | 2785 | } |
2825 | 2786 | ||
2826 | ret = ocfs2_journal_dirty(handle, path_leaf_bh(left_path)); | 2787 | ocfs2_journal_dirty(handle, path_leaf_bh(left_path)); |
2827 | if (ret) | 2788 | ocfs2_journal_dirty(handle, path_leaf_bh(right_path)); |
2828 | mlog_errno(ret); | ||
2829 | ret = ocfs2_journal_dirty(handle, path_leaf_bh(right_path)); | ||
2830 | if (ret) | ||
2831 | mlog_errno(ret); | ||
2832 | 2789 | ||
2833 | if (del_right_subtree) { | 2790 | if (del_right_subtree) { |
2834 | ocfs2_unlink_subtree(handle, et, left_path, right_path, | 2791 | ocfs2_unlink_subtree(handle, et, left_path, right_path, |
@@ -2851,9 +2808,7 @@ static int ocfs2_rotate_subtree_left(handle_t *handle, | |||
2851 | if (right_has_empty) | 2808 | if (right_has_empty) |
2852 | ocfs2_remove_empty_extent(left_leaf_el); | 2809 | ocfs2_remove_empty_extent(left_leaf_el); |
2853 | 2810 | ||
2854 | ret = ocfs2_journal_dirty(handle, et_root_bh); | 2811 | ocfs2_journal_dirty(handle, et_root_bh); |
2855 | if (ret) | ||
2856 | mlog_errno(ret); | ||
2857 | 2812 | ||
2858 | *deleted = 1; | 2813 | *deleted = 1; |
2859 | } else | 2814 | } else |
@@ -2962,10 +2917,7 @@ static int ocfs2_rotate_rightmost_leaf_left(handle_t *handle, | |||
2962 | } | 2917 | } |
2963 | 2918 | ||
2964 | ocfs2_remove_empty_extent(el); | 2919 | ocfs2_remove_empty_extent(el); |
2965 | 2920 | ocfs2_journal_dirty(handle, bh); | |
2966 | ret = ocfs2_journal_dirty(handle, bh); | ||
2967 | if (ret) | ||
2968 | mlog_errno(ret); | ||
2969 | 2921 | ||
2970 | out: | 2922 | out: |
2971 | return ret; | 2923 | return ret; |
@@ -3506,15 +3458,9 @@ static int ocfs2_merge_rec_right(struct ocfs2_path *left_path, | |||
3506 | 3458 | ||
3507 | ocfs2_cleanup_merge(el, index); | 3459 | ocfs2_cleanup_merge(el, index); |
3508 | 3460 | ||
3509 | ret = ocfs2_journal_dirty(handle, bh); | 3461 | ocfs2_journal_dirty(handle, bh); |
3510 | if (ret) | ||
3511 | mlog_errno(ret); | ||
3512 | |||
3513 | if (right_path) { | 3462 | if (right_path) { |
3514 | ret = ocfs2_journal_dirty(handle, path_leaf_bh(right_path)); | 3463 | ocfs2_journal_dirty(handle, path_leaf_bh(right_path)); |
3515 | if (ret) | ||
3516 | mlog_errno(ret); | ||
3517 | |||
3518 | ocfs2_complete_edge_insert(handle, left_path, right_path, | 3464 | ocfs2_complete_edge_insert(handle, left_path, right_path, |
3519 | subtree_index); | 3465 | subtree_index); |
3520 | } | 3466 | } |
@@ -3683,14 +3629,9 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path, | |||
3683 | 3629 | ||
3684 | ocfs2_cleanup_merge(el, index); | 3630 | ocfs2_cleanup_merge(el, index); |
3685 | 3631 | ||
3686 | ret = ocfs2_journal_dirty(handle, bh); | 3632 | ocfs2_journal_dirty(handle, bh); |
3687 | if (ret) | ||
3688 | mlog_errno(ret); | ||
3689 | |||
3690 | if (left_path) { | 3633 | if (left_path) { |
3691 | ret = ocfs2_journal_dirty(handle, path_leaf_bh(left_path)); | 3634 | ocfs2_journal_dirty(handle, path_leaf_bh(left_path)); |
3692 | if (ret) | ||
3693 | mlog_errno(ret); | ||
3694 | 3635 | ||
3695 | /* | 3636 | /* |
3696 | * In the situation that the right_rec is empty and the extent | 3637 | * In the situation that the right_rec is empty and the extent |
@@ -4016,10 +3957,7 @@ static void ocfs2_adjust_rightmost_records(handle_t *handle, | |||
4016 | le32_add_cpu(&rec->e_int_clusters, | 3957 | le32_add_cpu(&rec->e_int_clusters, |
4017 | -le32_to_cpu(rec->e_cpos)); | 3958 | -le32_to_cpu(rec->e_cpos)); |
4018 | 3959 | ||
4019 | ret = ocfs2_journal_dirty(handle, bh); | 3960 | ocfs2_journal_dirty(handle, bh); |
4020 | if (ret) | ||
4021 | mlog_errno(ret); | ||
4022 | |||
4023 | } | 3961 | } |
4024 | } | 3962 | } |
4025 | 3963 | ||
@@ -4251,17 +4189,13 @@ static int ocfs2_insert_path(handle_t *handle, | |||
4251 | * dirty this for us. | 4189 | * dirty this for us. |
4252 | */ | 4190 | */ |
4253 | if (left_path) | 4191 | if (left_path) |
4254 | ret = ocfs2_journal_dirty(handle, | 4192 | ocfs2_journal_dirty(handle, |
4255 | path_leaf_bh(left_path)); | 4193 | path_leaf_bh(left_path)); |
4256 | if (ret) | ||
4257 | mlog_errno(ret); | ||
4258 | } else | 4194 | } else |
4259 | ocfs2_insert_at_leaf(et, insert_rec, path_leaf_el(right_path), | 4195 | ocfs2_insert_at_leaf(et, insert_rec, path_leaf_el(right_path), |
4260 | insert); | 4196 | insert); |
4261 | 4197 | ||
4262 | ret = ocfs2_journal_dirty(handle, leaf_bh); | 4198 | ocfs2_journal_dirty(handle, leaf_bh); |
4263 | if (ret) | ||
4264 | mlog_errno(ret); | ||
4265 | 4199 | ||
4266 | if (left_path) { | 4200 | if (left_path) { |
4267 | /* | 4201 | /* |
@@ -4384,9 +4318,7 @@ out_update_clusters: | |||
4384 | ocfs2_et_update_clusters(et, | 4318 | ocfs2_et_update_clusters(et, |
4385 | le16_to_cpu(insert_rec->e_leaf_clusters)); | 4319 | le16_to_cpu(insert_rec->e_leaf_clusters)); |
4386 | 4320 | ||
4387 | ret = ocfs2_journal_dirty(handle, et->et_root_bh); | 4321 | ocfs2_journal_dirty(handle, et->et_root_bh); |
4388 | if (ret) | ||
4389 | mlog_errno(ret); | ||
4390 | 4322 | ||
4391 | out: | 4323 | out: |
4392 | ocfs2_free_path(left_path); | 4324 | ocfs2_free_path(left_path); |
@@ -4895,11 +4827,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4895 | goto leave; | 4827 | goto leave; |
4896 | } | 4828 | } |
4897 | 4829 | ||
4898 | status = ocfs2_journal_dirty(handle, et->et_root_bh); | 4830 | ocfs2_journal_dirty(handle, et->et_root_bh); |
4899 | if (status < 0) { | ||
4900 | mlog_errno(status); | ||
4901 | goto leave; | ||
4902 | } | ||
4903 | 4831 | ||
4904 | clusters_to_add -= num_bits; | 4832 | clusters_to_add -= num_bits; |
4905 | *logical_offset += num_bits; | 4833 | *logical_offset += num_bits; |
@@ -5724,11 +5652,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5724 | 5652 | ||
5725 | ocfs2_et_update_clusters(et, -len); | 5653 | ocfs2_et_update_clusters(et, -len); |
5726 | 5654 | ||
5727 | ret = ocfs2_journal_dirty(handle, et->et_root_bh); | 5655 | ocfs2_journal_dirty(handle, et->et_root_bh); |
5728 | if (ret) { | ||
5729 | mlog_errno(ret); | ||
5730 | goto out_commit; | ||
5731 | } | ||
5732 | 5656 | ||
5733 | ret = ocfs2_truncate_log_append(osb, handle, phys_blkno, len); | 5657 | ret = ocfs2_truncate_log_append(osb, handle, phys_blkno, len); |
5734 | if (ret) | 5658 | if (ret) |
@@ -5850,11 +5774,7 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5850 | } | 5774 | } |
5851 | tl->tl_recs[index].t_clusters = cpu_to_le32(num_clusters); | 5775 | tl->tl_recs[index].t_clusters = cpu_to_le32(num_clusters); |
5852 | 5776 | ||
5853 | status = ocfs2_journal_dirty(handle, tl_bh); | 5777 | ocfs2_journal_dirty(handle, tl_bh); |
5854 | if (status < 0) { | ||
5855 | mlog_errno(status); | ||
5856 | goto bail; | ||
5857 | } | ||
5858 | 5778 | ||
5859 | bail: | 5779 | bail: |
5860 | mlog_exit(status); | 5780 | mlog_exit(status); |
@@ -5893,11 +5813,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5893 | 5813 | ||
5894 | tl->tl_used = cpu_to_le16(i); | 5814 | tl->tl_used = cpu_to_le16(i); |
5895 | 5815 | ||
5896 | status = ocfs2_journal_dirty(handle, tl_bh); | 5816 | ocfs2_journal_dirty(handle, tl_bh); |
5897 | if (status < 0) { | ||
5898 | mlog_errno(status); | ||
5899 | goto bail; | ||
5900 | } | ||
5901 | 5817 | ||
5902 | /* TODO: Perhaps we can calculate the bulk of the | 5818 | /* TODO: Perhaps we can calculate the bulk of the |
5903 | * credits up front rather than extending like | 5819 | * credits up front rather than extending like |
@@ -6824,11 +6740,7 @@ find_tail_record: | |||
6824 | } | 6740 | } |
6825 | 6741 | ||
6826 | delete: | 6742 | delete: |
6827 | ret = ocfs2_journal_dirty(handle, bh); | 6743 | ocfs2_journal_dirty(handle, bh); |
6828 | if (ret) { | ||
6829 | mlog_errno(ret); | ||
6830 | goto out; | ||
6831 | } | ||
6832 | 6744 | ||
6833 | mlog(0, "extent list container %llu, after: record %d: " | 6745 | mlog(0, "extent list container %llu, after: record %d: " |
6834 | "(%u, %u, %llu), next = %u.\n", | 6746 | "(%u, %u, %llu), next = %u.\n", |
@@ -6959,22 +6871,14 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb, | |||
6959 | } else if (last_eb) | 6871 | } else if (last_eb) |
6960 | fe->i_last_eb_blk = last_eb->h_blkno; | 6872 | fe->i_last_eb_blk = last_eb->h_blkno; |
6961 | 6873 | ||
6962 | status = ocfs2_journal_dirty(handle, fe_bh); | 6874 | ocfs2_journal_dirty(handle, fe_bh); |
6963 | if (status < 0) { | ||
6964 | mlog_errno(status); | ||
6965 | goto bail; | ||
6966 | } | ||
6967 | 6875 | ||
6968 | if (last_eb) { | 6876 | if (last_eb) { |
6969 | /* If there will be a new last extent block, then by | 6877 | /* If there will be a new last extent block, then by |
6970 | * definition, there cannot be any leaves to the right of | 6878 | * definition, there cannot be any leaves to the right of |
6971 | * him. */ | 6879 | * him. */ |
6972 | last_eb->h_next_leaf_blk = 0; | 6880 | last_eb->h_next_leaf_blk = 0; |
6973 | status = ocfs2_journal_dirty(handle, last_eb_bh); | 6881 | ocfs2_journal_dirty(handle, last_eb_bh); |
6974 | if (status < 0) { | ||
6975 | mlog_errno(status); | ||
6976 | goto bail; | ||
6977 | } | ||
6978 | } | 6882 | } |
6979 | 6883 | ||
6980 | if (delete_blk) { | 6884 | if (delete_blk) { |