diff options
-rw-r--r-- | doc/stat-prefetch-design.txt | 6 | ||||
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 35 |
2 files changed, 37 insertions, 4 deletions
diff --git a/doc/stat-prefetch-design.txt b/doc/stat-prefetch-design.txt index 90992cf11c8..8d3896f2633 100644 --- a/doc/stat-prefetch-design.txt +++ b/doc/stat-prefetch-design.txt @@ -129,10 +129,8 @@ fops to be implemented: fds opened on parent inode, since st_atime is changed during this call. * xattrop/fxattrop - These calls modify various times of stat structure, hence appropriate entries - have to be removed from the cache. I am leaving these calls unimplemented in - stat-prefetch for timebeing. Once we have a working translator, these five fops - will be implemented. + Delete the entry corresponding to basename from cache stored in context of fds + opened on parent inode, since these calls modify st_ctime of file. callbacks to be implemented: ======================= diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 025176e7588..41608e4b578 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -1670,6 +1670,40 @@ unwind: int32_t +sp_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict) +{ + SP_STACK_UNWIND (frame, op_ret, op_errno, dict); + return 0; +} + + +int32_t +sp_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, + gf_xattrop_flags_t flags, dict_t *dict) +{ + sp_cache_t *cache = NULL; + + GF_VALIDATE_OR_GOTO (this->name, loc, unwind); + GF_VALIDATE_OR_GOTO (this->name, loc->parent, unwind); + GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind); + + cache = sp_get_cache_inode (this, loc->parent, frame->root->pid); + if (cache) { + sp_cache_remove_entry (cache, (char *)loc->name, 0); + } + + STACK_WIND (frame, sp_xattrop_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->xattrop, loc, flags, dict); + return 0; + +unwind: + SP_STACK_UNWIND (frame, -1, errno, NULL); + return 0; +} + + +int32_t sp_forget (xlator_t *this, inode_t *inode) { struct stat *buf = NULL; @@ -1739,6 +1773,7 @@ struct xlator_fops fops = { .setdents = sp_setdents, .getdents = sp_getdents, .checksum = sp_checksum, + .xattrop = sp_xattrop, }; struct xlator_mops mops = { |