Commit 754cfed6 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: drop the EXT4_STATE_DELALLOC_RESERVED flag

Having done a full regression test, we can now drop the
DELALLOC_RESERVED state flag.
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
parent e3cf5d5d
...@@ -1400,7 +1400,6 @@ enum { ...@@ -1400,7 +1400,6 @@ enum {
EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */
EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/
EXT4_STATE_NEWENTRY, /* File just added to dir */ EXT4_STATE_NEWENTRY, /* File just added to dir */
EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */
EXT4_STATE_DIOREAD_LOCK, /* Disable support for dio read EXT4_STATE_DIOREAD_LOCK, /* Disable support for dio read
nolocking */ nolocking */
EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */ EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */
......
...@@ -595,14 +595,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, ...@@ -595,14 +595,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
*/ */
down_write(&EXT4_I(inode)->i_data_sem); down_write(&EXT4_I(inode)->i_data_sem);
/*
* if the caller is from delayed allocation writeout path
* we have already reserved fs blocks for allocation
* let the underlying get_block() function know to
* avoid double accounting
*/
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
ext4_set_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED);
/* /*
* We need to check for EXT4 here because migrate * We need to check for EXT4 here because migrate
* could have changed the inode type in between * could have changed the inode type in between
...@@ -631,8 +623,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, ...@@ -631,8 +623,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)) (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE))
ext4_da_update_reserve_space(inode, retval, 1); ext4_da_update_reserve_space(inode, retval, 1);
} }
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
ext4_clear_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED);
if (retval > 0) { if (retval > 0) {
unsigned int status; unsigned int status;
...@@ -2004,12 +1994,10 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd) ...@@ -2004,12 +1994,10 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
* in data loss. So use reserved blocks to allocate metadata if * in data loss. So use reserved blocks to allocate metadata if
* possible. * possible.
* *
* We pass in the magic EXT4_GET_BLOCKS_DELALLOC_RESERVE if the blocks * We pass in the magic EXT4_GET_BLOCKS_DELALLOC_RESERVE if
* in question are delalloc blocks. This affects functions in many * the blocks in question are delalloc blocks. This indicates
* different parts of the allocation call path. This flag exists * that the blocks and quotas has already been checked when
* primarily because we don't want to change *many* call functions, so * the data was copied into the page cache.
* ext4_map_blocks() will set the EXT4_STATE_DELALLOC_RESERVED flag
* once the inode's allocation semaphore is taken.
*/ */
get_blocks_flags = EXT4_GET_BLOCKS_CREATE | get_blocks_flags = EXT4_GET_BLOCKS_CREATE |
EXT4_GET_BLOCKS_METADATA_NOFAIL; EXT4_GET_BLOCKS_METADATA_NOFAIL;
......
...@@ -4410,16 +4410,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, ...@@ -4410,16 +4410,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
if (IS_NOQUOTA(ar->inode)) if (IS_NOQUOTA(ar->inode))
ar->flags |= EXT4_MB_USE_ROOT_BLOCKS; ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
/*
* For delayed allocation, we could skip the ENOSPC and
* EDQUOT check, as blocks and quotas have been already
* reserved when data being copied into pagecache.
*/
if (ext4_test_inode_state(ar->inode, EXT4_STATE_DELALLOC_RESERVED)) {
WARN_ON((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0);
ar->flags |= EXT4_MB_DELALLOC_RESERVED;
}
if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) { if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
/* Without delayed allocation we need to verify /* Without delayed allocation we need to verify
* there is enough free blocks to do block allocation * there is enough free blocks to do block allocation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment