Skip to content

Commit 754cfed

Browse files
committed
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: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
1 parent e3cf5d5 commit 754cfed

3 files changed

Lines changed: 4 additions & 27 deletions

File tree

‎fs/ext4/ext4.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,6 @@ enum {
14001400
EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */
14011401
EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/
14021402
EXT4_STATE_NEWENTRY, /* File just added to dir */
1403-
EXT4_STATE_DELALLOC_RESERVED, /* blks already reserved for delalloc */
14041403
EXT4_STATE_DIOREAD_LOCK, /* Disable support for dio read
14051404
nolocking */
14061405
EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */

‎fs/ext4/inode.c‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -595,14 +595,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
595595
*/
596596
down_write(&EXT4_I(inode)->i_data_sem);
597597

598-
/*
599-
* if the caller is from delayed allocation writeout path
600-
* we have already reserved fs blocks for allocation
601-
* let the underlying get_block() function know to
602-
* avoid double accounting
603-
*/
604-
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
605-
ext4_set_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED);
606598
/*
607599
* We need to check for EXT4 here because migrate
608600
* could have changed the inode type in between
@@ -631,8 +623,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
631623
(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE))
632624
ext4_da_update_reserve_space(inode, retval, 1);
633625
}
634-
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
635-
ext4_clear_inode_state(inode, EXT4_STATE_DELALLOC_RESERVED);
636626

637627
if (retval > 0) {
638628
unsigned int status;
@@ -2004,12 +1994,10 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
20041994
* in data loss. So use reserved blocks to allocate metadata if
20051995
* possible.
20061996
*
2007-
* We pass in the magic EXT4_GET_BLOCKS_DELALLOC_RESERVE if the blocks
2008-
* in question are delalloc blocks. This affects functions in many
2009-
* different parts of the allocation call path. This flag exists
2010-
* primarily because we don't want to change *many* call functions, so
2011-
* ext4_map_blocks() will set the EXT4_STATE_DELALLOC_RESERVED flag
2012-
* once the inode's allocation semaphore is taken.
1997+
* We pass in the magic EXT4_GET_BLOCKS_DELALLOC_RESERVE if
1998+
* the blocks in question are delalloc blocks. This indicates
1999+
* that the blocks and quotas has already been checked when
2000+
* the data was copied into the page cache.
20132001
*/
20142002
get_blocks_flags = EXT4_GET_BLOCKS_CREATE |
20152003
EXT4_GET_BLOCKS_METADATA_NOFAIL;

‎fs/ext4/mballoc.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4410,16 +4410,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
44104410
if (IS_NOQUOTA(ar->inode))
44114411
ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
44124412

4413-
/*
4414-
* For delayed allocation, we could skip the ENOSPC and
4415-
* EDQUOT check, as blocks and quotas have been already
4416-
* reserved when data being copied into pagecache.
4417-
*/
4418-
if (ext4_test_inode_state(ar->inode, EXT4_STATE_DELALLOC_RESERVED)) {
4419-
WARN_ON((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0);
4420-
ar->flags |= EXT4_MB_DELALLOC_RESERVED;
4421-
}
4422-
44234413
if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
44244414
/* Without delayed allocation we need to verify
44254415
* there is enough free blocks to do block allocation

0 commit comments

Comments
 (0)