1 ext4: remove unneeded test in ext4_alloc_file_blocks()
3 From: Fabian Frederick <fabf@skynet.be>
5 ext4_alloc_file_blocks() is called from ext4_zero_range() and
6 ext4_fallocate() both already testing EXT4_INODE_EXTENTS
7 We can call ext_depth(inode) unconditionnally.
9 [ Added BUG_ON check to make sure ext4_alloc_file_blocks() won't get
10 called for a indirect-mapped inode in the future. -- tytso ]
12 Signed-off-by: Fabian Frederick <fabf@skynet.be>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 fs/ext4/extents.c | 9 ++-------
16 1 file changed, 2 insertions(+), 7 deletions(-)
18 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
19 index 7f69347..ef28855 100644
20 --- a/fs/ext4/extents.c
21 +++ b/fs/ext4/extents.c
22 @@ -4679,6 +4679,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
26 + BUG_ON(!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS));
30 @@ -4693,13 +4694,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
31 * credits to insert 1 extent into extent tree
33 credits = ext4_chunk_trans_blocks(inode, len);
35 - * We can only call ext_depth() on extent based inodes
37 - if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
38 - depth = ext_depth(inode);
41 + depth = ext_depth(inode);
44 while (ret >= 0 && len) {