Re: [PATCH 1/2] fs: add a DCACHE_NEED_LOOKUP flag for d_flags
From: Andreas Dilger <hidden>
Date: 2011-05-20 20:58:25
Also in:
linux-fsdevel
On 2011-05-20, at 2:07 PM, Andi Kleen [off-list ref] wrote:
Josef Bacik [off-list ref] writes:quoted
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 goFunny I remember discussing this optimization a long time ago with Andrea. But the problem is still that it has the potential to pollute the dcache a lot when someone is reading a large directory. Consider the find / case. You don't want that to turn over all of your dcache. So if you do that you need some way to put the dummy dentries on a special LRU list that gets cleaned quickly and is kept small.
Actually, I recall years ago looking into something similar. It should be possible to drop such dentries even under GFP_NOFS because they can't be dirty and don't need any inode operations to free. Putting them at the end of the cache LRU instead of the head would allow them to be dropped quickly under memory pressure. Cheers, Andreas