dm space maps: improve performance with inc/dec on ranges of blocks

When we break sharing on btree nodes we typically need to increment
the reference counts to every value held in the node.  This can
cause a lot of repeated calls to the space maps.  Fix this by changing
the interface to the space map inc/dec methods to take ranges of
adjacent blocks to be operated on.

For installations that are using a lot of snapshots this will reduce
cpu overhead of fundamental operations such as provisioning a new block,
or deleting a snapshot, by as much as 10 times.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
Joe Thornber
2021-04-13 11:03:45 +01:00
committed by Mike Snitzer
parent 5faafc77f7
commit be500ed721
15 changed files with 778 additions and 249 deletions

View File

@@ -51,21 +51,21 @@ struct dm_btree_value_type {
*/
/*
* The btree is making a duplicate of the value, for instance
* The btree is making a duplicate of a run of values, for instance
* because previously-shared btree nodes have now diverged.
* @value argument is the new copy that the copy function may modify.
* (Probably it just wants to increment a reference count
* somewhere.) This method is _not_ called for insertion of a new
* value: It is assumed the ref count is already 1.
*/
void (*inc)(void *context, const void *value);
void (*inc)(void *context, const void *value, unsigned count);
/*
* This value is being deleted. The btree takes care of freeing
* These values are being deleted. The btree takes care of freeing
* the memory pointed to by @value. Often the del function just
* needs to decrement a reference count somewhere.
* needs to decrement a reference counts somewhere.
*/
void (*dec)(void *context, const void *value);
void (*dec)(void *context, const void *value, unsigned count);
/*
* A test for equality between two values. When a value is