Btrfs: fix wrong free space information
authorMiao Xie <miaox@cn.fujitsu.com>
Fri, 5 Aug 2011 09:32:35 +0000 (09:32 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 17 Aug 2011 01:09:31 +0000 (21:09 -0400)
commitbb3ac5a4dfc8eeb881206c77d9f925e320d9c41a
treeae5cb912cdc3a36a0aa7d43a554658821e0a6161
parentf4ac904c411b55e58bb240f332f93db2455f0010
Btrfs: fix wrong free space information

Btrfs subtracted the size of the allocated space twice when it allocated
the space from the bitmap in the cluster, it broke the free space information
and led to oops finally.

And this patch also fixes the bug that ctl->free_space was subtracted
without lock.

Reported-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/free-space-cache.c