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