Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174399
b: refs/heads/master
c: b844167
h: refs/heads/master
i:
  174397: b85ce38
  174395: 9ee9694
  174391: 923a62c
  174383: aabdc8e
  174367: 4b6b959
  174335: 5270c65
v: v3
  • Loading branch information
Curt Wohlgemuth authored and Theodore Ts'o committed Dec 9, 2009
1 parent a67c3a9 commit 2e77924
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4edac314e9ad0b21ba20ba8bc61b61f186f79e1
refs/heads/master: b844167edc7fcafda9623955c05e4c1b3c32ebc7
19 changes: 19 additions & 0 deletions trunk/fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3010,6 +3010,24 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
trace_ext4_mballoc_prealloc(ac);
}

/*
* Called on failure; free up any blocks from the inode PA for this
* context. We don't need this for MB_GROUP_PA because we only change
* pa_free in ext4_mb_release_context(), but on failure, we've already
* zeroed out ac->ac_b_ex.fe_len, so group_pa->pa_free is not changed.
*/
static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
{
struct ext4_prealloc_space *pa = ac->ac_pa;
int len;

if (pa && pa->pa_type == MB_INODE_PA) {
len = ac->ac_b_ex.fe_len;
pa->pa_free += len;
}

}

/*
* use blocks preallocated to inode
*/
Expand Down Expand Up @@ -4295,6 +4313,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
ac->ac_status = AC_STATUS_CONTINUE;
goto repeat;
} else if (*errp) {
ext4_discard_allocated_blocks(ac);
ac->ac_b_ex.fe_len = 0;
ar->len = 0;
ext4_mb_show_ac(ac);
Expand Down

0 comments on commit 2e77924

Please sign in to comment.