add patch remove-unneeded-test-of-ret-variable
[ext4-patch-queue.git] / remove-unneeded-test-of-ret-variable
blobbe9e40e99714d006ce0801206849a0cbc6506049
1 ext4: remove unneeded test of ret variable
3 From: Lukas Czerner <lczerner@redhat.com>
5 Currently in ext4_fallocate() and ext4_zero_range() we're testing ret
6 variable along with new_size. However in ext4_fallocate() we just tested
7 ret before and in ext4_zero_range() if will always be zero when we get
8 there so there is no need to test it in both cases.
10 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
11 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 ---
13  fs/ext4/extents.c | 8 ++++----
14  1 file changed, 4 insertions(+), 4 deletions(-)
16 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
17 index 491208c..8c09e1d 100644
18 --- a/fs/ext4/extents.c
19 +++ b/fs/ext4/extents.c
20 @@ -4816,12 +4816,12 @@ static long ext4_zero_range(struct file *file, loff_t offset,
22         inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
24 -       if (!ret && new_size) {
25 +       if (new_size) {
26                 if (new_size > i_size_read(inode))
27                         i_size_write(inode, new_size);
28                 if (new_size > EXT4_I(inode)->i_disksize)
29                         ext4_update_i_disksize(inode, new_size);
30 -       } else if (!ret && !new_size) {
31 +       } else {
32                 /*
33                 * Mark that we allocate beyond EOF so the subsequent truncate
34                 * can proceed even if the new size is the same as i_size.
35 @@ -4923,14 +4923,14 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
37         tv = inode->i_ctime = ext4_current_time(inode);
39 -       if (!ret && new_size) {
40 +       if (new_size) {
41                 if (new_size > i_size_read(inode)) {
42                         i_size_write(inode, new_size);
43                         inode->i_mtime = tv;
44                 }
45                 if (new_size > EXT4_I(inode)->i_disksize)
46                         ext4_update_i_disksize(inode, new_size);
47 -       } else if (!ret && !new_size) {
48 +       } else {
49                 /*
50                 * Mark that we allocate beyond EOF so the subsequent truncate
51                 * can proceed even if the new size is the same as i_size.
52 -- 
53 1.8.3.1
56 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
57 the body of a message to majordomo@vger.kernel.org
58 More majordomo info at  http://vger.kernel.org/majordomo-info.html