aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorZheng Liu <wenqing.lz@taobao.com>2013-03-10 21:13:05 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-03-10 21:13:05 -0400
commitadb2355104b2109e06ba5276485d187d023b2fd2 (patch)
treebb5e3ba551ec90d772e9605f21ba99c37119ff37 /fs/ext4/inode.c
parentcdee78433c138c2f2018a6884673739af2634787 (diff)
ext4: update extent status tree after an extent is zeroed out
When we try to split an extent, this extent could be zeroed out and mark as initialized. But we don't know this in ext4_map_blocks because it only returns a length of allocated extent. Meanwhile we will mark this extent as uninitialized because we only check m_flags. This commit update extent status tree when we try to split an unwritten extent. We don't need to worry about the status of this extent because we always mark it as initialized. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Dmitry Monakhov <dmonakhov@openvz.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3186a43fa4b0..4f1d54a88d8c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -722,6 +722,15 @@ found:
722 } 722 }
723#endif 723#endif
724 724
725 /*
726 * If the extent has been zeroed out, we don't need to update
727 * extent status tree.
728 */
729 if ((flags & EXT4_GET_BLOCKS_PRE_IO) &&
730 ext4_es_lookup_extent(inode, map->m_lblk, &es)) {
731 if (ext4_es_is_written(&es))
732 goto has_zeroout;
733 }
725 status = map->m_flags & EXT4_MAP_UNWRITTEN ? 734 status = map->m_flags & EXT4_MAP_UNWRITTEN ?
726 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; 735 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
727 if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && 736 if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) &&
@@ -734,6 +743,7 @@ found:
734 retval = ret; 743 retval = ret;
735 } 744 }
736 745
746has_zeroout:
737 up_write((&EXT4_I(inode)->i_data_sem)); 747 up_write((&EXT4_I(inode)->i_data_sem));
738 if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { 748 if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) {
739 int ret = check_block_validity(inode, map); 749 int ret = check_block_validity(inode, map);