add patch create-function-to-read-journal-inode
[ext4-patch-queue.git] / remove-unneeded-test-in-ext4_alloc_file_blocks
blobb953bbef659d127e6e64c929ecb0d8123f10ad22
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>
14 ---
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,
23         unsigned int credits;
24         loff_t epos;
26 +       BUG_ON(!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS));
27         map.m_lblk = offset;
28         map.m_len = len;
29         /*
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
32          */
33         credits = ext4_chunk_trans_blocks(inode, len);
34 -       /*
35 -        * We can only call ext_depth() on extent based inodes
36 -        */
37 -       if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
38 -               depth = ext_depth(inode);
39 -       else
40 -               depth = -1;
41 +       depth = ext_depth(inode);
43  retry:
44         while (ret >= 0 && len) {