aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4.h1
-rw-r--r--fs/ext4/extents.c4
-rw-r--r--fs/ext4/mballoc.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 49d2cea47382..d13f3b509886 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -526,6 +526,7 @@ struct ext4_new_group_data {
526#define EXT4_FREE_BLOCKS_METADATA 0x0001 526#define EXT4_FREE_BLOCKS_METADATA 0x0001
527#define EXT4_FREE_BLOCKS_FORGET 0x0002 527#define EXT4_FREE_BLOCKS_FORGET 0x0002
528#define EXT4_FREE_BLOCKS_VALIDATED 0x0004 528#define EXT4_FREE_BLOCKS_VALIDATED 0x0004
529#define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008
529 530
530/* 531/*
531 * ioctl commands 532 * ioctl commands
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 31ae5fbe89e5..a86213882655 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3565,12 +3565,14 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3565 3565
3566 err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); 3566 err = ext4_ext_insert_extent(handle, inode, path, &newex, flags);
3567 if (err) { 3567 if (err) {
3568 int fb_flags = flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE ?
3569 EXT4_FREE_BLOCKS_NO_QUOT_UPDATE : 0;
3568 /* free data blocks we just allocated */ 3570 /* free data blocks we just allocated */
3569 /* not a good idea to call discard here directly, 3571 /* not a good idea to call discard here directly,
3570 * but otherwise we'd need to call it every free() */ 3572 * but otherwise we'd need to call it every free() */
3571 ext4_discard_preallocations(inode); 3573 ext4_discard_preallocations(inode);
3572 ext4_free_blocks(handle, inode, NULL, ext4_ext_pblock(&newex), 3574 ext4_free_blocks(handle, inode, NULL, ext4_ext_pblock(&newex),
3573 ext4_ext_get_actual_len(&newex), 0); 3575 ext4_ext_get_actual_len(&newex), fb_flags);
3574 goto out2; 3576 goto out2;
3575 } 3577 }
3576 3578
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 389386b41c98..1900ec7a1579 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4637,7 +4637,7 @@ do_more:
4637 } 4637 }
4638 ext4_mark_super_dirty(sb); 4638 ext4_mark_super_dirty(sb);
4639error_return: 4639error_return:
4640 if (freed) 4640 if (freed && !(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE))
4641 dquot_free_block(inode, freed); 4641 dquot_free_block(inode, freed);
4642 brelse(bitmap_bh); 4642 brelse(bitmap_bh);
4643 ext4_std_error(sb, err); 4643 ext4_std_error(sb, err);