summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-10-08 06:21:01 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-09 00:48:19 -0700
commitb9bfc46a9a26c356bd79a453c6daa77692f0a624 (patch)
treea7af291108de0fb67d30c11b99563f1990b71b96
parentf5aa617d7cc4a48bb5e76fc7de763e9c3624e6b4 (diff)
performance/stat-prefetch: change behaviour of sp_lookup when xattr_req is not NULL.
- if the xattr_req is empty (fuse just creates an empty dictionary and sends along lookup) we can still use the cache prefetched during readdir, since we need not fill the reply dictionary. 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.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index 10d0869a5..1056d29e2 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -539,23 +539,43 @@ out:
}
+void
+sp_is_empty (dict_t *this, char *key, data_t *value, void *data)
+{
+ char *ptr = data;
+
+ if (ptr && *ptr) {
+ *ptr = 0;
+ }
+}
+
+
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;
- uint64_t value = 0;
- call_frame_t *wind_frame = NULL;
- char lookup_behind = 0;
+ sp_local_t *local = NULL;
+ int32_t ret = -1, op_ret = -1, op_errno = EINVAL;
+ 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;
if (loc == NULL) {
goto unwind;
}
- if (xattr_req || (loc->parent == NULL) || (loc->name == NULL)) {
+ if ((loc->parent == NULL) || (loc->name == NULL)) {
+ goto wind;
+ }
+
+ if (xattr_req != NULL) {
+ dict_foreach (xattr_req, sp_is_empty, &xattr_req_empty);
+ }
+
+ if (!xattr_req_empty) {
goto wind;
}