|
@@ -5383,6 +5383,13 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
|
|
punch_start = offset >> EXT4_BLOCK_SIZE_BITS(sb);
|
|
punch_start = offset >> EXT4_BLOCK_SIZE_BITS(sb);
|
|
punch_stop = (offset + len) >> EXT4_BLOCK_SIZE_BITS(sb);
|
|
punch_stop = (offset + len) >> EXT4_BLOCK_SIZE_BITS(sb);
|
|
|
|
|
|
|
|
+ /* 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);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* Write out all dirty pages */
|
|
/* Write out all dirty pages */
|
|
ret = filemap_write_and_wait_range(inode->i_mapping, offset, -1);
|
|
ret = filemap_write_and_wait_range(inode->i_mapping, offset, -1);
|
|
if (ret)
|
|
if (ret)
|