]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Add 32 bit support
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 24 Feb 2021 20:30:13 +0000 (15:30 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 24 Feb 2021 20:30:13 +0000 (15:30 -0500)
Add the defines for the size of nodes, etc to support 32 bit kernels.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
include/linux/maple_tree.h

index bf6398b015137b1c0d0be2fae4c4bf0ccbac5f8a..54aa8aa1e79c7e11333175f8f1c72d4a5bc14721 100644 (file)
  * 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;