summaryrefslogtreecommitdiffstats
path: root/xlators/performance/quick-read/src/quick-read.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/performance/quick-read/src/quick-read.c')
-rw-r--r--xlators/performance/quick-read/src/quick-read.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 34e27138..1a0f8675 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -372,9 +372,13 @@ gf_boolean_t
__qr_cache_is_fresh (xlator_t *this, qr_inode_t *qr_inode)
{
qr_conf_t *conf = NULL;
+ qr_private_t *priv = NULL;
struct timeval now;
struct timeval diff;
+ priv = this->private;
+ conf = &priv->conf;
+
gettimeofday (&now, NULL);
timersub (&now, &qr_inode->last_refresh, &diff);
@@ -444,6 +448,7 @@ qr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
qr_conf_t *conf = NULL;
qr_inode_t *qr_inode = NULL;
int ret = -1;
+ dict_t *new_xdata = NULL;
priv = this->private;
conf = &priv->conf;
@@ -454,6 +459,9 @@ qr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
goto wind;
if (!xdata)
+ xdata = new_xdata = dict_new ();
+
+ if (!xdata)
goto wind;
ret = 0;
@@ -470,6 +478,9 @@ wind:
STACK_WIND (frame, qr_lookup_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->lookup, loc, xdata);
+ if (new_xdata)
+ dict_unref (new_xdata);
+
return 0;
}
@@ -598,7 +609,7 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (!qr_inode)
goto wind;
- if (qr_readv_cached (frame, qr_inode, size, offset, flags, xdata) != 0)
+ if (qr_readv_cached (frame, qr_inode, size, offset, flags, xdata) <= 0)
goto wind;
return 0;