diff options
author | Anand Avati <avati@redhat.com> | 2013-10-21 20:29:07 -0700 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-11-07 23:55:59 -0800 |
commit | c80794079a246f4fee730d028350e80c38dbf034 (patch) | |
tree | bd6b954240305e1af27740a9df974c759a241f0a /api | |
parent | 11e28d3aedabac01b5cfc219745681426b5cf416 (diff) |
gfapi: remove unnecessary call to glfs_resolve_base()
Calling glfs_resolve_base() on the root inode for every resolver
invocation is unnecessary and wasteful.
Here are the results from running a test program which performs
path based operations (creates and deletes 1000 files):
Without patch:
[root@blackbox ~]# sync
[root@blackbox ~]# time ./a.out 1
real 0m4.314s
user 0m1.923s
sys 0m1.144s
[root@blackbox ~]# sync
[root@blackbox ~]# time ./a.out 1
real 0m4.383s
user 0m1.940s
sys 0m1.177s
[root@blackbox ~]# sync
[root@blackbox ~]# time ./a.out 1
real 0m4.339s
user 0m1.863s
sys 0m1.129s
With patch:
[root@blackbox ~]# sync
[root@blackbox ~]# time ./a.out 1
real 0m3.005s
user 0m1.162s
sys 0m0.816s
[root@blackbox ~]# sync
[root@blackbox ~]# time ./a.out 1
real 0m3.188s
user 0m1.222s
sys 0m0.867s
[root@blackbox ~]# sync
[root@blackbox ~]# time ./a.out 1
real 0m2.999s
user 0m1.131s
sys 0m0.832s
Change-Id: Id160a24f44b4dccfcfce99a6f69ddb8938523cd5
BUG: 953694
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6131
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-resolve.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c index 20fda3eff64..4ca2eb6fcf4 100644 --- a/api/src/glfs-resolve.c +++ b/api/src/glfs-resolve.c @@ -341,7 +341,8 @@ glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at, } else { inode = inode_ref (subvol->itable->root); - glfs_resolve_base (fs, subvol, inode, &ciatt); + if (strcmp (path, "/") == 0) + glfs_resolve_base (fs, subvol, inode, &ciatt); } for (component = strtok_r (path, "/", &saveptr); |