aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-09-04 18:07:25 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-09-04 18:07:25 -0400
commite3cf5d5d9a86df1c5e413bdd3725c25a16ff854c (patch)
tree77a44d159efb7807419e6443584cc67f28929c10 /fs/ext4/mballoc.c
parenta521100231f816f8cdd9c8e77da14ff1e42c2b17 (diff)
ext4: prepare to drop EXT4_STATE_DELALLOC_RESERVED
The EXT4_STATE_DELALLOC_RESERVED flag was originally implemented because it was too hard to make sure the mballoc and get_block flags could be reliably passed down through all of the codepaths that end up calling ext4_mb_new_blocks(). Since then, we have mb_flags passed down through most of the code paths, so getting rid of EXT4_STATE_DELALLOC_RESERVED isn't as tricky as it used to. This commit plumbs in the last of what is required, and then adds a WARN_ON check to make sure we haven't missed anything. If this passes a full regression test run, we can then drop EXT4_STATE_DELALLOC_RESERVED. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 8b0f9ef517d6..15dffdac5907 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4415,9 +4415,12 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4415 * EDQUOT check, as blocks and quotas have been already 4415 * EDQUOT check, as blocks and quotas have been already
4416 * reserved when data being copied into pagecache. 4416 * reserved when data being copied into pagecache.
4417 */ 4417 */
4418 if (ext4_test_inode_state(ar->inode, EXT4_STATE_DELALLOC_RESERVED)) 4418 if (ext4_test_inode_state(ar->inode, EXT4_STATE_DELALLOC_RESERVED)) {
4419 WARN_ON((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0);
4419 ar->flags |= EXT4_MB_DELALLOC_RESERVED; 4420 ar->flags |= EXT4_MB_DELALLOC_RESERVED;
4420 else { 4421 }
4422
4423 if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
4421 /* Without delayed allocation we need to verify 4424 /* Without delayed allocation we need to verify
4422 * there is enough free blocks to do block allocation 4425 * there is enough free blocks to do block allocation
4423 * and verify allocation doesn't exceed the quota limits. 4426 * and verify allocation doesn't exceed the quota limits.
@@ -4528,8 +4531,7 @@ out:
4528 if (inquota && ar->len < inquota) 4531 if (inquota && ar->len < inquota)
4529 dquot_free_block(ar->inode, EXT4_C2B(sbi, inquota - ar->len)); 4532 dquot_free_block(ar->inode, EXT4_C2B(sbi, inquota - ar->len));
4530 if (!ar->len) { 4533 if (!ar->len) {
4531 if (!ext4_test_inode_state(ar->inode, 4534 if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0)
4532 EXT4_STATE_DELALLOC_RESERVED))
4533 /* release all the reserved blocks if non delalloc */ 4535 /* release all the reserved blocks if non delalloc */
4534 percpu_counter_sub(&sbi->s_dirtyclusters_counter, 4536 percpu_counter_sub(&sbi->s_dirtyclusters_counter,
4535 reserv_clstrs); 4537 reserv_clstrs);