diff options
author | Eric Sandeen <sandeen@redhat.com> | 2012-11-08 11:11:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-11-08 11:11:59 -0500 |
commit | 6d138ced751d4e41e02c38ad55d1b3cd2913b150 (patch) | |
tree | 65034e5f0e777ef00f61ca6082ee992df57884d1 | |
parent | b72f78cb63fb595af63fc781dced0a6fd354e572 (diff) |
ext4: fix awful goto in ext4_mb_new_blocks()
I think the whole function could be made prettier, but
that goto really took the cake for too-clever-by-half.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/mballoc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 526e55358606..27f421c8043d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -4310,8 +4310,10 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4310 | repeat: | 4310 | repeat: |
4311 | /* allocate space in core */ | 4311 | /* allocate space in core */ |
4312 | *errp = ext4_mb_regular_allocator(ac); | 4312 | *errp = ext4_mb_regular_allocator(ac); |
4313 | if (*errp) | 4313 | if (*errp) { |
4314 | ext4_discard_allocated_blocks(ac); | ||
4314 | goto errout; | 4315 | goto errout; |
4316 | } | ||
4315 | 4317 | ||
4316 | /* as we've just preallocated more space than | 4318 | /* as we've just preallocated more space than |
4317 | * user requested orinally, we store allocated | 4319 | * user requested orinally, we store allocated |
@@ -4333,10 +4335,10 @@ repeat: | |||
4333 | ac->ac_b_ex.fe_len = 0; | 4335 | ac->ac_b_ex.fe_len = 0; |
4334 | ac->ac_status = AC_STATUS_CONTINUE; | 4336 | ac->ac_status = AC_STATUS_CONTINUE; |
4335 | goto repeat; | 4337 | goto repeat; |
4336 | } else if (*errp) | 4338 | } else if (*errp) { |
4337 | errout: | ||
4338 | ext4_discard_allocated_blocks(ac); | 4339 | ext4_discard_allocated_blocks(ac); |
4339 | else { | 4340 | goto errout; |
4341 | } else { | ||
4340 | block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); | 4342 | block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); |
4341 | ar->len = ac->ac_b_ex.fe_len; | 4343 | ar->len = ac->ac_b_ex.fe_len; |
4342 | } | 4344 | } |
@@ -4347,6 +4349,7 @@ repeat: | |||
4347 | *errp = -ENOSPC; | 4349 | *errp = -ENOSPC; |
4348 | } | 4350 | } |
4349 | 4351 | ||
4352 | errout: | ||
4350 | if (*errp) { | 4353 | if (*errp) { |
4351 | ac->ac_b_ex.fe_len = 0; | 4354 | ac->ac_b_ex.fe_len = 0; |
4352 | ar->len = 0; | 4355 | ar->len = 0; |