From f275020baa9560630ae3297b26a71606f5b80c61 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 12 Apr 2018 12:11:07 -0700 Subject: [PATCH] scoutfs-utils: update btree constants Signed-off-by: Zach Brown --- utils/src/format.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/utils/src/format.h b/utils/src/format.h index 27e467a5..b935d033 100644 --- a/utils/src/format.h +++ b/utils/src/format.h @@ -121,15 +121,9 @@ struct scoutfs_key_be { __u8 _sk_fourth; }__packed; -/* - * Assert that we'll be able to represent all possible keys with 8 64bit - * primary sort values. - */ -#define SCOUTFS_BTREE_GREATEST_KEY_LEN 32 -/* level >0 segments can have a full key and some metadata */ -#define SCOUTFS_BTREE_MAX_KEY_LEN 320 -/* level 0 segments can have two full keys in the value :/ */ -#define SCOUTFS_BTREE_MAX_VAL_LEN 768 +/* chose reasonable max key and value lens that have room for some u64s */ +#define SCOUTFS_BTREE_MAX_KEY_LEN 40 +#define SCOUTFS_BTREE_MAX_VAL_LEN 64 /* * The min number of free bytes we must leave in a parent as we descend @@ -143,6 +137,14 @@ struct scoutfs_key_be { sizeof(struct scoutfs_btree_item) + SCOUTFS_BTREE_MAX_KEY_LEN +\ sizeof(struct scoutfs_btree_ref)) +/* + * When debugging we can tune the splitting and merging thresholds to + * create much larger trees by having blocks with many fewer items. We + * implement this by pretending the blocks are tiny. They're still + * large enough for a handful of items. + */ +#define SCOUTFS_BTREE_TINY_BLOCK_SIZE 512 + /* * A 4EB test image measured a worst case height of 17. This is plenty * generous.