diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-07-19 03:26:13 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-07-20 14:29:26 -0700 |
commit | a12f332cff050db3aa3905436158cbd339fa6963 (patch) | |
tree | 8d849b9e05eda0691804fe0c8a6577a80b1187ac /libglusterfsclient | |
parent | 1a56bed50190e20999d28b7da8418927ecb8b041 (diff) |
libglusterfsclient: Move DHT root-lookup workaround to init
The workaround for the DHT requirement for a lookup on /
needs to be done only once when the xlator graph is inited.
Doing it on every path's lookup results in a major performance
penalty when using distribute subvolumes upwards of 16, as reported
by Avati.
Ref: bug 152
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 152 (libglusterfsclient: DHT workaround is a major performance bottleneck)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=152
Diffstat (limited to 'libglusterfsclient')
-rw-r--r-- | libglusterfsclient/src/libglusterfsclient-dentry.c | 15 | ||||
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 12 |
2 files changed, 12 insertions, 15 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient-dentry.c b/libglusterfsclient/src/libglusterfsclient-dentry.c index 09820457b69..1c8910159af 100644 --- a/libglusterfsclient/src/libglusterfsclient-dentry.c +++ b/libglusterfsclient/src/libglusterfsclient-dentry.c @@ -343,21 +343,6 @@ libgf_client_path_lookup (loc_t *loc, inode_t *inode = NULL; inode_t *parent = NULL; int32_t op_ret = 0; - loc_t new_loc = {0, }; - - /* workaround for xlators like dht which require lookup to be sent - on / */ - - libgf_client_loc_fill (&new_loc, ctx, 1, 0, "/"); - - op_ret = libgf_client_lookup (ctx, &new_loc, NULL, NULL, NULL); - if (op_ret == -1) { - gf_log ("libglusterfsclient-dentry", - GF_LOG_ERROR, - "lookup of / failed"); - goto out; - } - libgf_client_loc_wipe (&new_loc); pathname = strdup (loc->path); directory = dirname (pathname); diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 0133126cd48..c456eed0719 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -961,6 +961,7 @@ glusterfs_init (glusterfs_init_params_t *init_ctx) int32_t ret = 0; struct rlimit lim; uint32_t xl_count = 0; + loc_t new_loc = {0, }; if (!init_ctx || (!init_ctx->specfile && !init_ctx->specfp)) { errno = EINVAL; @@ -1261,6 +1262,17 @@ glusterfs_init (glusterfs_init_params_t *init_ctx) } pthread_mutex_unlock (&priv->lock); + /* workaround for xlators like dht which require lookup to be sent + * on / */ + libgf_client_loc_fill (&new_loc, ctx, 1, 0, "/"); + ret = libgf_client_lookup (ctx, &new_loc, NULL, NULL, NULL); + if (ret == -1) { + gf_log ("libglusterfsclient", GF_LOG_ERROR, "lookup of /" + " failed"); + return NULL; + } + libgf_client_loc_wipe (&new_loc); + first_init = 0; return ctx; |