diff options
-rw-r--r-- | fs/ext4/balloc.c | 3 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 2 | ||||
-rw-r--r-- | fs/ext4/inode.c | 6 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 5 | ||||
-rw-r--r-- | fs/ext4/super.c | 1 |
5 files changed, 9 insertions, 8 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 14c3af26c671..adf96b822781 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -592,7 +592,8 @@ ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, | |||
592 | * Account for the allocated meta blocks. We will never | 592 | * Account for the allocated meta blocks. We will never |
593 | * fail EDQUOT for metdata, but we do account for it. | 593 | * fail EDQUOT for metdata, but we do account for it. |
594 | */ | 594 | */ |
595 | if (!(*errp) && EXT4_I(inode)->i_delalloc_reserved_flag) { | 595 | if (!(*errp) && |
596 | ext4_test_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED)) { | ||
596 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 597 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); |
597 | EXT4_I(inode)->i_allocated_meta_blocks += ar.len; | 598 | EXT4_I(inode)->i_allocated_meta_blocks += ar.len; |
598 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 599 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 2a739255ee05..b7ee66ff9962 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -828,7 +828,6 @@ struct ext4_inode_info { | |||
828 | unsigned int i_reserved_data_blocks; | 828 | unsigned int i_reserved_data_blocks; |
829 | unsigned int i_reserved_meta_blocks; | 829 | unsigned int i_reserved_meta_blocks; |
830 | unsigned int i_allocated_meta_blocks; | 830 | unsigned int i_allocated_meta_blocks; |
831 | unsigned short i_delalloc_reserved_flag; | ||
832 | sector_t i_da_metadata_calc_last_lblock; | 831 | sector_t i_da_metadata_calc_last_lblock; |
833 | int i_da_metadata_calc_len; | 832 | int i_da_metadata_calc_len; |
834 | 833 | ||
@@ -1235,6 +1234,7 @@ enum { | |||
1235 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ | 1234 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ |
1236 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ | 1235 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ |
1237 | EXT4_STATE_NEWENTRY, /* File just added to dir */ | 1236 | EXT4_STATE_NEWENTRY, /* File just added to dir */ |
1237 | EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */ | ||
1238 | }; | 1238 | }; |
1239 | 1239 | ||
1240 | #define EXT4_INODE_BIT_FNS(name, field) \ | 1240 | #define EXT4_INODE_BIT_FNS(name, field) \ |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c0fe426d444a..ac08460921aa 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1330,7 +1330,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
1330 | * avoid double accounting | 1330 | * avoid double accounting |
1331 | */ | 1331 | */ |
1332 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) | 1332 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) |
1333 | EXT4_I(inode)->i_delalloc_reserved_flag = 1; | 1333 | ext4_set_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED); |
1334 | /* | 1334 | /* |
1335 | * We need to check for EXT4 here because migrate | 1335 | * We need to check for EXT4 here because migrate |
1336 | * could have changed the inode type in between | 1336 | * could have changed the inode type in between |
@@ -1360,7 +1360,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
1360 | ext4_da_update_reserve_space(inode, retval, 1); | 1360 | ext4_da_update_reserve_space(inode, retval, 1); |
1361 | } | 1361 | } |
1362 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) | 1362 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) |
1363 | EXT4_I(inode)->i_delalloc_reserved_flag = 0; | 1363 | ext4_clear_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED); |
1364 | 1364 | ||
1365 | up_write((&EXT4_I(inode)->i_data_sem)); | 1365 | up_write((&EXT4_I(inode)->i_data_sem)); |
1366 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { | 1366 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { |
@@ -2249,7 +2249,7 @@ static void mpage_da_map_and_submit(struct mpage_da_data *mpd) | |||
2249 | * affects functions in many different parts of the allocation | 2249 | * affects functions in many different parts of the allocation |
2250 | * call path. This flag exists primarily because we don't | 2250 | * call path. This flag exists primarily because we don't |
2251 | * want to change *many* call functions, so ext4_map_blocks() | 2251 | * want to change *many* call functions, so ext4_map_blocks() |
2252 | * will set the magic i_delalloc_reserved_flag once the | 2252 | * will set the EXT4_STATE_DELALLOC_RESERVED flag once the |
2253 | * inode's allocation semaphore is taken. | 2253 | * inode's allocation semaphore is taken. |
2254 | * | 2254 | * |
2255 | * If the blocks in questions were delalloc blocks, set | 2255 | * If the blocks in questions were delalloc blocks, set |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 12b604abc2fe..d47a80ec231d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -4283,7 +4283,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4283 | * EDQUOT check, as blocks and quotas have been already | 4283 | * EDQUOT check, as blocks and quotas have been already |
4284 | * reserved when data being copied into pagecache. | 4284 | * reserved when data being copied into pagecache. |
4285 | */ | 4285 | */ |
4286 | if (EXT4_I(ar->inode)->i_delalloc_reserved_flag) | 4286 | if (ext4_test_inode_state(ar->inode, EXT4_STATE_DELALLOC_RESERVED)) |
4287 | ar->flags |= EXT4_MB_DELALLOC_RESERVED; | 4287 | ar->flags |= EXT4_MB_DELALLOC_RESERVED; |
4288 | else { | 4288 | else { |
4289 | /* Without delayed allocation we need to verify | 4289 | /* Without delayed allocation we need to verify |
@@ -4380,7 +4380,8 @@ out: | |||
4380 | if (inquota && ar->len < inquota) | 4380 | if (inquota && ar->len < inquota) |
4381 | dquot_free_block(ar->inode, inquota - ar->len); | 4381 | dquot_free_block(ar->inode, inquota - ar->len); |
4382 | if (!ar->len) { | 4382 | if (!ar->len) { |
4383 | if (!EXT4_I(ar->inode)->i_delalloc_reserved_flag) | 4383 | if (!ext4_test_inode_state(ar->inode, |
4384 | EXT4_STATE_DELALLOC_RESERVED)) | ||
4384 | /* release all the reserved blocks if non delalloc */ | 4385 | /* release all the reserved blocks if non delalloc */ |
4385 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, | 4386 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, |
4386 | reserv_blks); | 4387 | reserv_blks); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 7728a4ca3d6c..f5960d673e4e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -828,7 +828,6 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) | |||
828 | ei->i_reserved_meta_blocks = 0; | 828 | ei->i_reserved_meta_blocks = 0; |
829 | ei->i_allocated_meta_blocks = 0; | 829 | ei->i_allocated_meta_blocks = 0; |
830 | ei->i_da_metadata_calc_len = 0; | 830 | ei->i_da_metadata_calc_len = 0; |
831 | ei->i_delalloc_reserved_flag = 0; | ||
832 | spin_lock_init(&(ei->i_block_reservation_lock)); | 831 | spin_lock_init(&(ei->i_block_reservation_lock)); |
833 | #ifdef CONFIG_QUOTA | 832 | #ifdef CONFIG_QUOTA |
834 | ei->i_reserved_quota = 0; | 833 | ei->i_reserved_quota = 0; |