dm persistent data: fix btree rebalancing after remove
authorJoe Thornber <ejt@redhat.com>
Wed, 28 Mar 2012 17:41:23 +0000 (18:41 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Wed, 28 Mar 2012 17:41:23 +0000 (18:41 +0100)
commitb0988900bae9ecf968a8a8d086a9eec671a9517a
tree9dd34ec6f4563b78ac454f3691757dece46c1926
parent6f94a4c45a6f744383f9f695dde019998db3df55
dm persistent data: fix btree rebalancing after remove

When we remove an entry from a node we sometimes rebalance with it's
two neighbours.  This wasn't being done correctly; in some cases
entries have to move all the way from the right neighbour to the left
neighbour, or vice versa.  This patch pretty much re-writes the
balancing code to fix it.

This code is barely used currently; only when you delete a thin
device, and then only if you have hundreds of them in the same pool.
Once we have discard support, which removes mappings, this will be used
much more heavily.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/persistent-data/dm-btree-remove.c