diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-08-23 22:30:39 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-08 01:41:39 -0700 |
commit | 724f869021f7d673ed5b0993e39e93687587ee8d (patch) | |
tree | 7e6c60eea54857bc0c22da3377edb21ebf0f3303 | |
parent | 81d858f16cba61dfdf9f4b1348703d2e5358a0ad (diff) |
performance/stat-prefetch: implement sp_link.
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
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 0a78cb51aef..ca4c2efe039 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -938,6 +938,34 @@ unwind: int32_t +sp_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) +{ + int32_t ret = 0; + + GF_VALIDATE_OR_GOTO (this->name, newloc, unwind); + GF_VALIDATE_OR_GOTO (this->name, newloc->parent, unwind); + GF_VALIDATE_OR_GOTO (this->name, newloc->path, unwind); + GF_VALIDATE_OR_GOTO (this->name, newloc->name, unwind); + GF_VALIDATE_OR_GOTO (this->name, newloc->inode, unwind); + + ret = sp_cache_remove_parent_entry (frame, this, (char *)newloc->path); + if (ret == -1) { + gf_log (this->name, GF_LOG_ERROR, "out of memory"); + goto unwind; + } + + STACK_WIND (frame, sp_new_entry_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->link, oldloc, newloc); + + return 0; + +unwind: + SP_STACK_UNWIND (frame, -1, errno, oldloc->inode, NULL); + return 0; +} + + +int32_t sp_forget (xlator_t *this, inode_t *inode) { struct stat *buf = NULL; @@ -988,6 +1016,7 @@ struct xlator_fops fops = { .mkdir = sp_mkdir, .mknod = sp_mknod, .symlink = sp_symlink, + .link = sp_link, }; struct xlator_mops mops = { |