Skip to contentSkip to conversation

ext4: pass inode pointer instead of file poiner to punch hole

PATCH Applied [email protected] 2 participants 2 messages May 24, 2013 – Jun 18, 2013 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: pass inode pointer instead of file poiner to punch hole

From: Ashish Sangwan <[email protected]>

No need to pass file pointer when we can directly pass inode pointer.

---
 fs/ext4/ext4.h    |    2 +-
 fs/ext4/extents.c |    2 +-
 fs/ext4/inode.c   |    3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)
fs/ext4/ext4.h +1 -1
index 5aae3d1..04e4d1e 100644
@@ -2088,7 +2088,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int);
 extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
 extern int ext4_can_truncate(struct inode *inode);
 extern void ext4_truncate(struct inode *);
-extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length);
+extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
 extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
 extern void ext4_set_inode_flags(struct inode *);
 extern void ext4_get_inode_flags(struct ext4_inode_info *);
fs/ext4/extents.c +1 -1
index bc0f191..3676dae 100644
@@ -4446,7 +4446,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EOPNOTSUPP;
 
 	if (mode & FALLOC_FL_PUNCH_HOLE)
-		return ext4_punch_hole(file, offset, len);
+		return ext4_punch_hole(inode, offset, len);
 
 	ret = ext4_convert_inline_data(inode);
 	if (ret)
fs/ext4/inode.c +1 -2
index d6382b8..06e0fe2 100644
@@ -3580,9 +3580,8 @@ int ext4_can_truncate(struct inode *inode)
  * Returns: 0 on success or negative on failure
  */
 
-int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
+int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
 {
-	struct inode *inode = file_inode(file);
 	struct super_block *sb = inode->i_sb;
 	ext4_lblk_t first_block, stop_block;
 	struct address_space *mapping = inode->i_mapping;
Signature · 1 line
1.7.2.3