7c2869
From 0509f14090296344aeac15f27685900cf8277de0 Mon Sep 17 00:00:00 2001
7c2869
From: Krutika Dhananjay <kdhananj@redhat.com>
7c2869
Date: Mon, 26 Feb 2018 15:58:13 +0530
7c2869
Subject: [PATCH 664/675] features/shard: Leverage block_num info in inode-ctx
7c2869
 in read callback
7c2869
7c2869
... instead of adding this information in fd_ctx in call path and
7c2869
retrieving it again in the callback.
7c2869
7c2869
> Upstream: https://review.gluster.org/19633
7c2869
> BUG: 1468483
7c2869
> Change-Id: Ibbddbbe85baadb7e24aacf5ec8a1250d493d7800
7c2869
7c2869
Change-Id: Ibbddbbe85baadb7e24aacf5ec8a1250d493d7800
7c2869
BUG: 1583462
7c2869
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
7c2869
Reviewed-on: https://code.engineering.redhat.com/gerrit/140380
7c2869
Tested-by: RHGS Build Bot <nigelb@redhat.com>
7c2869
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
7c2869
---
7c2869
 xlators/features/shard/src/shard.c | 21 +++------------------
7c2869
 1 file changed, 3 insertions(+), 18 deletions(-)
7c2869
7c2869
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
7c2869
index 3345883..4351220 100644
7c2869
--- a/xlators/features/shard/src/shard.c
7c2869
+++ b/xlators/features/shard/src/shard.c
7c2869
@@ -3104,6 +3104,7 @@ shard_readv_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
7c2869
         struct iovec       vec           = {0,};
7c2869
         shard_local_t     *local         = NULL;
7c2869
         fd_t              *anon_fd       = cookie;
7c2869
+        shard_inode_ctx_t *ctx           = NULL;
7c2869
 
7c2869
         local = frame->local;
7c2869
 
7c2869
@@ -3122,7 +3123,8 @@ shard_readv_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
7c2869
         if (local->op_ret >= 0)
7c2869
                 local->op_ret += op_ret;
7c2869
 
7c2869
-        fd_ctx_get (anon_fd, this, &block_num);
7c2869
+        shard_inode_ctx_get (anon_fd->inode, this, &ctx;;
7c2869
+        block_num = ctx->block_num;
7c2869
 
7c2869
         if (block_num == local->first_block) {
7c2869
                 address = local->iobuf->ptr;
7c2869
@@ -3175,7 +3177,6 @@ int
7c2869
 shard_readv_do (call_frame_t *frame, xlator_t *this)
7c2869
 {
7c2869
         int                i                    = 0;
7c2869
-        int                ret                  = 0;
7c2869
         int                call_count           = 0;
7c2869
         int                last_block           = 0;
7c2869
         int                cur_block            = 0;
7c2869
@@ -3232,22 +3233,6 @@ shard_readv_do (call_frame_t *frame, xlator_t *this)
7c2869
                         }
7c2869
                 }
7c2869
 
7c2869
-                ret = fd_ctx_set (anon_fd, this, cur_block);
7c2869
-                if (ret) {
7c2869
-                        gf_msg (this->name, GF_LOG_ERROR, 0,
7c2869
-                                SHARD_MSG_FD_CTX_SET_FAILED,
7c2869
-                                "Failed to set fd ctx for block %d,  gfid=%s",
7c2869
-                                cur_block,
7c2869
-                                uuid_utoa (local->inode_list[i]->gfid));
7c2869
-                        local->op_ret = -1;
7c2869
-                        local->op_errno = ENOMEM;
7c2869
-                        wind_failed = _gf_true;
7c2869
-                        shard_readv_do_cbk (frame, (void *) (long) anon_fd,
7c2869
-                                            this, -1, ENOMEM, NULL, 0, NULL,
7c2869
-                                            NULL, NULL);
7c2869
-                        goto next;
7c2869
-                }
7c2869
-
7c2869
                 STACK_WIND_COOKIE (frame, shard_readv_do_cbk, anon_fd,
7c2869
                                    FIRST_CHILD(this),
7c2869
                                    FIRST_CHILD(this)->fops->readv, anon_fd,
7c2869
-- 
7c2869
1.8.3.1
7c2869