|
@@ -1412,6 +1412,8 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
|
|
int last = first + count - 1;
|
|
int last = first + count - 1;
|
|
struct super_block *sb = e4b->bd_sb;
|
|
struct super_block *sb = e4b->bd_sb;
|
|
|
|
|
|
|
|
+ if (WARN_ON(count == 0))
|
|
|
|
+ return;
|
|
BUG_ON(last >= (sb->s_blocksize << 3));
|
|
BUG_ON(last >= (sb->s_blocksize << 3));
|
|
assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
|
|
assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
|
|
/* Don't bother if the block group is corrupt. */
|
|
/* Don't bother if the block group is corrupt. */
|
|
@@ -3221,6 +3223,8 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
|
|
int err;
|
|
int err;
|
|
|
|
|
|
if (pa == NULL) {
|
|
if (pa == NULL) {
|
|
|
|
+ if (ac->ac_f_ex.fe_len == 0)
|
|
|
|
+ return;
|
|
err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b);
|
|
err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b);
|
|
if (err) {
|
|
if (err) {
|
|
/*
|
|
/*
|
|
@@ -3235,6 +3239,7 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
|
|
mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start,
|
|
mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start,
|
|
ac->ac_f_ex.fe_len);
|
|
ac->ac_f_ex.fe_len);
|
|
ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group);
|
|
ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group);
|
|
|
|
+ ext4_mb_unload_buddy(&e4b);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (pa->pa_type == MB_INODE_PA)
|
|
if (pa->pa_type == MB_INODE_PA)
|