]> 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>
Wed, 15 Oct 2025 19:12:02 +0000 (15:12 -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 34dbf094b54bdb4874ed05442199e18aea58c7b3..fc852c7c1232c1937718aec293d4ccb92e4da7c5 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 56957ff341f779a3fa8d1ec027afc5587b7cc307..5bf9b2f844a03d03839ad2df316de7581e8328e7 100644 (file)
@@ -99,6 +99,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
@@ -108,6 +109,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)]
 
@@ -116,6 +118,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)]
 
@@ -124,6 +127,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)]
 
@@ -625,6 +629,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: