diff options
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 7572ea51b..2e8dd39d2 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -1060,6 +1060,30 @@ unwind: int32_t +sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) +{ + 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_stbuf_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->truncate, loc, offset); + 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; @@ -1114,6 +1138,7 @@ struct xlator_fops fops = { .fchmod = sp_fchmod, .chown = sp_chown, .fchown = sp_fchown, + .truncate = sp_truncate, }; struct xlator_mops mops = { |