summaryrefslogtreecommitdiffstats
path: root/xlators/performance/stat-prefetch/src/stat-prefetch.c
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-23 22:35:36 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-08 01:42:25 -0700
commit52c34af5f4814b0b85efdc3c4d23638b6ca5514c (patch)
tree8883dbd34a1fde4d50fee9d88c1165af96614ca3 /xlators/performance/stat-prefetch/src/stat-prefetch.c
parent42d7559e8de1ca9c35dee6f731350c01a53932ad (diff)
performance/stat-prefetch: implement sp_rename.
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/stat-prefetch/src/stat-prefetch.c')
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index a5f8dbff79f..c364fa77c56 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -1389,6 +1389,60 @@ unwind:
int32_t
+sp_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,loc_t *newloc)
+{
+ sp_cache_t *cache = NULL;
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO (this->name, oldloc, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, oldloc->path, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, oldloc->name, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, oldloc->parent, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, oldloc->inode, unwind);
+
+ GF_VALIDATE_OR_GOTO (this->name, newloc, 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->parent, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, newloc->inode, unwind);
+
+ cache = sp_get_cache_inode (this, oldloc->parent, frame->root->pid);
+ if (cache) {
+ sp_cache_remove_entry (cache, (char *)oldloc->name, 0);
+ }
+
+ cache = sp_get_cache_inode (this, newloc->parent, frame->root->pid);
+ if (cache) {
+ sp_cache_remove_entry (cache, (char *)newloc->name, 0);
+ }
+
+ ret = sp_cache_remove_parent_entry (frame, this, (char *)oldloc->path);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR, "out of memory");
+ goto 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;
+ }
+
+ if (S_ISDIR (oldloc->inode->st_mode)) {
+ sp_remove_caches_from_all_fds_opened (this, oldloc->inode);
+ }
+
+ STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->rename, oldloc, newloc);
+ 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;
@@ -1452,6 +1506,7 @@ struct xlator_fops fops = {
.readv = sp_readv,
.writev = sp_writev,
.fsync = sp_fsync,
+ .rename = sp_rename,
};
struct xlator_mops mops = {