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>
This commit is contained in:
@@ -1933,6 +1933,8 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
|
||||
ext4_lblk_t next;
|
||||
int mb_flags = 0, unwritten;
|
||||
|
||||
if (gb_flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
|
||||
mb_flags |= EXT4_MB_DELALLOC_RESERVED;
|
||||
if (unlikely(ext4_ext_get_actual_len(newext) == 0)) {
|
||||
EXT4_ERROR_INODE(inode, "ext4_ext_get_actual_len(newext) == 0");
|
||||
return -EIO;
|
||||
@@ -2054,7 +2056,7 @@ prepend:
|
||||
* We're gonna add a new leaf in the tree.
|
||||
*/
|
||||
if (gb_flags & EXT4_GET_BLOCKS_METADATA_NOFAIL)
|
||||
mb_flags = EXT4_MB_USE_RESERVED;
|
||||
mb_flags |= EXT4_MB_USE_RESERVED;
|
||||
err = ext4_ext_create_new_leaf(handle, inode, mb_flags, gb_flags,
|
||||
ppath, newext);
|
||||
if (err)
|
||||
@@ -4438,6 +4440,8 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
|
||||
ar.flags = 0;
|
||||
if (flags & EXT4_GET_BLOCKS_NO_NORMALIZE)
|
||||
ar.flags |= EXT4_MB_HINT_NOPREALLOC;
|
||||
if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
|
||||
ar.flags |= EXT4_MB_DELALLOC_RESERVED;
|
||||
newblock = ext4_mb_new_blocks(handle, &ar, &err);
|
||||
if (!newblock)
|
||||
goto out2;
|
||||
|
Reference in New Issue
Block a user