summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2018-02-26 15:58:13 +0530
committerKrutika Dhananjay <kdhananj@redhat.com>2018-02-27 01:54:36 +0000
commit8e21ea3e4f66c27fca796b51f77e4a0231211ff4 (patch)
tree53312f56f64d80ee08848b5cc51c6613cf9585de /xlators
parent15afb4cf9f792686e09c0b1ef864c0c02a26ac0d (diff)
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. Change-Id: Ibbddbbe85baadb7e24aacf5ec8a1250d493d7800 BUG: 1468483 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/shard/src/shard.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 930624b3cc8..f5275a3fb58 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,