From: Liam R. Howlett Date: Wed, 24 Feb 2021 20:30:13 +0000 (-0500) Subject: maple_tree: Add 32 bit support X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=49386efb53f7f953590ca278eb6fc8c12feaaedb;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index bf6398b01513..54aa8aa1e79c 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;