diff options
author | Joe Thornber <ejt@redhat.com> | 2015-10-21 18:36:49 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-11-09 12:50:25 -0800 |
commit | 36ce17424c89564f46ac535d666a5d4973678c5a (patch) | |
tree | 5d44b40aa518bd269949fb86e450b421990dca1e /drivers/md/dm-stats.c | |
parent | c48938c53e87b9c653c1bdf176d7e5645f0ec80d (diff) | |
download | lwn-36ce17424c89564f46ac535d666a5d4973678c5a.tar.gz lwn-36ce17424c89564f46ac535d666a5d4973678c5a.zip |
dm btree remove: fix a bug when rebalancing nodes after removal
commit 2871c69e025e8bc507651d5a9cf81a8a7da9d24b upstream.
Commit 4c7e309340ff ("dm btree remove: fix bug in redistribute3") wasn't
a complete fix for redistribute3().
The redistribute3 function takes 3 btree nodes and shares out the entries
evenly between them. If the three nodes in total contained
(MAX_ENTRIES * 3) - 1 entries between them then this was erroneously getting
rebalanced as (MAX_ENTRIES - 1) on the left and right, and (MAX_ENTRIES + 1) in
the center.
Fix this issue by being more careful about calculating the target number
of entries for the left and right nodes.
Unit tested in userspace using this program:
https://github.com/jthornber/redistribute3-test/blob/master/redistribute3_t.c
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/dm-stats.c')
0 files changed, 0 insertions, 0 deletions