summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient-dentry.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@zresearch.com>2009-03-30 03:57:20 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-03 19:24:35 +0530
commite60d2194840b78034db1ad5c8b385a691ab3ddb6 (patch)
treeb4ee712579d99caa53260c0a43af7f78d4c6f2cc /libglusterfsclient/src/libglusterfsclient-dentry.c
parent8b8448799cc43f20f5812bf5629c8670f76f78d3 (diff)
libglusterfsclient - change implementation of glusterfs_get
- remove redundent lookups happening in glusterfs_get. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient-dentry.c')
-rw-r--r--libglusterfsclient/src/libglusterfsclient-dentry.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient-dentry.c b/libglusterfsclient/src/libglusterfsclient-dentry.c
index f2e1e17ff..8500827fa 100644
--- a/libglusterfsclient/src/libglusterfsclient-dentry.c
+++ b/libglusterfsclient/src/libglusterfsclient-dentry.c
@@ -322,7 +322,8 @@ out:
/* resolves loc->path to loc->parent and loc->inode */
int32_t
libgf_client_path_lookup (loc_t *loc,
- libglusterfs_client_ctx_t *ctx)
+ libglusterfs_client_ctx_t *ctx,
+ char lookup_basename)
{
char *pathname = NULL;
char *directory = NULL;
@@ -345,19 +346,30 @@ libgf_client_path_lookup (loc_t *loc,
}
libgf_client_loc_wipe (&new_loc);
- inode = inode_from_path (ctx->itable, loc->path);
pathname = strdup (loc->path);
directory = dirname (pathname);
parent = inode_from_path (ctx->itable, directory);
-
- if (inode && parent) {
- gf_log ("libglusterfsclient",
- GF_LOG_DEBUG,
- "resolved path(%s) to %"PRId64"/%"PRId64"(%s)",
- loc->path, parent->ino, inode->ino, loc->name);
- loc->inode = inode;
+
+ if (parent != NULL) {
loc->parent = parent;
- goto out;
+
+ if (!lookup_basename) {
+ gf_log ("libglusterfsclient",
+ GF_LOG_DEBUG,
+ "resolved dirname(%s) to %"PRId64,
+ loc->path, parent->ino);
+ goto out;
+ } else {
+ inode = inode_from_path (ctx->itable, loc->path);
+ if (inode != NULL) {
+ gf_log ("libglusterfsclient",
+ GF_LOG_DEBUG,
+ "resolved path(%s) to %"PRId64"/%"PRId64,
+ loc->path, parent->ino, inode->ino);
+ loc->inode = inode;
+ goto out;
+ }
+ }
} else {
gf_log ("libglusterfsclient",
GF_LOG_DEBUG,