dm snapshot: improve performance by switching out_of_order_list to rbtree
authorDavid Jeffery <djeffery@redhat.com>
Tue, 7 Aug 2018 20:56:00 +0000 (16:56 -0400)
committerMike Snitzer <snitzer@redhat.com>
Wed, 8 Aug 2018 14:41:49 +0000 (10:41 -0400)
commit3db2776d9fca45305e6c2065905d9a0e7b2c8212
treef88276f29b02ad50a15e72ffcf9c67e395262db0
parent784c9a29e99eb40b842c29ecf1cc3a79e00fb629
dm snapshot: improve performance by switching out_of_order_list to rbtree

copy_complete()'s processing of out_of_order_list can result in
quadratic complexity in the worst case.  As such it was the source of
consuming too much cpu and the source of significant loss in
performance.

Fix this by converting out_of_order_list to an rbtree.  This improved
a dm-snapshot test copy workload from 32 seconds to 4 seconds.

Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Tested-by: Brett Hull <bhull@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-snap.c