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