mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] add lookup hint for network file systems
@ 2006-06-23 12:04 ASANO Masahiro
  2006-06-24  6:05 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: ASANO Masahiro @ 2006-06-23 12:04 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel; +Cc: Andrew Morton

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@tnes.nec.co.jp>

---

 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] add lookup hint for network file systems
  2006-06-23 12:04 [RFC PATCH] add lookup hint for network file systems ASANO Masahiro
@ 2006-06-24  6:05 ` Andrew Morton
  2006-06-24  7:02   ` ASANO Masahiro
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-06-24  6:05 UTC (permalink / raw)
  To: ASANO Masahiro; +Cc: linux-kernel, linux-fsdevel

On Fri, 23 Jun 2006 21:04:30 +0900 (JST)
ASANO Masahiro <masano@tnes.nec.co.jp> wrote:

> 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@tnes.nec.co.jp>
> 
> ---
> 
>  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.

whoa.  Big patch ;)

I'll save it up for when Trond returns, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] add lookup hint for network file systems
  2006-06-24  6:05 ` Andrew Morton
@ 2006-06-24  7:02   ` ASANO Masahiro
  0 siblings, 0 replies; 3+ messages in thread
From: ASANO Masahiro @ 2006-06-24  7:02 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel

Hi, Andrew.

On Fri, 23 Jun 2006 23:05:03 -0700,
Andrew Morton <akpm@osdl.org> wrote:
> > Here is a sample patch which uses LOOKUP_CREATE and O_EXCL on mkdir,
> > symlink and mknod.  This uses the gadget for creat(2).

> whoa.  Big patch ;)

Thank you for your comment.
We briefly discussed this idea last week at Tokyo.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-24  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-23 12:04 [RFC PATCH] add lookup hint for network file systems ASANO Masahiro
2006-06-24  6:05 ` Andrew Morton
2006-06-24  7:02   ` ASANO Masahiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®