xfs
[Top] [All Lists]

Re: [PATCH 3/4] XFS: Return case-insensitive match for dentry cache

To: "Anton Altaparmakov" <aia21@xxxxxxxxx>
Subject: Re: [PATCH 3/4] XFS: Return case-insensitive match for dentry cache
From: "Barry Naujok" <bnaujok@xxxxxxx>
Date: Tue, 20 May 2008 12:24:57 +1000
Cc: "Christoph Hellwig" <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>
In-reply-to: <DCB15FFF-F942-47BD-B8FB-38AADC24B9D6@cam.ac.uk>
Organization: SGI
References: <20080513075749.477238845@chook.melbourne.sgi.com> <20080513080152.911303131@chook.melbourne.sgi.com> <20080513085724.GC21919@infradead.org> <op.ua4wa7t03jf8g2@pc-bnaujok.melbourne.sgi.com> <20080515045700.GA4328@infradead.org> <op.ua6ji4r93jf8g2@pc-bnaujok.melbourne.sgi.com> <DCB15FFF-F942-47BD-B8FB-38AADC24B9D6@cam.ac.uk>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Opera Mail/9.24 (Win32)
On Thu, 15 May 2008 23:43:44 +1000, Anton Altaparmakov <aia21@xxxxxxxxx> wrote:

Hi,

On 15 May 2008, at 06:14, Barry Naujok wrote:
On Thu, 15 May 2008 14:57:00 +1000, Christoph Hellwig <hch@xxxxxxxxxxxxx > wrote:
On Wed, May 14, 2008 at 05:55:45PM +1000, Barry Naujok wrote:
Not quite sure if this is the right test, but I did 1000 creates on
a brand new filesystem with and without ci on my SATA drive, both
sustained almost 600 creates per second.

I believe creates would be the worst case scenario for not adding
negative dentries?

No, negative dentries shouldn't have any effect on that. negative entries help to optimize away lookups. E.g. thing of the PATH variable and say your shell is not in the first directory listed there. Having a negative dentry for it means that you don't have to do a lookup in the first directories everytime someone wants to use the shell.

Ah, that makes more sense. I did a test of a million lookups to a non-existant file in a short-form directory (dual 1.6G opteron):

CI = 4.6s
non-CI = 3.7s

And a directory with 10000 files:

CI = 10.3s
non-CI = 3.9s


Yes, and you can get the performance back if you allow negative dentries to be created. You just have to make sure that every time a directory entry is created in directory X, all negative dentries which are children of directory X are thrown away.

Failure to do so will result in lookups returning ENOENT even though a file now exists that matches case insensitively. This happens because the VFS will find the negative dentry and return ENOENT without calling the file system lookup method thus the file system does not get a chance to discover the new matching directory entry...

Ok, with the following snippet of code, it now takes 2.9s for shortform CI loop and 2.7s with 10000 files. Don't know why it's quicker, but, anyway, no slowdown with CI anymore.


+/** + * d_drop_neg_children - drop negative child dentries + * @parent: parent dentry + * + * Searches the children of the @parent dentry for negative dentries and + * drops them as they are found. + * + * This is primarily useful for case-insensitive filesystems to drop these + * entries when a new entry is created in the parent. The new entry must + * be instantiated before calling this function. + */ + +void d_drop_neg_children(struct dentry *parent) +{ + struct dentry *dentry; + + spin_lock(&dcache_lock); + list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) { + if (!dentry->d_inode) { + spin_lock(&dentry->d_lock); + __d_drop(dentry); + spin_unlock(&dentry->d_lock); + cond_resched_lock(&dcache_lock); + } + } + spin_unlock(&dcache_lock); + +}


<Prev in Thread] Current Thread [Next in Thread>