summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-10-08 06:21:05 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-09 00:48:30 -0700
commit490edcd9f76726e5cc46bf9e7ddd69e496d32d7b (patch)
treef74812d1078331356d44df15b4c0070009dd21f5
parent5c3bd66db8a911ca4da021d76237970c9eabd66c (diff)
performance/stat-prefetch: remove lookup-behind in sp_lookup.
- lookup-behind should be done on-demand basis, in fops like open instead of in sp_lookup itself. This would reduce network traffic between client and server related to lookup, if the only use of lookup was to fetch stat structure. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 221 (stat prefetch implementation) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c68
1 files changed, 8 insertions, 60 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index dee52e8c6af..883345a2d3b 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -425,35 +425,6 @@ out:
int32_t
-sp_lookup_behind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct stat *buf, dict_t *dict, struct stat *postparent)
-{
- sp_local_t *local = NULL;
- sp_cache_t *cache = NULL;
-
- local = frame->local;
- if (local == NULL) {
- goto out;
- }
-
- if ((op_ret == -1) && (op_errno = ENOENT)) {
- cache = sp_get_cache_inode (this, local->loc.parent,
- frame->root->pid);
-
- if (cache) {
- sp_cache_remove_entry (cache, (char *)local->loc.name,
- 0);
- }
- }
-
-out:
- SP_STACK_DESTROY (frame);
- return 0;
-}
-
-
-int32_t
sp_get_ancestors (char *path, char **parent, char **grand_parent)
{
int32_t ret = -1, i = 0;
@@ -553,15 +524,13 @@ sp_is_empty (dict_t *this, char *key, data_t *value, void *data)
int32_t
sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
{
- gf_dirent_t dirent;
- sp_local_t *local = NULL;
- int32_t ret = -1, op_ret = -1, op_errno = EINVAL;
+ gf_dirent_t dirent;
+ char entry_cached = 0;
+ uint64_t value = 0;
+ char xattr_req_empty = 1;
sp_cache_t *cache = NULL;
struct stat *postparent = NULL, *buf = NULL;
- uint64_t value = 0;
- call_frame_t *wind_frame = NULL;
- char lookup_behind = 0;
- char xattr_req_empty = 1;
+ int32_t ret = -1, op_ret = -1, op_errno = EINVAL;
if (loc == NULL) {
goto unwind;
@@ -590,7 +559,7 @@ sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
buf = &dirent.d_stat;
op_ret = 0;
op_errno = 0;
- lookup_behind = 1;
+ entry_cached = 1;
}
}
} else if (S_ISDIR (loc->inode->st_mode)) {
@@ -601,37 +570,16 @@ sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
buf = &dirent.d_stat;
op_ret = 0;
op_errno = 0;
- lookup_behind = 1;
+ entry_cached = 1;
}
}
}
wind:
- if (lookup_behind) {
+ if (entry_cached) {
if (cache) {
cache->hits++;
}
-
- wind_frame = copy_frame (frame);
- if (wind_frame == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
- goto unwind;
- }
-
- local = CALLOC (1, sizeof (*local));
- if (local == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- STACK_DESTROY (wind_frame->root);
- goto unwind;
- }
-
- loc_copy (&local->loc, loc);
- wind_frame->local = local;
- STACK_WIND (wind_frame, sp_lookup_behind_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->lookup, loc, xattr_req);
} else {
if (cache) {
cache->miss++;