diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2015-04-14 18:42:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:48:57 -0400 |
commit | 06a269ccdf0550671667f5cfa00bdabb6bf05259 (patch) | |
tree | 88e6525877a457045e6b1495a10e9b7af87f48a4 /fs/ocfs2/alloc.c | |
parent | 3cc79b795b53a9a04aa1bcc1a943379f06324bb6 (diff) |
ocfs2: less function calls in ocfs2_figure_merge_contig_type() after error detection
ocfs2_free_path() was called in some cases by
ocfs2_figure_merge_contig_type() during error handling even if the passed
variables "left_path" and "right_path" contained still a null pointer.
Corresponding implementation details could be improved by adjustments for
jump labels according to the current Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r-- | fs/ocfs2/alloc.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index bf806e58b1cb..370b4ea4c23a 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -4332,17 +4332,17 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4332 | } else if (path->p_tree_depth > 0) { | 4332 | } else if (path->p_tree_depth > 0) { |
4333 | status = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos); | 4333 | status = ocfs2_find_cpos_for_left_leaf(sb, path, &left_cpos); |
4334 | if (status) | 4334 | if (status) |
4335 | goto out; | 4335 | goto exit; |
4336 | 4336 | ||
4337 | if (left_cpos != 0) { | 4337 | if (left_cpos != 0) { |
4338 | left_path = ocfs2_new_path_from_path(path); | 4338 | left_path = ocfs2_new_path_from_path(path); |
4339 | if (!left_path) | 4339 | if (!left_path) |
4340 | goto out; | 4340 | goto exit; |
4341 | 4341 | ||
4342 | status = ocfs2_find_path(et->et_ci, left_path, | 4342 | status = ocfs2_find_path(et->et_ci, left_path, |
4343 | left_cpos); | 4343 | left_cpos); |
4344 | if (status) | 4344 | if (status) |
4345 | goto out; | 4345 | goto free_left_path; |
4346 | 4346 | ||
4347 | new_el = path_leaf_el(left_path); | 4347 | new_el = path_leaf_el(left_path); |
4348 | 4348 | ||
@@ -4359,7 +4359,7 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4359 | le16_to_cpu(new_el->l_next_free_rec), | 4359 | le16_to_cpu(new_el->l_next_free_rec), |
4360 | le16_to_cpu(new_el->l_count)); | 4360 | le16_to_cpu(new_el->l_count)); |
4361 | status = -EINVAL; | 4361 | status = -EINVAL; |
4362 | goto out; | 4362 | goto free_left_path; |
4363 | } | 4363 | } |
4364 | rec = &new_el->l_recs[ | 4364 | rec = &new_el->l_recs[ |
4365 | le16_to_cpu(new_el->l_next_free_rec) - 1]; | 4365 | le16_to_cpu(new_el->l_next_free_rec) - 1]; |
@@ -4386,18 +4386,18 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4386 | path->p_tree_depth > 0) { | 4386 | path->p_tree_depth > 0) { |
4387 | status = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos); | 4387 | status = ocfs2_find_cpos_for_right_leaf(sb, path, &right_cpos); |
4388 | if (status) | 4388 | if (status) |
4389 | goto out; | 4389 | goto free_left_path; |
4390 | 4390 | ||
4391 | if (right_cpos == 0) | 4391 | if (right_cpos == 0) |
4392 | goto out; | 4392 | goto free_left_path; |
4393 | 4393 | ||
4394 | right_path = ocfs2_new_path_from_path(path); | 4394 | right_path = ocfs2_new_path_from_path(path); |
4395 | if (!right_path) | 4395 | if (!right_path) |
4396 | goto out; | 4396 | goto free_left_path; |
4397 | 4397 | ||
4398 | status = ocfs2_find_path(et->et_ci, right_path, right_cpos); | 4398 | status = ocfs2_find_path(et->et_ci, right_path, right_cpos); |
4399 | if (status) | 4399 | if (status) |
4400 | goto out; | 4400 | goto free_right_path; |
4401 | 4401 | ||
4402 | new_el = path_leaf_el(right_path); | 4402 | new_el = path_leaf_el(right_path); |
4403 | rec = &new_el->l_recs[0]; | 4403 | rec = &new_el->l_recs[0]; |
@@ -4411,7 +4411,7 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4411 | (unsigned long long)le64_to_cpu(eb->h_blkno), | 4411 | (unsigned long long)le64_to_cpu(eb->h_blkno), |
4412 | le16_to_cpu(new_el->l_next_free_rec)); | 4412 | le16_to_cpu(new_el->l_next_free_rec)); |
4413 | status = -EINVAL; | 4413 | status = -EINVAL; |
4414 | goto out; | 4414 | goto free_right_path; |
4415 | } | 4415 | } |
4416 | rec = &new_el->l_recs[1]; | 4416 | rec = &new_el->l_recs[1]; |
4417 | } | 4417 | } |
@@ -4428,9 +4428,11 @@ ocfs2_figure_merge_contig_type(struct ocfs2_extent_tree *et, | |||
4428 | ret = contig_type; | 4428 | ret = contig_type; |
4429 | } | 4429 | } |
4430 | 4430 | ||
4431 | out: | 4431 | free_right_path: |
4432 | ocfs2_free_path(left_path); | ||
4433 | ocfs2_free_path(right_path); | 4432 | ocfs2_free_path(right_path); |
4433 | free_left_path: | ||
4434 | ocfs2_free_path(left_path); | ||
4435 | exit: | ||
4434 | return ret; | 4436 | return ret; |
4435 | } | 4437 | } |
4436 | 4438 | ||