radix-tree: split node->path into offset and height
Neither piece of information we're storing in node->path can be larger than 64, so store each in its own unsigned char instead of shifting and masking to store them both in an unsigned int. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com> Cc: Jan Kara <jack@suse.com> Cc: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
2fcd9005cc
commit
0c7fa0a841
@@ -84,16 +84,13 @@ static inline int radix_tree_is_indirect_ptr(void *ptr)
|
||||
#define RADIX_TREE_MAX_PATH (DIV_ROUND_UP(RADIX_TREE_INDEX_BITS, \
|
||||
RADIX_TREE_MAP_SHIFT))
|
||||
|
||||
/* Height component in node->path */
|
||||
#define RADIX_TREE_HEIGHT_SHIFT (RADIX_TREE_MAX_PATH + 1)
|
||||
#define RADIX_TREE_HEIGHT_MASK ((1UL << RADIX_TREE_HEIGHT_SHIFT) - 1)
|
||||
|
||||
/* Internally used bits of node->count */
|
||||
#define RADIX_TREE_COUNT_SHIFT (RADIX_TREE_MAP_SHIFT + 1)
|
||||
#define RADIX_TREE_COUNT_MASK ((1UL << RADIX_TREE_COUNT_SHIFT) - 1)
|
||||
|
||||
struct radix_tree_node {
|
||||
unsigned int path; /* Offset in parent & height from the bottom */
|
||||
unsigned char height; /* From the bottom */
|
||||
unsigned char offset; /* Slot offset in parent */
|
||||
unsigned int count;
|
||||
union {
|
||||
struct {
|
||||
|
||||
Reference in New Issue
Block a user