Skip to content

Commit

Permalink
VFS: add lookup hint for network file systems
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
(cherry picked from fab7bf44449b29f9d5572a5dd8adcf7c91d5bf0f commit)
  • Loading branch information
ASANO Masahiro authored and Trond Myklebust committed Aug 24, 2006
1 parent ddeff52 commit a634904
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,8 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir)
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.
Expand Down

0 comments on commit a634904

Please sign in to comment.