Minor namei.c patch...

Colin Plumb (colin@nyx.net)
Sun, 11 Jan 1998 05:48:57 -0700 (MST)


I think the following code will streamline dentry lookups just a tiny bit
more. On register-starved machines like the x86, reducing the number of
variables needed is always a nice thing, too.

--- linux/fs/namei.c Sun Jan 11 04:19:40 1998
+++ linux/fs/namei.c Sun Jan 11 04:25:41 1998
@@ -365,7 +365,7 @@

/* At this point we know we have a real path component. */
for(;;) {
- int len, err;
+ int err;
unsigned long hash;
struct qstr this;
struct inode *inode;
@@ -386,16 +386,14 @@
break;

this.name = name;
- len = 0;
c = *name;

hash = init_name_hash();
do {
- len++; name++;
hash = partial_name_hash(c, hash);
- c = *name;
+ c = *++name;
} while (c && (c != '/'));
- this.len = len;
+ this.len = name - this->name;
this.hash = end_name_hash(hash);

/* remove trailing slashes? */

There's some other minor housecleaning I could do to the file.
I'm playing with better hash functions, including ones that don't
fit the partial_name_hash(c, hash) mold too well (e.g. that hash
4 bytes at a time). I'd also like to maybe initialize the name
hash to the parent dentry and not do it in d_hash().

The only fs-specific hashing functions that appear to exist (vfat, smbfs
and ncpfs) just want to hash the lowercase form of a string.
Would anyone get too upset if I got rid of the partial_name_hash
macro and provided a function to do that?

-- 
	-Colin