Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3fe493c authored by Fabian Frederick's avatar Fabian Frederick Committed by Theodore Ts'o
Browse files

ext4: remove unneeded test in ext4_alloc_file_blocks()



ext4_alloc_file_blocks() is called from ext4_zero_range() and
ext4_fallocate() both already testing EXT4_INODE_EXTENTS
We can call ext_depth(inode) unconditionnally.

[ Added BUG_ON check to make sure ext4_alloc_file_blocks() won't get
  called for a indirect-mapped inode in the future.  -- tytso ]

Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent edf15aa1
Loading
Loading
Loading
Loading
+2 −7
Original line number Original line Diff line number Diff line
@@ -4679,6 +4679,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
	unsigned int credits;
	unsigned int credits;
	loff_t epos;
	loff_t epos;


	BUG_ON(!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS));
	map.m_lblk = offset;
	map.m_lblk = offset;
	map.m_len = len;
	map.m_len = len;
	/*
	/*
@@ -4693,13 +4694,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
	 * credits to insert 1 extent into extent tree
	 * credits to insert 1 extent into extent tree
	 */
	 */
	credits = ext4_chunk_trans_blocks(inode, len);
	credits = ext4_chunk_trans_blocks(inode, len);
	/*
	 * We can only call ext_depth() on extent based inodes
	 */
	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
	depth = ext_depth(inode);
	depth = ext_depth(inode);
	else
		depth = -1;


retry:
retry:
	while (ret >= 0 && len) {
	while (ret >= 0 && len) {