Skip to content

Commit aeb2817

Browse files
Ashish Sangwantytso
authored andcommitted
ext4: pass inode pointer instead of file pointer to punch hole
No need to pass file pointer when we can directly pass inode pointer. Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent c4932db commit aeb2817

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎fs/ext4/ext4.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int);
20882088
extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
20892089
extern int ext4_can_truncate(struct inode *inode);
20902090
extern void ext4_truncate(struct inode *);
2091-
extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length);
2091+
extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
20922092
extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
20932093
extern void ext4_set_inode_flags(struct inode *);
20942094
extern void ext4_get_inode_flags(struct ext4_inode_info *);

‎fs/ext4/extents.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4463,7 +4463,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
44634463
return -EOPNOTSUPP;
44644464

44654465
if (mode & FALLOC_FL_PUNCH_HOLE)
4466-
return ext4_punch_hole(file, offset, len);
4466+
return ext4_punch_hole(inode, offset, len);
44674467

44684468
ret = ext4_convert_inline_data(inode);
44694469
if (ret)

‎fs/ext4/inode.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3481,9 +3481,8 @@ int ext4_can_truncate(struct inode *inode)
34813481
* Returns: 0 on success or negative on failure
34823482
*/
34833483

3484-
int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
3484+
int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
34853485
{
3486-
struct inode *inode = file_inode(file);
34873486
struct super_block *sb = inode->i_sb;
34883487
ext4_lblk_t first_block, stop_block;
34893488
struct address_space *mapping = inode->i_mapping;

0 commit comments

Comments
 (0)