diff options
author | Amar Tumballi <amar@gluster.com> | 2011-07-08 02:55:40 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-12 05:37:34 -0700 |
commit | 44f57f49309116de175a9c91c84fb7b8999a05ad (patch) | |
tree | e5ccb663d9e1c4b1abebee1d3f42a3422b1529f9 /xlators/cluster/stripe/src | |
parent | fcce7c289a0c27345404ab17e2cce6e8f5ad7fc9 (diff) |
cluster/stripe: quick-read friendly behavior in lookup
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3140 (contents of files are invalid after apply patch 7573)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3140
Diffstat (limited to 'xlators/cluster/stripe/src')
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 899f86337..07c77c9df 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; |