From 741a9ae652728e75a485ca2a8d446a30903bff34 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sun, 30 Jul 2023 17:21:29 -0500 Subject: [PATCH] Updated calculation of maximum number of dids I completely forgot we terminate the inner nodes of the rbyd after compaction with null tags. This means 3 extra tags per tag after compaction, not 2. This doesn't actually change the nearest-power-of-two for lfsr_mkdir, but it does improve the bound for maximum rids, which I have some plans for. --- lfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lfs.c b/lfs.c index 4fe465be..4730a3f6 100644 --- a/lfs.c +++ b/lfs.c @@ -7285,11 +7285,11 @@ int lfsr_mkdir(lfs_t *lfs, const char *path) { // directories in the current mtree assuming our block size. // // - Each directory needs 1 name tag, 1 did tag, and 1 dstart - // - Each tag needs ~2 alts with our current compaction strategy + // - Each tag needs ~2 alts+null with our current compaction strategy // - Each tag/alt encodes to a minimum of 4 bytes // - We can also assume ~1/2 block utilization due to our split threshold // - // This gives us ~3*3*4*2 or ~72 bytes per directory at minimum. + // This gives us ~3*4*4*2 or ~96 bytes per directory at minimum. // Multiplying by 2 and rounding down to the nearest power of 2 for cheaper // division gives us a heuristic of ~block_size/32 directories per mdir. //