summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2018-09-29 11:02:58 +0800
committerPoornima G <pgurusid@redhat.com>2018-10-23 07:16:56 +0000
commit4634bb05cc82526e5c55e60746ae5d167f28bea0 (patch)
tree927d62bd60e06b27e8402bd33f71778d0c1ec7f3 /xlators/performance
parent3dea105556130abd4da0fd3f8f2c523ac52398d1 (diff)
md-cache: request cached xattrs at stat/fstat
Ganesha always operate file by filehandle, and translates to glusterfs's stat/fstat many time. Change-Id: Idd0dc33c31131331ac948754c8b7f898777c31d3 Updates: bz#1634220 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/md-cache/src/md-cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index fc9d601015b..bbe47fc545b 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -1310,6 +1310,7 @@ mdc_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
}
mdc_inode_iatt_set(this, local->loc.inode, buf, local->incident_time);
+ mdc_inode_xatt_set(this, local->loc.inode, xdata);
out:
MDC_STACK_UNWIND(stat, frame, op_ret, op_errno, buf, xdata);
@@ -1323,6 +1324,7 @@ mdc_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
int ret;
struct iatt stbuf;
mdc_local_t *local = NULL;
+ dict_t *xattr_alloc = NULL;
struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, loc->inode);
@@ -1346,9 +1348,17 @@ mdc_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
return 0;
uncached:
+ if (!xdata)
+ xdata = xattr_alloc = dict_new();
+ if (xdata)
+ mdc_load_reqs(this, xdata);
+
GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
STACK_WIND(frame, mdc_stat_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->stat, loc, xdata);
+
+ if (xattr_alloc)
+ dict_unref(xattr_alloc);
return 0;
}
@@ -1371,6 +1381,7 @@ mdc_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
}
mdc_inode_iatt_set(this, local->fd->inode, buf, local->incident_time);
+ mdc_inode_xatt_set(this, local->fd->inode, xdata);
out:
MDC_STACK_UNWIND(fstat, frame, op_ret, op_errno, buf, xdata);
@@ -1384,6 +1395,7 @@ mdc_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
int ret;
struct iatt stbuf;
mdc_local_t *local = NULL;
+ dict_t *xattr_alloc = NULL;
struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, fd->inode);
@@ -1402,9 +1414,17 @@ mdc_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
return 0;
uncached:
+ if (!xdata)
+ xdata = xattr_alloc = dict_new();
+ if (xdata)
+ mdc_load_reqs(this, xdata);
+
GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
STACK_WIND(frame, mdc_fstat_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fstat, fd, xdata);
+
+ if (xattr_alloc)
+ dict_unref(xattr_alloc);
return 0;
}