summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2018-11-28 14:14:00 +0530
committerSoumya Koduri <skoduri@redhat.com>2019-01-03 15:08:16 +0530
commite33a97ea1aa23222c5f9e5ccbd52d4cb682e9c09 (patch)
treec0808b2e7129de122b3a98749d5b2b2c558d9b86
parentb0bcb4b093984d9f0189061e27ddeefa4b0afe6c (diff)
io-cache: xdata needs to be passed for readv operations
io-cache xlator has been skipping xdata references when the date needs to be read into page cache. This patch fixes the same. Note: similar changes may be needed for other fops as well which are handled by io-cache. Change-Id: I28d73d4ba471d13eb55d0fd0b5197d222df77a2a updates: bz#1655532 Signed-off-by: Soumya Koduri <skoduri@redhat.com> (cherry picked from commit b3d88a0904131f6851f4185e43f815ecc3353ab5)
-rw-r--r--xlators/performance/io-cache/src/io-cache.c7
-rw-r--r--xlators/performance/io-cache/src/page.c20
2 files changed, 21 insertions, 6 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 1614166d973..173985c2dc4 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -412,6 +412,7 @@ ioc_cache_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
* fd_ref on fd, safe to unref validate frame's private copy
*/
fd_unref (local->fd);
+ dict_unref(local->xattr_req);
STACK_DESTROY (frame->root);
@@ -496,11 +497,14 @@ ioc_cache_validate (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
validate_local->fd = fd_ref (fd);
validate_local->inode = ioc_inode;
+ if (local && local->xattr_req)
+ validate_local->xattr_req = dict_ref(local->xattr_req);
validate_frame->local = validate_local;
STACK_WIND (validate_frame, ioc_cache_validate_cbk,
FIRST_CHILD (frame->this),
- FIRST_CHILD (frame->this)->fops->fstat, fd, NULL);
+ FIRST_CHILD (frame->this)->fops->fstat, fd,
+ validate_local->xattr_req);
out:
return ret;
@@ -1175,6 +1179,7 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
local->offset = offset;
local->size = size;
local->inode = ioc_inode;
+ local->xattr_req = dict_ref(xdata);
gf_msg_trace (this->name, 0,
"NEW REQ (%p) offset "
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index 50f5e190e21..ae208766813 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -558,6 +558,9 @@ unlock:
fd_unref (local->fd);
+ if (local->xattr_req)
+ dict_unref(local->xattr_req);
+
STACK_DESTROY (frame->root);
return 0;
}
@@ -582,6 +585,7 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
int32_t op_ret = -1, op_errno = -1;
ioc_waitq_t *waitq = NULL;
ioc_page_t *page = NULL;
+ ioc_local_t *local = NULL;
GF_ASSERT (ioc_inode);
if (frame == NULL) {
@@ -601,6 +605,7 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
goto err;
}
+ local = frame->local;
fault_local = mem_get0 (THIS->local_pool);
if (fault_local == NULL) {
op_ret = -1;
@@ -622,13 +627,16 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
fault_local->pending_size = table->page_size;
fault_local->inode = ioc_inode;
+ if (local && local->xattr_req)
+ fault_local->xattr_req = dict_ref(local->xattr_req);
+
gf_msg_trace (frame->this->name, 0,
"stack winding page fault for offset = %"PRId64" with "
"frame %p", offset, fault_frame);
STACK_WIND (fault_frame, ioc_fault_cbk, FIRST_CHILD(fault_frame->this),
FIRST_CHILD(fault_frame->this)->fops->readv, fd,
- table->page_size, offset, 0, NULL);
+ table->page_size, offset, 0, fault_local->xattr_req);
return;
err:
@@ -895,10 +903,12 @@ unwind:
vector = NULL;
}
- pthread_mutex_destroy (&local->local_lock);
- if (local)
- mem_put (local);
-
+ if (local) {
+ if (local->xattr_req)
+ dict_unref(local->xattr_req);
+ pthread_mutex_destroy(&local->local_lock);
+ mem_put(local);
+ }
return;
}