summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-23 22:32:00 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-08 01:42:14 -0700
commit4b4b44960f5b6ccf1b0c5a222708654ae1d32a53 (patch)
tree5065d3743f74212f80dde441c050f6c648811d9a /xlators
parent1a2db6ed799d9ce05232422f5d5094da4fd5c35c (diff)
performance/stat-prefetch: implement sp_readv.
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.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index b61769650a1..9b7f73b95b7 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -1271,6 +1271,52 @@ unwind:
int32_t
+sp_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
+ int32_t op_errno, struct iovec *vector, int32_t count,
+ struct stat *stbuf, struct iobref *iobref)
+{
+ SP_STACK_UNWIND (frame, op_ret, op_errno, vector, count, stbuf, iobref);
+ return 0;
+}
+
+
+int32_t
+sp_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset)
+{
+ 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_readv_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->readv, fd, size, offset);
+ return 0;
+
+unwind:
+ SP_STACK_UNWIND (frame, -1, errno, NULL, -1, NULL, NULL);
+ return 0;
+}
+
+
+int32_t
sp_forget (xlator_t *this, inode_t *inode)
{
struct stat *buf = NULL;
@@ -1331,6 +1377,7 @@ struct xlator_fops fops = {
.readlink = sp_readlink,
.unlink = sp_unlink,
.rmdir = sp_rmdir,
+ .readv = sp_readv,
};
struct xlator_mops mops = {