]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: speculative delayed allocation uses rounddown_power_of_2 badly
authorDave Chinner <dchinner@redhat.com>
Thu, 27 Jan 2011 01:14:12 +0000 (12:14 +1100)
committerAlex Elder <aelder@sgi.com>
Fri, 28 Jan 2011 15:05:35 +0000 (09:05 -0600)
commit5dbcf04e4ebdc77285f1381447eef22cb064dea5
tree70e319ec3d804992c1dd11e5123547d0901a40a0
parenta0b44e3086f4b4f351b1c1914cd012f6c9789fd5
xfs: speculative delayed allocation uses rounddown_power_of_2 badly

rounddown_power_of_2() returns an undefined result when passed a
value of zero. The specualtive delayed allocation code is doing this
when the inode is zero length. Hence occasionally the preallocation
is much, much larger than is necessary (e.g. 8GB for a 270 _byte_
file). Ensure we don't even pass a zero value to this function so
the result of preallocation is always the desired size.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
fs/xfs/xfs_iomap.c