Skip to content

Commit

Permalink
ext4: ext4_ext_convert_to_initialized bug found in extended FSX testing
Browse files Browse the repository at this point in the history
This patch addresses bugs found while testing punch hole 
with the fsx test.  The patch corrects the number of blocks
that are zeroed out while splitting an extent, and also corrects
the return value to return the number of blocks split out, instead
of the number of blocks zeroed out.

This patch has been tested in addition to the following patches: 
[Ext4 punch hole v7]
[XFS Tests Punch Hole 1/1 v2] Add Punch Hole Testing to FSX

The test ran successfully for 24 hours.

Signed-off-by: Allison Henderson <achender@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Allison Henderson authored and Theodore Ts'o committed May 16, 2011
1 parent 0b26859 commit 9b940f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -2818,8 +2818,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
(EXT4_EXT_MAY_ZEROOUT & split_flag)) {
/* case 3 */
zero_ex.ee_block =
cpu_to_le32(map->m_lblk + map->m_len);
zero_ex.ee_len = cpu_to_le16(allocated - map->m_len);
cpu_to_le32(map->m_lblk);
zero_ex.ee_len = cpu_to_le16(allocated);
ext4_ext_store_pblock(&zero_ex,
ext4_ext_pblock(ex) + map->m_lblk - ee_block);
err = ext4_ext_zeroout(inode, &zero_ex);
Expand All @@ -2842,10 +2842,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
goto out;
}

allocated = map->m_lblk - ee_block + map->m_len;

split_map.m_lblk = ee_block;
split_map.m_len = allocated;
split_map.m_len = map->m_lblk - ee_block + map->m_len;
allocated = map->m_len;
}
}

Expand Down

0 comments on commit 9b940f8

Please sign in to comment.