The idea is similar to the separation of <linux/spinlock_types.h> and <linux/spinlock.h>.
The users of radix tree typically embed struct radix_tree_root in their data structures, but those headers do not need to know anything about the other radix tree stuff like radix_tree_node, accessors. Including <linux/radix-tree.h> pulls in lots of bloat while struct radix_tree_root only depends on <linux/types.h> for gfp_t, and <linux/compiler.h> for __rcu. To reduce the header dependency, split struct radix_tree_root out to <linux/radix-tree-root.h>. Signed-off-by: Masahiro Yamada <[email protected]> --- include/linux/radix-tree-root.h | 24 ++++++++++++++++++++++++ include/linux/radix-tree.h | 6 +----- 2 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 include/linux/radix-tree-root.h diff --git a/include/linux/radix-tree-root.h b/include/linux/radix-tree-root.h new file mode 100644 index 0000000..1726df0 --- /dev/null +++ b/include/linux/radix-tree-root.h @@ -0,0 +1,24 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#ifndef _LINUX_RADIX_TREE_ROOT_H +#define _LINUX_RADIX_TREE_ROOT_H + +#include <linux/types.h> +#include <linux/compiler.h> + +struct radix_tree_root { + gfp_t gfp_mask; + struct radix_tree_node __rcu *rnode; +}; + +#endif /* _LINUX_RADIX_TREE_ROOT_H */ diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 6df7fa9..db3fb1d 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -26,6 +26,7 @@ #include <linux/kernel.h> #include <linux/list.h> #include <linux/preempt.h> +#include <linux/radix-tree-root.h> #include <linux/rcupdate.h> #include <linux/spinlock_types.h> #include <linux/types.h> @@ -109,11 +110,6 @@ struct radix_tree_node { #define ROOT_IS_IDR ((__force gfp_t)(1 << __GFP_BITS_SHIFT)) #define ROOT_TAG_SHIFT (__GFP_BITS_SHIFT + 1) -struct radix_tree_root { - gfp_t gfp_mask; - struct radix_tree_node __rcu *rnode; -}; - #define RADIX_TREE_INIT(mask) { \ .gfp_mask = (mask), \ .rnode = NULL, \ -- 2.7.4

