diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-08-23 22:31:12 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-08 01:41:53 -0700 |
commit | 464f92cac5cd932386bb3b816c207e16c88cfe06 (patch) | |
tree | bff16046d597616be0ee75260e37abb2eb5da48a /xlators/performance | |
parent | e5097a05fb2b95c53c24ab891e54259e6c5f4378 (diff) |
performance/stat-prefetch: implement sp_truncate.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 221 (stat prefetch implementation)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221
Diffstat (limited to 'xlators/performance')
-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 7572ea51bbb..2e8dd39d2ef 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 = { |