Re: [PATCH v3 24/33] radix-tree: Add radix_tree_split
From: Randy Dunlap
Date: Mon Nov 28 2016 - 19:02:56 EST
On 11/28/16 13:50, Matthew Wilcox wrote:
> From: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
>
> This new function splits a larger multiorder entry into smaller entries
> (potentially multi-order entries). These entries are initialised to
> RADIX_TREE_RETRY to ensure that RCU walkers who see this state aren't
> confused. The caller should then call radix_tree_for_each_slot() and
> radix_tree_replace_slot() in order to turn these retry entries into the
> intended new entries. Tags are replicated from the original multiorder
> entry into each new entry.
>
> Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
> ---
> include/linux/radix-tree.h | 12 +++
> lib/radix-tree.c | 142 +++++++++++++++++++++++++++++++++-
> tools/testing/radix-tree/multiorder.c | 64 +++++++++++++++
> 3 files changed, 214 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
> index 935293a..1f4b561 100644
> --- a/include/linux/radix-tree.h
> +++ b/include/linux/radix-tree.h
> @@ -293,6 +301,8 @@ void __radix_tree_replace(struct radix_tree_root *root,
> struct radix_tree_node *node,
> void **slot, void *item,
> radix_tree_update_node_t update_node, void *private);
> +void radix_tree_iter_replace(struct radix_tree_root *,
> + const struct radix_tree_iter *, void **slot, void *item);
above
> void radix_tree_replace_slot(struct radix_tree_root *root,
> void **slot, void *item);
> void __radix_tree_delete_node(struct radix_tree_root *root,
> @@ -335,6 +345,8 @@ static inline void radix_tree_preload_end(void)
> preempt_enable();
> }
>
> +int radix_tree_split(struct radix_tree_root *, unsigned long index,
> + unsigned new_order);
and above:
and in patch 25/33: Add radix_tree_split_preload()
As indicated in CodingStyle:
In function prototypes, include parameter names with their data types.
Although this is not required by the C language, it is preferred in Linux
because it is a simple way to add valuable information for the reader.
> int radix_tree_join(struct radix_tree_root *, unsigned long index,
> unsigned new_order, void *);
>
Yes, the source file already omits some function prototype parameter names,
so these patches just follow that tradition. It's weird (to me) though that
the existing code even mixes this style in one function prototype (see
immed. above).
Thanks.
--
~Randy