Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

maple_tree: pass maple copy node to mas_wmb_replace()

mas_wmb_replace() is called in three places with the same setup, move the
setup into the function itself. The function needs to be relocated as it
calls mtree_range_walk().

Link: https://lkml.kernel.org/r/20260130205935.2559335-29-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Kujau <lists@nerdbynature.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Liam R. Howlett and committed by
Andrew Morton
2969241f b8852ef3

+25 -35
+25 -35
lib/maple_tree.c
··· 1901 1901 } 1902 1902 1903 1903 /* 1904 - * mas_wmb_replace() - Write memory barrier and replace 1905 - * @mas: The maple state 1906 - * @old_enode: The old maple encoded node that is being replaced. 1907 - * @new_height: The new height of the tree as a result of the operation 1908 - * 1909 - * Updates gap as necessary. 1910 - */ 1911 - static inline void mas_wmb_replace(struct ma_state *mas, 1912 - struct maple_enode *old_enode, unsigned char new_height) 1913 - { 1914 - /* Insert the new data in the tree */ 1915 - mas_topiary_replace(mas, old_enode, new_height); 1916 - 1917 - if (mte_is_leaf(mas->node)) 1918 - return; 1919 - 1920 - mas_update_gap(mas); 1921 - } 1922 - 1923 - /* 1924 1904 * node_copy() - Copy from one node to another. 1925 1905 * 1926 1906 * @mas: The maple state ··· 2065 2085 mas_reset(mas); 2066 2086 return NULL; 2067 2087 } 2088 + 2089 + /* 2090 + * mas_wmb_replace() - Write memory barrier and replace 2091 + * @mas: The maple state 2092 + * @cp: The maple copy node 2093 + * 2094 + * Updates gap as necessary. 2095 + */ 2096 + static inline void mas_wmb_replace(struct ma_state *mas, struct maple_copy *cp) 2097 + { 2098 + struct maple_enode *old_enode; 2099 + 2100 + old_enode = mas->node; 2101 + mas->node = mt_slot_locked(mas->tree, cp->slot, 0); 2102 + /* Insert the new data in the tree */ 2103 + mas_topiary_replace(mas, old_enode, cp->height); 2104 + if (!mte_is_leaf(mas->node)) 2105 + mas_update_gap(mas); 2106 + 2107 + mtree_range_walk(mas); 2108 + } 2109 + 2068 2110 2069 2111 /* 2070 2112 * cp_leaf_init() - Initialize a maple_copy node for the leaf level of a ··· 3046 3044 */ 3047 3045 static void mas_wr_spanning_store(struct ma_wr_state *wr_mas) 3048 3046 { 3049 - struct maple_enode *old_enode; 3050 3047 struct maple_copy cp; 3051 3048 struct ma_state *mas; 3052 3049 struct ma_state sib; ··· 3113 3112 cp_data_write(&cp, mas); 3114 3113 } while (spanning_ascend(&cp, mas, wr_mas, &r_wr_mas, &sib)); 3115 3114 3116 - old_enode = mas->node; 3117 - mas->node = mt_slot_locked(mas->tree, cp.slot, 0); 3118 - mas_wmb_replace(mas, old_enode, cp.height); 3119 - mtree_range_walk(mas); 3115 + mas_wmb_replace(mas, &cp); 3120 3116 } 3121 3117 3122 3118 /* ··· 3431 3433 */ 3432 3434 static void mas_wr_split(struct ma_wr_state *wr_mas) 3433 3435 { 3434 - struct maple_enode *old_enode; 3435 3436 struct ma_state parent; 3436 3437 struct ma_state *mas; 3437 3438 struct maple_copy cp; ··· 3451 3454 cp_data_write(&cp, mas); 3452 3455 } while (split_ascend(&cp, wr_mas, &sib, &parent)); 3453 3456 3454 - old_enode = mas->node; 3455 - mas->node = mt_slot_locked(mas->tree, cp.slot, 0); 3456 - mas_wmb_replace(mas, old_enode, cp.height); 3457 - mtree_range_walk(mas); 3457 + mas_wmb_replace(mas, &cp); 3458 3458 } 3459 3459 3460 3460 /* ··· 3464 3470 */ 3465 3471 static void mas_wr_rebalance(struct ma_wr_state *wr_mas) 3466 3472 { 3467 - struct maple_enode *old_enode; 3468 3473 struct ma_state parent; 3469 3474 struct ma_state *mas; 3470 3475 struct maple_copy cp; ··· 3494 3501 cp_data_write(&cp, mas); 3495 3502 } while (rebalance_ascend(&cp, wr_mas, &sib, &parent)); 3496 3503 3497 - old_enode = mas->node; 3498 - mas->node = mt_slot_locked(mas->tree, cp.slot, 0); 3499 - mas_wmb_replace(mas, old_enode, cp.height); 3500 - mtree_range_walk(mas); 3504 + mas_wmb_replace(mas, &cp); 3501 3505 } 3502 3506 3503 3507 /*