diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/mballoc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 1a9c22b45a01..a9ff5e5137ca 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -4406,17 +4406,20 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4406 | repeat: | 4406 | repeat: |
4407 | /* allocate space in core */ | 4407 | /* allocate space in core */ |
4408 | *errp = ext4_mb_regular_allocator(ac); | 4408 | *errp = ext4_mb_regular_allocator(ac); |
4409 | if (*errp) { | 4409 | if (*errp) |
4410 | ext4_discard_allocated_blocks(ac); | 4410 | goto discard_and_exit; |
4411 | goto errout; | ||
4412 | } | ||
4413 | 4411 | ||
4414 | /* as we've just preallocated more space than | 4412 | /* as we've just preallocated more space than |
4415 | * user requested orinally, we store allocated | 4413 | * user requested originally, we store allocated |
4416 | * space in a special descriptor */ | 4414 | * space in a special descriptor */ |
4417 | if (ac->ac_status == AC_STATUS_FOUND && | 4415 | if (ac->ac_status == AC_STATUS_FOUND && |
4418 | ac->ac_o_ex.fe_len < ac->ac_b_ex.fe_len) | 4416 | ac->ac_o_ex.fe_len < ac->ac_b_ex.fe_len) |
4419 | ext4_mb_new_preallocation(ac); | 4417 | *errp = ext4_mb_new_preallocation(ac); |
4418 | if (*errp) { | ||
4419 | discard_and_exit: | ||
4420 | ext4_discard_allocated_blocks(ac); | ||
4421 | goto errout; | ||
4422 | } | ||
4420 | } | 4423 | } |
4421 | if (likely(ac->ac_status == AC_STATUS_FOUND)) { | 4424 | if (likely(ac->ac_status == AC_STATUS_FOUND)) { |
4422 | *errp = ext4_mb_mark_diskspace_used(ac, handle, reserv_clstrs); | 4425 | *errp = ext4_mb_mark_diskspace_used(ac, handle, reserv_clstrs); |