From 44f57f49309116de175a9c91c84fb7b8999a05ad Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 8 Jul 2011 02:55:40 +0000 Subject: cluster/stripe: quick-read friendly behavior in lookup Signed-off-by: Amar Tumballi Signed-off-by: Anand Avati BUG: 3140 (contents of files are invalid after apply patch 7573) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3140 --- xlators/cluster/stripe/src/stripe.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'xlators/cluster/stripe') diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 899f8633744..07c77c9dfc7 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -267,7 +267,8 @@ stripe_aggregate (dict_t *this, char *key, data_t *value, void *data) } *size = hton64 (ntoh64 (*size) + ntoh64 (*ptr)); - } else { + } else if (strcmp (key, GF_CONTENT_KEY)) { + /* No need to aggregate 'CONTENT' data */ ret = dict_set (dst, key, value); if (ret) gf_log ("stripe", GF_LOG_WARNING, "xattr dict set failed"); @@ -334,12 +335,20 @@ stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->stbuf = *buf; local->postparent = *postparent; local->inode = inode_ref (inode); - } - - if (local->dict == NULL) { local->dict = dict_ref (dict); - } else { + if (local->xattr) { + stripe_aggregate_xattr (local->dict, + local->xattr); + dict_unref (local->xattr); + local->xattr = NULL; + } + } + if (!local->dict && !local->xattr) { + local->xattr = dict_ref (dict); + } else if (local->dict) { stripe_aggregate_xattr (local->dict, dict); + } else if (local->xattr) { + stripe_aggregate_xattr (local->xattr, dict); } local->stbuf_blocks += buf->ia_blocks; @@ -394,6 +403,8 @@ stripe_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, xlator_list_t *trav = NULL; stripe_private_t *priv = NULL; int32_t op_errno = EINVAL; + int64_t filesize = 0; + int ret = 0; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -415,6 +426,12 @@ stripe_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, frame->local = local; loc_copy (&local->loc, loc); + if (xattr_req && dict_get (xattr_req, GF_CONTENT_KEY)) { + ret = dict_get_int64 (xattr_req, GF_CONTENT_KEY, &filesize); + if (!ret && (filesize > priv->block_size)) + dict_del (xattr_req, GF_CONTENT_KEY); + } + /* Everytime in stripe lookup, all child nodes should be looked up */ local->call_count = priv->child_count; -- cgit