Messages in this thread | | | Date | Tue, 13 Mar 2012 15:05:59 -0400 | From | Phillip Susi <> | Subject | Re: getdents - ext4 vs btrfs performance |
| |
On 3/9/2012 11:48 PM, Ted Ts'o wrote: > I suspect the best optimization for now is probably something like > this: > > 1) Since the vast majority of directories are less than (say) 256k > (this would be a tunable value), for directories which are less than > this threshold size, the entire directory is sucked in after the first > readdir() after an opendir() or rewinddir(). The directory contents > are then sorted by inode number (or loaded into an rbtree ordered by > inode number), and returned back to userspace in the inode order via > readdir(). The directory contents will be released on a closedir() or > rewinddir().
Why not just separate the hash table from the conventional, mostly in inode order directory entries? For instance, the first 200k of the directory could be the normal entries that would tend to be in inode order ( and e2fsck -D would reorder ), and the last 56k of the directory would contain the hash table. Then readdir() just walks the directory like normal, and namei() can check the hash table.
| |