]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Clean up sheaf slub-percpu-sheaves-v3
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 17 Dec 2024 20:18:17 +0000 (15:18 -0500)
committerLiam R. Howlett <howlett@gmail.com>
Tue, 21 Jan 2025 16:33:31 +0000 (11:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 9d74b78683f00e4ab808ac412d08efa9f963ad80..fa3bf8da8cb9381eabc4bd062cddfae4e0fb57c8 100644 (file)
@@ -198,6 +198,21 @@ static void mt_free_rcu(struct rcu_head *head)
        kmem_cache_free(maple_node_cache, node);
 }
 
+static void mt_return_sheaf(struct slab_sheaf *sheaf)
+{
+       kmem_cache_return_sheaf(maple_node_cache, GFP_KERNEL, sheaf);
+}
+
+static struct slab_sheaf *mt_get_sheaf(gfp_t gfp, int count)
+{
+       return kmem_cache_prefill_sheaf(maple_node_cache, gfp, count);
+}
+
+static int mt_refill_sheaf(gfp_t gfp, struct slab_sheaf *sheaf)
+{
+       return kmem_cache_refill_sheaf(maple_node_cache, gfp, sheaf);
+}
+
 /*
  * ma_free_rcu() - Use rcu callback to free a maple node
  * @node: The node to free
@@ -1148,16 +1163,14 @@ use_sheaf:
                        return;
                }
 
-               if (kmem_cache_refill_sheaf(maple_node_cache, gfp, mas->sheaf))
+               if (mt_refill_sheaf(gfp, mas->sheaf))
                        goto error;
 
                mas->node_request = 0;
                return;
        }
 
-       mas->sheaf = kmem_cache_prefill_sheaf(maple_node_cache, gfp,
-                                             mas->node_request);
-
+       mas->sheaf = mt_get_sheaf(gfp, mas->node_request);
        if (likely(mas->sheaf)) {
                mas->node_request = 0;
                return;
@@ -1171,8 +1184,7 @@ static inline void mas_empty_nodes(struct ma_state *mas)
 {
        mas->node_request = 0;
        if (mas->sheaf) {
-               kmem_cache_return_sheaf(maple_node_cache, GFP_KERNEL,
-                                       mas->sheaf);
+               mt_return_sheaf(mas->sheaf);
                mas->sheaf = NULL;
        }