From 347219cb249806a47d88f1de118dd3ddf9f5fbdd Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Mon, 26 Feb 2018 15:58:13 +0530 Subject: [PATCH 169/180] 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: I384c1c12c1b39c36524761f45d5fbcc8608d96e3 BUG: 1493085 Signed-off-by: Krutika Dhananjay Reviewed-on: https://code.engineering.redhat.com/gerrit/131735 Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri Tested-by: RHGS Build Bot --- 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 20a0608..7677a14 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -3101,6 +3101,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; @@ -3119,7 +3120,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; @@ -3172,7 +3174,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; @@ -3229,22 +3230,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