]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dst_setup(): Add fast path
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 25 Sep 2025 03:10:09 +0000 (23:10 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 25 Sep 2025 03:10:09 +0000 (23:10 -0400)
If nodes will fit, the just go with it and fix the null terminated nodes in cp_data_write()

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

index 1bf4e7524daf716f10362d4a99abe1a3bae363f6..4fbb38bfa4c044157821ef4790ab235afd2835c4 100644 (file)
@@ -2589,7 +2589,10 @@ void dst_setup(struct maple_copy *cp, struct ma_state *mas, enum maple_type mt)
 
        cp->split = (cp->data - 1) / 2;
        cp->d_count = 2;
-       if (cp->data <= mt_slots[mt] * 2) {
+       if (cp->data < mt_slots[mt] * 2)
+               goto node_setup;
+
+       if (cp->data == mt_slots[mt] * 2) {
                unsigned char off;
                unsigned char s;