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 <zab@versity.com>
This commit is contained in:
Zach Brown
2016-05-02 21:40:02 -07:00
parent 67ad29508d
commit 29c1f529f1
2 changed files with 13 additions and 8 deletions

View File

@@ -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
/*

View File

@@ -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),