]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Add gap support, slot and pivot sizes for maple copy
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Fri, 10 Oct 2025 16:41:05 +0000 (12:41 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Fri, 10 Oct 2025 16:41:05 +0000 (12:41 -0400)
Add plumbing work for using maple copy as a normal node for a source of
copy operations.  This is needed later.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
include/linux/maple_tree.h
lib/maple_tree.c

index 9e3c0529b0a7abc55215b4a099f7e8af871cf977..8f6fd30276b0a5ea7a52fe11002ab550cc9402ba 100644 (file)
@@ -172,6 +172,7 @@ struct maple_copy {
        } src[4];
        /* Simulated node */
        void __rcu *slot[3];
+       unsigned long gap[3];
        unsigned long min;
        union {
                unsigned long pivot[3];
index b294a643e8236e256799c177bce1ccec3b5ca9d4..ba9007263e99199e0cb95bb504fb5f046f392024 100644 (file)
@@ -103,6 +103,7 @@ static const unsigned long mt_max[] = {
        [maple_leaf_64]         = ULONG_MAX,
        [maple_range_64]        = ULONG_MAX,
        [maple_arange_64]       = ULONG_MAX,
+       [maple_copy]            = ULONG_MAX,
 };
 #define mt_node_max(x) mt_max[mte_node_type(x)]
 #endif
@@ -112,6 +113,7 @@ static const unsigned char mt_slots[] = {
        [maple_leaf_64]         = MAPLE_RANGE64_SLOTS,
        [maple_range_64]        = MAPLE_RANGE64_SLOTS,
        [maple_arange_64]       = MAPLE_ARANGE64_SLOTS,
+       [maple_copy]            = 3,
 };
 #define mt_slot_count(x) mt_slots[mte_node_type(x)]
 
@@ -120,6 +122,7 @@ static const unsigned char mt_pivots[] = {
        [maple_leaf_64]         = MAPLE_RANGE64_SLOTS - 1,
        [maple_range_64]        = MAPLE_RANGE64_SLOTS - 1,
        [maple_arange_64]       = MAPLE_ARANGE64_SLOTS - 1,
+       [maple_copy]            = 3,
 };
 #define mt_pivot_count(x) mt_pivots[mte_node_type(x)]
 
@@ -128,6 +131,7 @@ static const unsigned char mt_min_slots[] = {
        [maple_leaf_64]         = (MAPLE_RANGE64_SLOTS / 2) - 2,
        [maple_range_64]        = (MAPLE_RANGE64_SLOTS / 2) - 2,
        [maple_arange_64]       = (MAPLE_ARANGE64_SLOTS / 2) - 1,
+       [maple_copy]            = 1, /* Should never be used */
 };
 #define mt_min_slot_count(x) mt_min_slots[mte_node_type(x)]
 
@@ -691,6 +695,7 @@ static inline unsigned long *ma_gaps(struct maple_node *node,
        case maple_arange_64:
                return node->ma64.gap;
        case maple_copy:
+               return node->cp.gap;
        case maple_range_64:
        case maple_leaf_64:
        case maple_dense: