From 22ec7a4cb2e05f2c3c4512d80256008caa8b994b Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Sun, 23 Aug 2009 22:31:37 +0000 Subject: performance/stat-prefetch: implement sp_readlink. Signed-off-by: Anand V. Avati BUG: 221 (stat prefetch implementation) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221 --- .../performance/stat-prefetch/src/stat-prefetch.c | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'xlators') diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index cdf6d73dece..dd3f4942de4 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -1143,6 +1143,39 @@ unwind: } +int32_t +sp_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, const char *path) +{ + SP_STACK_UNWIND (frame, op_ret, op_errno, path); + return 0; +} + + +int32_t +sp_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) +{ + 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_readlink_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->readlink, loc, size); + return 0; + +unwind: + SP_STACK_UNWIND (frame, -1, errno, NULL); + return 0; +} + + int32_t sp_forget (xlator_t *this, inode_t *inode) { @@ -1201,6 +1234,7 @@ struct xlator_fops fops = { .truncate = sp_truncate, .ftruncate = sp_ftruncate, .utimens = sp_utimens, + .readlink = sp_readlink, }; struct xlator_mops mops = { -- cgit