diff options
author | Matthew Wilcox <willy@infradead.org> | 2017-11-10 15:15:08 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-10-21 10:45:57 -0400 |
commit | 58d6ea3085f2e53714810a513c61629f6d2be0a6 (patch) | |
tree | b4b73ea07cd720063fd3a2f8b063422c5a0e698a /tools/testing/radix-tree/linux | |
parent | 9b89a0355144685a787b0dc5bcf7bdd6f2d02968 (diff) | |
download | linux-stable-58d6ea3085f2e53714810a513c61629f6d2be0a6.tar.gz linux-stable-58d6ea3085f2e53714810a513c61629f6d2be0a6.tar.bz2 linux-stable-58d6ea3085f2e53714810a513c61629f6d2be0a6.zip |
xarray: Add XArray unconditional store operations
xa_store() differs from radix_tree_insert() in that it will overwrite an
existing element in the array rather than returning an error. This is
the behaviour which most users want, and those that want more complex
behaviour generally want to use the xas family of routines anyway.
For memory allocation, xa_store() will first attempt to request memory
from the slab allocator; if memory is not immediately available, it will
drop the xa_lock and allocate memory, keeping a pointer in the xa_state.
It does not use the per-CPU cache, although those will continue to exist
until all radix tree users are converted to the xarray.
This patch also includes xa_erase() and __xa_erase() for a streamlined
way to store NULL. Since there is no need to allocate memory in order
to store a NULL in the XArray, we do not need to trouble the user with
deciding what memory allocation flags to use.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'tools/testing/radix-tree/linux')
-rw-r--r-- | tools/testing/radix-tree/linux/kernel.h | 4 | ||||
-rw-r--r-- | tools/testing/radix-tree/linux/lockdep.h | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h index 5d06ac75a14d..4568248222ae 100644 --- a/tools/testing/radix-tree/linux/kernel.h +++ b/tools/testing/radix-tree/linux/kernel.h @@ -18,4 +18,8 @@ #define pr_debug printk #define pr_cont printk +#define __acquires(x) +#define __releases(x) +#define __must_hold(x) + #endif /* _KERNEL_H */ diff --git a/tools/testing/radix-tree/linux/lockdep.h b/tools/testing/radix-tree/linux/lockdep.h new file mode 100644 index 000000000000..565fccdfe6e9 --- /dev/null +++ b/tools/testing/radix-tree/linux/lockdep.h @@ -0,0 +1,11 @@ +#ifndef _LINUX_LOCKDEP_H +#define _LINUX_LOCKDEP_H +struct lock_class_key { + unsigned int a; +}; + +static inline void lockdep_set_class(spinlock_t *lock, + struct lock_class_key *key) +{ +} +#endif /* _LINUX_LOCKDEP_H */ |