summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-10-07 10:08:17 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-07 23:04:19 -0700
commitc4cba07caf188cae38ae4e3008526ea79e924abb (patch)
treeb3ea92f8f4eaebbba25c439396d6c3b6b4773060 /xlators/performance
parenta4b02e16a315862de378761b5f340ec346bd5e6d (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: 284 (performance actually decreases for 'ls -l' on a directory containing large number of files with stat-prefetch loaded) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=284
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c60
1 files changed, 4 insertions, 56 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index 24061ac78..d74316bdc 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -380,35 +380,6 @@ sp_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
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)
-{
- 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;
@@ -508,13 +479,11 @@ 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)
{
- sp_local_t *local = NULL;
gf_dirent_t dirent;
int32_t ret = -1, op_ret = -1, op_errno = EINVAL;
sp_cache_t *cache = NULL;
struct stat *postparent = NULL, *buf = NULL;
- call_frame_t *wind_frame = NULL;
- char lookup_behind = 0;
+ char entry_cached = 0;
char xattr_req_empty = 1;
if (loc == NULL) {
@@ -541,7 +510,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)) {
cache = sp_get_cache_inode (this, loc->inode, frame->root->pid);
@@ -551,37 +520,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++;