diff options
author | Eric Biggers <ebiggers@google.com> | 2019-12-31 21:04:39 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-01-18 00:24:54 +0300 |
commit | a1180994f52c0867c134e411a6a532ffa166ceac (patch) | |
tree | 85e4aeb41710cf3234f9339812100851b4d7f531 /fs/ext4/extents.c | |
parent | 9b02e4987ab092caed8f3bccdacaef9acf9015dd (diff) | |
download | linux-a1180994f52c0867c134e411a6a532ffa166ceac.tar.xz |
ext4: remove redundant S_ISREG() checks from ext4_fallocate()
ext4_fallocate() is only used in the file_operations for regular files.
Also, the VFS only allows fallocate() on regular files and block
devices, but block devices always use blkdev_fallocate(). For both of
these reasons, S_ISREG() is always true in ext4_fallocate().
Therefore the S_ISREG() checks in ext4_zero_range(),
ext4_collapse_range(), ext4_insert_range(), and ext4_punch_hole() are
redundant. Remove them.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20191231180444.46586-4-ebiggers@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 9ff19cfc4ecb..94a25ca5f08f 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4674,9 +4674,6 @@ static long ext4_zero_range(struct file *file, loff_t offset, trace_ext4_zero_range(inode, offset, len, mode); - if (!S_ISREG(inode->i_mode)) - return -EINVAL; - /* Call ext4_force_commit to flush all data in case of data=journal. */ if (ext4_should_journal_data(inode)) { ret = ext4_force_commit(inode->i_sb); @@ -5439,9 +5436,6 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) if (!IS_ALIGNED(offset | len, EXT4_CLUSTER_SIZE(sb))) return -EINVAL; - if (!S_ISREG(inode->i_mode)) - return -EINVAL; - trace_ext4_collapse_range(inode, offset, len); punch_start = offset >> EXT4_BLOCK_SIZE_BITS(sb); @@ -5588,9 +5582,6 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) if (!IS_ALIGNED(offset | len, EXT4_CLUSTER_SIZE(sb))) return -EINVAL; - if (!S_ISREG(inode->i_mode)) - return -EOPNOTSUPP; - trace_ext4_insert_range(inode, offset, len); offset_lblk = offset >> EXT4_BLOCK_SIZE_BITS(sb); |