]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: load the key from the dir item in readdir into a fake dentry
authorJosef Bacik <josef@redhat.com>
Tue, 28 Jun 2011 20:18:59 +0000 (16:18 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 1 Aug 2011 05:31:42 +0000 (01:31 -0400)
commitb00aa6ca48acf0c96a6b79f0e7a0973c9b7f5ff1
tree7d70626056dd81bbdb194171d89f35cd390a5a78
parent41c6ee639087799bc5216616b015793613b05676
Btrfs: load the key from the dir item in readdir into a fake dentry

In btrfs we have 2 indexes for inodes.  One is for readdir, it's in this nice
sequential order and works out brilliantly for readdir.  However if you use ls,
it usually stat's each file it gets from readdir.  This is where the second
index comes in, which is based on a hash of the name of the file.  So then the
lookup has to lookup this index, and then lookup the inode.  The index lookup is
going to be in random order (since its based on the name hash), which gives us
less than stellar performance.  Since we know the inode location from the
readdir index, I create a dummy dentry and copy the location key into
dentry->d_fsdata.  Then on lookup if we have d_fsdata we use that location to
lookup the inode, avoiding looking up the other directory index.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/btrfs/inode.c