-void nvmap_carveout_commit_add(struct nvmap_client *client,
- struct nvmap_carveout_node *node,
- size_t len)
-{
- spin_lock(&node->clients_lock);
- BUG_ON(list_empty(&client->carveout_commit[node->index].list) &&
- client->carveout_commit[node->index].commit != 0);
-
- client->carveout_commit[node->index].commit += len;
- /* if this client isn't already on the list of nodes for this heap,
- add it */
- if (list_empty(&client->carveout_commit[node->index].list)) {
- list_add(&client->carveout_commit[node->index].list,
- &node->clients);
- }
- spin_unlock(&node->clients_lock);
-}
-
-void nvmap_carveout_commit_subtract(struct nvmap_client *client,
- struct nvmap_carveout_node *node,
- size_t len)
-{
- if (!client)
- return;
-
- spin_lock(&node->clients_lock);
- BUG_ON(client->carveout_commit[node->index].commit < len);
- client->carveout_commit[node->index].commit -= len;
- /* if no more allocation in this carveout for this node, delete it */
- if (!client->carveout_commit[node->index].commit)
- list_del_init(&client->carveout_commit[node->index].list);
- spin_unlock(&node->clients_lock);
-}
-