diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-08-23 22:30:15 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-08 01:41:29 -0700 |
commit | 385faf46a6878c7a42a1a2cb2c7c68c92cc0cc3b (patch) | |
tree | 2329dfbd216dd8c8fb96a62576797256d2be4b36 /xlators | |
parent | acb388c4c584cbc601bee69b0ca297eb3a9ef296 (diff) |
performance/stat-prefetch: implement sp_mkdir.
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')
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index bcf3ee9c43c..56f0b26df58 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -842,6 +842,44 @@ unwind: int32_t +sp_new_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct stat *buf) +{ + STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + return 0; +} + + +int32_t +sp_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) +{ + int32_t ret = 0; + + GF_VALIDATE_OR_GOTO (this->name, loc, unwind); + GF_VALIDATE_OR_GOTO (this->name, loc->parent, unwind); + GF_VALIDATE_OR_GOTO (this->name, loc->path, unwind); + GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind); + GF_VALIDATE_OR_GOTO (this->name, loc->inode, unwind); + + ret = sp_cache_remove_parent_entry (frame, this, (char *)loc->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->mkdir, loc, mode); + + return 0; + +unwind: + SP_STACK_UNWIND (frame, -1, errno, loc->inode, NULL); + return 0; +} + + +int32_t sp_forget (xlator_t *this, inode_t *inode) { struct stat *buf = NULL; @@ -889,6 +927,7 @@ struct xlator_fops fops = { .open = sp_open, .create = sp_create, .opendir = sp_opendir, + .mkdir = sp_mkdir, }; struct xlator_mops mops = { |