diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2009-08-23 22:35:02 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-08 01:42:22 -0700 | 
| commit | 42d7559e8de1ca9c35dee6f731350c01a53932ad (patch) | |
| tree | 92687baa6ce3ed59365adb763d9c01894b27eea9 | |
| parent | 562e2afbc6540d093086d4b41c6acedb48e1b0c5 (diff) | |
performance/stat-prefetch: implement sp_fsync.
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 | 36 | 
1 files changed, 36 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index ed26f616552..a5f8dbff79f 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -1354,6 +1354,41 @@ unwind:  int32_t +sp_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) +{ +        sp_fd_ctx_t *fd_ctx = NULL; +        sp_cache_t  *cache  = NULL; +        uint64_t     value  = 0; +        int32_t      ret    = 0;  +        inode_t     *parent = NULL; +        char        *name   = NULL;  + +        ret = fd_ctx_get (fd, this, &value); +        if (ret == -1) { +                errno = EINVAL; +                goto unwind; +        } + +        fd_ctx = (void *)(long)value; +        name   = fd_ctx->name; +        parent = fd_ctx->parent_inode; + +        cache = sp_get_cache_inode (this, parent, frame->root->pid); +        if (cache) { +                sp_cache_remove_entry (cache, name, 0); +        } + +	STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), +                    FIRST_CHILD(this)->fops->fsync, fd, flags); +        return 0; + +unwind: +        SP_STACK_UNWIND (frame, -1, errno); +        return 0; +} + + +int32_t  sp_forget (xlator_t *this, inode_t *inode)  {          struct stat *buf   = NULL; @@ -1416,6 +1451,7 @@ struct xlator_fops fops = {          .rmdir     = sp_rmdir,          .readv     = sp_readv,          .writev    = sp_writev,  +        .fsync     = sp_fsync,  };  struct xlator_mops mops = {  | 
