From 29c1f529f12ab37985a3138b697e82223958e914 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 2 May 2016 21:40:02 -0700 Subject: [PATCH] Get rid of max dirent collision nr in inode The slightly tweaked format that uses linear probing to mitigate dirent name hash collisions doesn't need a record of the greatest number of collisions in the dir inode. Signed-off-by: Zach Brown --- utils/src/format.h | 18 ++++++++++++------ utils/src/print.c | 3 +-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/utils/src/format.h b/utils/src/format.h index e7bbcb59..5deca747 100644 --- a/utils/src/format.h +++ b/utils/src/format.h @@ -182,7 +182,6 @@ struct scoutfs_inode { __le32 mode; __le32 rdev; __le32 salt; - __u8 max_dirent_hash_nr; struct scoutfs_timespec atime; struct scoutfs_timespec ctime; struct scoutfs_timespec mtime; @@ -201,12 +200,19 @@ struct scoutfs_dirent { } __packed; /* - * The max number of dirent hash values determines the overhead of - * lookups in very large directories. With 31bit offsets the number - * of entries stored before enospc tends to plateau around 200 million - * entries around 8 functions. That seems OK for now. + * Dirent items are stored at keys with the offset set to the hash of + * the name. Creation can find that hash values collide and will + * attempt to linearly probe this many following hash values looking for + * an unused value. + * + * In small directories this doesn't really matter because hash values + * will so very rarely collide. At around 50k items we start to see our + * first collisions. 16 slots is still pretty quick to scan in the + * btree and it gets us up into the hundreds of millions of entries + * before enospc is returned as we run out of hash values. */ -#define SCOUTFS_MAX_DENT_HASH_NR 8 +#define SCOUTFS_DIRENT_COLL_NR 16 + #define SCOUTFS_NAME_LEN 255 /* diff --git a/utils/src/print.c b/utils/src/print.c index 23feb908..7e51370e 100644 --- a/utils/src/print.c +++ b/utils/src/print.c @@ -61,14 +61,13 @@ static void print_inode(struct scoutfs_inode *inode) { printf(" inode: size: %llu blocks: %llu nlink: %u\n" " uid: %u gid: %u mode: 0%o rdev: 0x%x\n" - " salt: 0x%x max_dirent_hash_nr: %u\n" + " salt: 0x%x\n" " atime: %llu.%08u ctime: %llu.%08u\n" " mtime: %llu.%08u\n", le64_to_cpu(inode->size), le64_to_cpu(inode->blocks), le32_to_cpu(inode->nlink), le32_to_cpu(inode->uid), le32_to_cpu(inode->gid), le32_to_cpu(inode->mode), le32_to_cpu(inode->rdev), le32_to_cpu(inode->salt), - inode->max_dirent_hash_nr, le64_to_cpu(inode->atime.sec), le32_to_cpu(inode->atime.nsec), le64_to_cpu(inode->ctime.sec),