aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index f1c538e5055c..06b30b61205f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3461,8 +3461,27 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
3461 3461
3462 ext4_ext_mark_uninitialized(ex); 3462 ext4_ext_mark_uninitialized(ex);
3463 3463
3464 err = ext4_ext_remove_space(inode, map->m_lblk, 3464 ext4_ext_invalidate_cache(inode);
3465 map->m_lblk + punched_out); 3465
3466 err = ext4_ext_rm_leaf(handle, inode, path,
3467 map->m_lblk, map->m_lblk + punched_out);
3468
3469 if (!err && path->p_hdr->eh_entries == 0) {
3470 /*
3471 * Punch hole freed all of this sub tree,
3472 * so we need to correct eh_depth
3473 */
3474 err = ext4_ext_get_access(handle, inode, path);
3475 if (err == 0) {
3476 ext_inode_hdr(inode)->eh_depth = 0;
3477 ext_inode_hdr(inode)->eh_max =
3478 cpu_to_le16(ext4_ext_space_root(
3479 inode, 0));
3480
3481 err = ext4_ext_dirty(
3482 handle, inode, path);
3483 }
3484 }
3466 3485
3467 goto out2; 3486 goto out2;
3468 } 3487 }