On 2011-05-20, at 2:07 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote: > Josef Bacik <josef@xxxxxxxxxx> writes: > >> 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 > > Funny 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-- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html