]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ext4: fix the wrong number of the allocated blocks in ext4_split_extent()
authorZheng Liu <wenqing.lz@taobao.com>
Mon, 11 Mar 2013 01:20:23 +0000 (21:20 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 27 Mar 2013 02:41:11 +0000 (02:41 +0000)
commitb875372a397f6df49af30c4db431a4a699cf40c1
treed0276c1306f03a508e2ac40e23c0fe124503f3d3
parentb47085aa6c21a8d62b654c0369e615eb7bf167da
ext4: fix the wrong number of the allocated blocks in ext4_split_extent()

commit 3a2256702e47f68f921dfad41b1764d05c572329 upstream.

This commit fixes a wrong return value of the number of the allocated
blocks in ext4_split_extent.  When the length of blocks we want to
allocate is greater than the length of the current extent, we return a
wrong number.  Let's see what happens in the following case when we
call ext4_split_extent().

  map: [48, 72]
  ex:  [32, 64, u]

'ex' will be split into two parts:
  ex1: [32, 47, u]
  ex2: [48, 64, w]

'map->m_len' is returned from this function, and the value is 24.  But
the real length is 16.  So it should be fixed.

Meanwhile in this commit we use right length of the allocated blocks
when get_reserved_cluster_alloc in ext4_ext_handle_uninitialized_extents
is called.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/extents.c