[RFC PATCH] add lookup hint for network file systems

From: ASANO Masahiro
Date: Fri Jun 23 2006 - 08:03:15 EST


Hi,

I'm trying to speeding up mkdir(2) for network file systems.
A typical mkdir(2) calls two inode_operations: lookup and mkdir.
The lookup operation would fail with ENOENT in common case. I think
it is unnecessary because the subsequent mkdir operation can check it.
In case of creat(2), lookup operation is called with the LOOKUP_CREATE
flag, so individual filesystem can omit real lookup. e.g. nfs_lookup().

Here is a sample patch which uses LOOKUP_CREATE and O_EXCL on mkdir,
symlink and mknod. This uses the gadget for creat(2).

And here is the result of a benchmark on NFSv3.
mkdir(2) 10,000 times:
original 50.5 sec
patched 29.0 sec

Signed-off-by: ASANO Masahiro <masano@xxxxxxxxxxxxxx>

---

fs/namei.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

5273ee304b4dc1096432dc3f3aa9183e20afab1d
diff --git a/fs/namei.c b/fs/namei.c
index 184fe4a..209867d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1759,6 +1759,8 @@ struct dentry *lookup_create(struct name
if (nd->last_type != LAST_NORM)
goto fail;
nd->flags &= ~LOOKUP_PARENT;
+ nd->flags |= LOOKUP_CREATE;
+ nd->intent.open.flags = O_EXCL;

/*
* Do the final lookup.
--
1.3.3

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/