mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-05 03:44:05 +00:00
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:
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user