• Josef Bacik's avatar
    fs: add a DCACHE_NEED_LOOKUP flag for d_flags · 44396f4b
    Josef Bacik authored
    Btrfs (and I'd venture most other fs's) stores its indexes in nice disk order
    for readdir, but unfortunately in the case of anything that stats the files in
    order that readdir spits back (like oh say ls) that means we still have to do
    the normal lookup of the file, which means looking up our other index and then
    looking up the inode.  What I want is a way to create dummy dentries when we
    find them in readdir so that when ls or anything else subsequently does a
    stat(), we already have the location information in the dentry and can go
    straight to the inode itself.  The lookup stuff just assumes that if it finds a
    dentry it is done, it doesn't perform a lookup.  So add a DCACHE_NEED_LOOKUP
    flag so that the lookup code knows it still needs to run i_op->lookup() on the
    parent to get the inode for the dentry.  I have tested this with btrfs and I
    went from something that looks like this
    
    http://people.redhat.com/jwhiter/ls-noreada.png
    
    To this
    
    http://people.redhat.com/jwhiter/ls-good.png
    
    Thats a savings of 1300 seconds, or 22 minutes.  That is a significant savings.
    Thanks,
    Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    44396f4b
namei.c 82.9 KB