@@ -3414,9 +3414,6 @@ static inline int ext4_update_inode_size(struct inode *inode, loff_t newsize)
return changed;
}
-int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset,
- loff_t len);
-
struct ext4_group_info {
unsigned long bb_state;
#ifdef AGGRESSIVE_CHECK
@@ -4637,10 +4637,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
flags |= (EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
EXT4_EX_NOCACHE);
- ret = ext4_update_disksize_before_punch(inode, offset, len);
- if (ret)
- goto out_invalidate_lock;
-
/* Now release the pages and zero block aligned part of pages */
truncate_pagecache_range(inode, start, end - 1);
@@ -3872,37 +3872,6 @@ int ext4_can_truncate(struct inode *inode)
return 0;
}
-/*
- * We have to make sure i_disksize gets properly updated before we truncate
- * page cache due to hole punching or zero range. Otherwise i_disksize update
- * can get lost as it may have been postponed to submission of writeback but
- * that will never happen after we truncate page cache.
- */
-int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset,
- loff_t len)
-{
- handle_t *handle;
- int ret;
-
- loff_t size = i_size_read(inode);
-
- WARN_ON(!inode_is_locked(inode));
- if (offset > size || offset + len < size)
- return 0;
-
- if (EXT4_I(inode)->i_disksize >= size)
- return 0;
-
- handle = ext4_journal_start(inode, EXT4_HT_MISC, 1);
- if (IS_ERR(handle))
- return PTR_ERR(handle);
- ext4_update_i_disksize(inode, size);
- ret = ext4_mark_inode_dirty(handle, inode);
- ext4_journal_stop(handle);
-
- return ret;
-}
-
static void ext4_wait_dax_page(struct inode *inode)
{
filemap_invalidate_unlock(inode->i_mapping);
@@ -4022,13 +3991,9 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
last_block_offset = round_down((offset + length), sb->s_blocksize) - 1;
/* Now release the pages and zero block aligned part of pages*/
- if (last_block_offset > first_block_offset) {
- ret = ext4_update_disksize_before_punch(inode, offset, length);
- if (ret)
- goto out_dio;
+ if (last_block_offset > first_block_offset)
truncate_pagecache_range(inode, first_block_offset,
last_block_offset);
- }
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
credits = ext4_writepage_trans_blocks(inode);