summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2018-09-29 11:45:11 +0800
committerRaghavendra G <rgowdapp@redhat.com>2018-11-06 10:17:20 +0000
commit7be4f21f257f23d8e4f2fd57aefa8736cae4cdbf (patch)
tree6cf06b79af7dc21e433af50a99c2009b068f242a /xlators/performance
parent93e9b4c167f582234e08e2608fc844bdf02fd507 (diff)
md-cache: extends xa_time when previous attributes equals cached attributes
Some operations like read/write only update iatt and ia_time, without any operion request xattrs from glusterfsd, the xa_time is timeout before ia_time always. This patch updates xa_time when update ia_ttime. Change-Id: I77e3984f38c1c4dbebfde9729b8117fbacde9674 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.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index 685745b956a..ed89c18322f 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -468,6 +468,7 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
struct md_cache *mdc = NULL;
uint32_t rollover = 0;
uint64_t gen = 0;
+ gf_boolean_t update_xa_time = _gf_false;
mdc = mdc_inode_prep(this, inode);
if (!mdc) {
@@ -527,11 +528,10 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
* TODO: writev returns with a NULL iatt due to
* performance/write-behind, causing invalidation on writes.
*/
- if (IA_ISREG(inode->ia_type) &&
- ((iatt->ia_mtime != mdc->md_mtime) ||
- (iatt->ia_mtime_nsec != mdc->md_mtime_nsec) ||
- (iatt->ia_ctime != mdc->md_ctime) ||
- (iatt->ia_ctime_nsec != mdc->md_ctime_nsec)))
+ if ((iatt->ia_mtime != mdc->md_mtime) ||
+ (iatt->ia_mtime_nsec != mdc->md_mtime_nsec) ||
+ (iatt->ia_ctime != mdc->md_ctime) ||
+ (iatt->ia_ctime_nsec != mdc->md_ctime_nsec)) {
if (!prebuf || (prebuf->ia_ctime != mdc->md_ctime) ||
(prebuf->ia_ctime_nsec != mdc->md_ctime_nsec) ||
(prebuf->ia_mtime != mdc->md_mtime) ||
@@ -542,8 +542,12 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
" invalidate the inode(%s)",
uuid_utoa(inode->gfid));
- inode_invalidate(inode);
+ if (IA_ISREG(inode->ia_type))
+ inode_invalidate(inode);
+ } else {
+ update_xa_time = _gf_true;
}
+ }
if ((mdc->gen_rollover == rollover) &&
((incident_time > mdc->generation) &&
@@ -551,9 +555,13 @@ mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
mdc_from_iatt(mdc, iatt);
mdc->generation = incident_time;
mdc->valid = _gf_true;
- if (update_time)
+ if (update_time) {
time(&mdc->ia_time);
+ if (mdc->xa_time && update_xa_time)
+ time(&mdc->xa_time);
+ }
+
gf_msg_callingfn(
"md-cache", GF_LOG_TRACE, 0, MD_CACHE_MSG_CACHE_UPDATE,
"Updated iatt(%s)"