Blob Blame History Raw
From 0509f14090296344aeac15f27685900cf8277de0 Mon Sep 17 00:00:00 2001
From: Krutika Dhananjay <kdhananj@redhat.com>
Date: Mon, 26 Feb 2018 15:58:13 +0530
Subject: [PATCH 664/675] features/shard: Leverage block_num info in inode-ctx
 in read callback

... instead of adding this information in fd_ctx in call path and
retrieving it again in the callback.

> Upstream: https://review.gluster.org/19633
> BUG: 1468483
> Change-Id: Ibbddbbe85baadb7e24aacf5ec8a1250d493d7800

Change-Id: Ibbddbbe85baadb7e24aacf5ec8a1250d493d7800
BUG: 1583462
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/140380
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 xlators/features/shard/src/shard.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 3345883..4351220 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -3104,6 +3104,7 @@ shard_readv_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
         struct iovec       vec           = {0,};
         shard_local_t     *local         = NULL;
         fd_t              *anon_fd       = cookie;
+        shard_inode_ctx_t *ctx           = NULL;
 
         local = frame->local;
 
@@ -3122,7 +3123,8 @@ shard_readv_do_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
         if (local->op_ret >= 0)
                 local->op_ret += op_ret;
 
-        fd_ctx_get (anon_fd, this, &block_num);
+        shard_inode_ctx_get (anon_fd->inode, this, &ctx);
+        block_num = ctx->block_num;
 
         if (block_num == local->first_block) {
                 address = local->iobuf->ptr;
@@ -3175,7 +3177,6 @@ int
 shard_readv_do (call_frame_t *frame, xlator_t *this)
 {
         int                i                    = 0;
-        int                ret                  = 0;
         int                call_count           = 0;
         int                last_block           = 0;
         int                cur_block            = 0;
@@ -3232,22 +3233,6 @@ shard_readv_do (call_frame_t *frame, xlator_t *this)
                         }
                 }
 
-                ret = fd_ctx_set (anon_fd, this, cur_block);
-                if (ret) {
-                        gf_msg (this->name, GF_LOG_ERROR, 0,
-                                SHARD_MSG_FD_CTX_SET_FAILED,
-                                "Failed to set fd ctx for block %d,  gfid=%s",
-                                cur_block,
-                                uuid_utoa (local->inode_list[i]->gfid));
-                        local->op_ret = -1;
-                        local->op_errno = ENOMEM;
-                        wind_failed = _gf_true;
-                        shard_readv_do_cbk (frame, (void *) (long) anon_fd,
-                                            this, -1, ENOMEM, NULL, 0, NULL,
-                                            NULL, NULL);
-                        goto next;
-                }
-
                 STACK_WIND_COOKIE (frame, shard_readv_do_cbk, anon_fd,
                                    FIRST_CHILD(this),
                                    FIRST_CHILD(this)->fops->readv, anon_fd,
-- 
1.8.3.1