a3470f
From 347219cb249806a47d88f1de118dd3ddf9f5fbdd Mon Sep 17 00:00:00 2001
a3470f
From: Krutika Dhananjay <kdhananj@redhat.com>
a3470f
Date: Mon, 26 Feb 2018 15:58:13 +0530
a3470f
Subject: [PATCH 169/180] features/shard: Leverage block_num info in inode-ctx
a3470f
 in read callback
a3470f
a3470f
... instead of adding this information in fd_ctx in call path and
a3470f
retrieving it again in the callback.
a3470f
a3470f
> Upstream: https://review.gluster.org/19633
a3470f
> BUG: 1468483
a3470f
> Change-Id: Ibbddbbe85baadb7e24aacf5ec8a1250d493d7800
a3470f
a3470f
Change-Id: I384c1c12c1b39c36524761f45d5fbcc8608d96e3
a3470f
BUG: 1493085
a3470f
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/131735
a3470f
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
a3470f
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
---
a3470f
 xlators/features/shard/src/shard.c | 21 +++------------------
a3470f
 1 file changed, 3 insertions(+), 18 deletions(-)
a3470f
a3470f
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
a3470f
index 20a0608..7677a14 100644
a3470f
--- a/xlators/features/shard/src/shard.c
a3470f
+++ b/xlators/features/shard/src/shard.c
a3470f
@@ -3101,6 +3101,7 @@ shard_readv_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
a3470f
         struct iovec       vec           = {0,};
a3470f
         shard_local_t     *local         = NULL;
a3470f
         fd_t              *anon_fd       = cookie;
a3470f
+        shard_inode_ctx_t *ctx           = NULL;
a3470f
 
a3470f
         local = frame->local;
a3470f
 
a3470f
@@ -3119,7 +3120,8 @@ shard_readv_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
a3470f
         if (local->op_ret >= 0)
a3470f
                 local->op_ret += op_ret;
a3470f
 
a3470f
-        fd_ctx_get (anon_fd, this, &block_num);
a3470f
+        shard_inode_ctx_get (anon_fd->inode, this, &ctx;;
a3470f
+        block_num = ctx->block_num;
a3470f
 
a3470f
         if (block_num == local->first_block) {
a3470f
                 address = local->iobuf->ptr;
a3470f
@@ -3172,7 +3174,6 @@ int
a3470f
 shard_readv_do (call_frame_t *frame, xlator_t *this)
a3470f
 {
a3470f
         int                i                    = 0;
a3470f
-        int                ret                  = 0;
a3470f
         int                call_count           = 0;
a3470f
         int                last_block           = 0;
a3470f
         int                cur_block            = 0;
a3470f
@@ -3229,22 +3230,6 @@ shard_readv_do (call_frame_t *frame, xlator_t *this)
a3470f
                         }
a3470f
                 }
a3470f
 
a3470f
-                ret = fd_ctx_set (anon_fd, this, cur_block);
a3470f
-                if (ret) {
a3470f
-                        gf_msg (this->name, GF_LOG_ERROR, 0,
a3470f
-                                SHARD_MSG_FD_CTX_SET_FAILED,
a3470f
-                                "Failed to set fd ctx for block %d,  gfid=%s",
a3470f
-                                cur_block,
a3470f
-                                uuid_utoa (local->inode_list[i]->gfid));
a3470f
-                        local->op_ret = -1;
a3470f
-                        local->op_errno = ENOMEM;
a3470f
-                        wind_failed = _gf_true;
a3470f
-                        shard_readv_do_cbk (frame, (void *) (long) anon_fd,
a3470f
-                                            this, -1, ENOMEM, NULL, 0, NULL,
a3470f
-                                            NULL, NULL);
a3470f
-                        goto next;
a3470f
-                }
a3470f
-
a3470f
                 STACK_WIND_COOKIE (frame, shard_readv_do_cbk, anon_fd,
a3470f
                                    FIRST_CHILD(this),
a3470f
                                    FIRST_CHILD(this)->fops->readv, anon_fd,
a3470f
-- 
a3470f
1.8.3.1
a3470f