diff options
Diffstat (limited to 'lib/assoc_array.c')
-rw-r--r-- | lib/assoc_array.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/assoc_array.c b/lib/assoc_array.c index 155c55d8db5f..fe7953aead82 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c | |||
@@ -39,7 +39,7 @@ begin_node: | |||
39 | /* Descend through a shortcut */ | 39 | /* Descend through a shortcut */ |
40 | shortcut = assoc_array_ptr_to_shortcut(cursor); | 40 | shortcut = assoc_array_ptr_to_shortcut(cursor); |
41 | smp_read_barrier_depends(); | 41 | smp_read_barrier_depends(); |
42 | cursor = ACCESS_ONCE(shortcut->next_node); | 42 | cursor = READ_ONCE(shortcut->next_node); |
43 | } | 43 | } |
44 | 44 | ||
45 | node = assoc_array_ptr_to_node(cursor); | 45 | node = assoc_array_ptr_to_node(cursor); |
@@ -55,7 +55,7 @@ begin_node: | |||
55 | */ | 55 | */ |
56 | has_meta = 0; | 56 | has_meta = 0; |
57 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { | 57 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
58 | ptr = ACCESS_ONCE(node->slots[slot]); | 58 | ptr = READ_ONCE(node->slots[slot]); |
59 | has_meta |= (unsigned long)ptr; | 59 | has_meta |= (unsigned long)ptr; |
60 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { | 60 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { |
61 | /* We need a barrier between the read of the pointer | 61 | /* We need a barrier between the read of the pointer |
@@ -89,7 +89,7 @@ continue_node: | |||
89 | smp_read_barrier_depends(); | 89 | smp_read_barrier_depends(); |
90 | 90 | ||
91 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { | 91 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
92 | ptr = ACCESS_ONCE(node->slots[slot]); | 92 | ptr = READ_ONCE(node->slots[slot]); |
93 | if (assoc_array_ptr_is_meta(ptr)) { | 93 | if (assoc_array_ptr_is_meta(ptr)) { |
94 | cursor = ptr; | 94 | cursor = ptr; |
95 | goto begin_node; | 95 | goto begin_node; |
@@ -98,7 +98,7 @@ continue_node: | |||
98 | 98 | ||
99 | finished_node: | 99 | finished_node: |
100 | /* Move up to the parent (may need to skip back over a shortcut) */ | 100 | /* Move up to the parent (may need to skip back over a shortcut) */ |
101 | parent = ACCESS_ONCE(node->back_pointer); | 101 | parent = READ_ONCE(node->back_pointer); |
102 | slot = node->parent_slot; | 102 | slot = node->parent_slot; |
103 | if (parent == stop) | 103 | if (parent == stop) |
104 | return 0; | 104 | return 0; |
@@ -107,7 +107,7 @@ finished_node: | |||
107 | shortcut = assoc_array_ptr_to_shortcut(parent); | 107 | shortcut = assoc_array_ptr_to_shortcut(parent); |
108 | smp_read_barrier_depends(); | 108 | smp_read_barrier_depends(); |
109 | cursor = parent; | 109 | cursor = parent; |
110 | parent = ACCESS_ONCE(shortcut->back_pointer); | 110 | parent = READ_ONCE(shortcut->back_pointer); |
111 | slot = shortcut->parent_slot; | 111 | slot = shortcut->parent_slot; |
112 | if (parent == stop) | 112 | if (parent == stop) |
113 | return 0; | 113 | return 0; |
@@ -147,7 +147,7 @@ int assoc_array_iterate(const struct assoc_array *array, | |||
147 | void *iterator_data), | 147 | void *iterator_data), |
148 | void *iterator_data) | 148 | void *iterator_data) |
149 | { | 149 | { |
150 | struct assoc_array_ptr *root = ACCESS_ONCE(array->root); | 150 | struct assoc_array_ptr *root = READ_ONCE(array->root); |
151 | 151 | ||
152 | if (!root) | 152 | if (!root) |
153 | return 0; | 153 | return 0; |
@@ -194,7 +194,7 @@ assoc_array_walk(const struct assoc_array *array, | |||
194 | 194 | ||
195 | pr_devel("-->%s()\n", __func__); | 195 | pr_devel("-->%s()\n", __func__); |
196 | 196 | ||
197 | cursor = ACCESS_ONCE(array->root); | 197 | cursor = READ_ONCE(array->root); |
198 | if (!cursor) | 198 | if (!cursor) |
199 | return assoc_array_walk_tree_empty; | 199 | return assoc_array_walk_tree_empty; |
200 | 200 | ||
@@ -220,7 +220,7 @@ consider_node: | |||
220 | 220 | ||
221 | slot = segments >> (level & ASSOC_ARRAY_KEY_CHUNK_MASK); | 221 | slot = segments >> (level & ASSOC_ARRAY_KEY_CHUNK_MASK); |
222 | slot &= ASSOC_ARRAY_FAN_MASK; | 222 | slot &= ASSOC_ARRAY_FAN_MASK; |
223 | ptr = ACCESS_ONCE(node->slots[slot]); | 223 | ptr = READ_ONCE(node->slots[slot]); |
224 | 224 | ||
225 | pr_devel("consider slot %x [ix=%d type=%lu]\n", | 225 | pr_devel("consider slot %x [ix=%d type=%lu]\n", |
226 | slot, level, (unsigned long)ptr & 3); | 226 | slot, level, (unsigned long)ptr & 3); |
@@ -294,7 +294,7 @@ follow_shortcut: | |||
294 | } while (sc_level < shortcut->skip_to_level); | 294 | } while (sc_level < shortcut->skip_to_level); |
295 | 295 | ||
296 | /* The shortcut matches the leaf's index to this point. */ | 296 | /* The shortcut matches the leaf's index to this point. */ |
297 | cursor = ACCESS_ONCE(shortcut->next_node); | 297 | cursor = READ_ONCE(shortcut->next_node); |
298 | if (((level ^ sc_level) & ~ASSOC_ARRAY_KEY_CHUNK_MASK) != 0) { | 298 | if (((level ^ sc_level) & ~ASSOC_ARRAY_KEY_CHUNK_MASK) != 0) { |
299 | level = sc_level; | 299 | level = sc_level; |
300 | goto jumped; | 300 | goto jumped; |
@@ -337,7 +337,7 @@ void *assoc_array_find(const struct assoc_array *array, | |||
337 | * the terminal node. | 337 | * the terminal node. |
338 | */ | 338 | */ |
339 | for (slot = 0; slot < ASSOC_ARRAY_FAN_OUT; slot++) { | 339 | for (slot = 0; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
340 | ptr = ACCESS_ONCE(node->slots[slot]); | 340 | ptr = READ_ONCE(node->slots[slot]); |
341 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { | 341 | if (ptr && assoc_array_ptr_is_leaf(ptr)) { |
342 | /* We need a barrier between the read of the pointer | 342 | /* We need a barrier between the read of the pointer |
343 | * and dereferencing the pointer - but only if we are | 343 | * and dereferencing the pointer - but only if we are |