From 49386efb53f7f953590ca278eb6fc8c12feaaedb Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 24 Feb 2021 15:30:13 -0500 Subject: [PATCH] maple_tree: Add 32 bit support Add the defines for the size of nodes, etc to support 32 bit kernels. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index bf6398b015137..54aa8aa1e79c7 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -26,14 +26,22 @@ * Nodes in the tree point to their parent unless bit 0 is set. */ #if defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) +/* 64bit sizes */ #define MAPLE_NODE_SLOTS 31 /* 256 bytes including ->parent */ #define MAPLE_RANGE64_SLOTS 16 /* 256 bytes */ #define MAPLE_ARANGE64_SLOTS 10 /* 240 bytes */ #define MAPLE_ARANGE64_META_MAX 15 /* Out of range for metadata */ -#define MAPLE_NODE_MASK 255UL +#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 1) #else -/* Need to do corresponding calculations for 32-bit kernels */ -#endif +/* 32bit sizes */ +#define MAPLE_NODE_SLOTS 63 /* 256 bytes including ->parent */ +#define MAPLE_RANGE64_SLOTS 32 /* 256 bytes */ +#define MAPLE_ARANGE64_SLOTS 21 /* 240 bytes */ +#define MAPLE_ARANGE64_META_MAX 22 /* Out of range for metadata */ +#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 2) +#endif /* defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) */ + +#define MAPLE_NODE_MASK 255UL typedef struct maple_enode *maple_enode; // encoded node. typedef struct maple_pnode *maple_pnode; // parent node. @@ -88,7 +96,6 @@ struct maple_arange_64 { unsigned char meta; }; -#define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 1) struct maple_alloc { unsigned long total; unsigned char node_count; -- 2.50.1