diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-08-23 22:36:08 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-08 01:42:36 -0700 |
commit | 155e6342d4f72d3be500510277b0808859ae2d2c (patch) | |
tree | af35794aed775786294b57f6fbd0b3e90147986e | |
parent | 9d30a68082659c27a9dac6e4d1a98e2be8bf5bf8 (diff) |
performance/stat-prefetch: implement sp_setdents.
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-- | doc/stat-prefetch-design.txt | 8 | ||||
-rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 46 |
2 files changed, 53 insertions, 1 deletions
diff --git a/doc/stat-prefetch-design.txt b/doc/stat-prefetch-design.txt index 6328875ac87..46bb3699d21 100644 --- a/doc/stat-prefetch-design.txt +++ b/doc/stat-prefetch-design.txt @@ -110,7 +110,13 @@ fops to be implemented: Delete the entry corresponding to basename from cache stored in context of fds opened on parent inode, since setxattr changes st_ctime of file. -* setdents/getdents/checksum/xattrop/fxattrop +* setdents + 1. remove entry corresponding to basename of path on which fd is opened from + cache stored in parent. + 2. for each of the entry in the direntry list, delete from cache stored in + context of fd, the entry corresponding to basename of path being passed. + +* getdents/checksum/xattrop/fxattrop These calls modify various times of stat structure, hence appropriate entries have to be removed from the cache. I am leaving these calls unimplemented in stat-prefetch for timebeing. Once we have a working translator, these five fops diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index b94451aa926..78de50159f0 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -1493,6 +1493,51 @@ unwind: int32_t +sp_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, + dir_entry_t *entries, int32_t count) +{ + 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; + dir_entry_t *trav = 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); + } + + cache = sp_get_cache_fd (this, fd); + if (cache) { + for (trav = entries->next; trav; trav = trav->next) { + sp_cache_remove_entry (cache, trav->name, 0); + } + } + + STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->setdents, fd, flags, entries, + count); + 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; @@ -1559,6 +1604,7 @@ struct xlator_fops fops = { .rename = sp_rename, .setxattr = sp_setxattr, .removexattr = sp_removexattr, + .setdents = sp_setdents, }; struct xlator_mops mops = { |