diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-10-02 03:08:03 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-06 06:35:22 -0700 |
commit | 2bcd6ffad9d9445b90627a219ccfff9535a22c6a (patch) | |
tree | 2df701e2db7931bc41204abc0b4becb55bb15f4e /xlators/performance/io-threads | |
parent | e1b3fa2194f0ec63b2206e081f7dc352d842ea53 (diff) |
io-threads: Support readdirp fop
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 292 (Separate readdirp functionality from readdir fop)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=292
Diffstat (limited to 'xlators/performance/io-threads')
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index a5cbea73994..aae34aba47f 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -1976,6 +1976,56 @@ out: return 0; } + +int +iot_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) +{ + STACK_UNWIND (frame, op_ret, op_errno, entries); + return 0; +} + + +int +iot_readdirp_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, + size_t size, off_t offset) +{ + STACK_WIND (frame, iot_readdirp_cbk, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->readdirp, fd, size, offset); + return 0; +} + + +int +iot_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, + off_t offset) +{ + call_stub_t *stub = NULL; + int ret = -1; + + stub = fop_readdirp_stub (frame, iot_readdirp_wrapper, fd, size, + offset); + if (!stub) { + gf_log (this->private, GF_LOG_ERROR,"cannot get readdir stub" + "(out of memory)"); + ret = -ENOMEM; + goto out; + } + + ret = iot_schedule_ordered ((iot_conf_t *)this->private, fd->inode, + stub); +out: + if (ret < 0) { + STACK_UNWIND (frame, -1, -ret, NULL); + + if (stub != NULL) { + call_stub_destroy (stub); + } + } + return 0; +} + + int iot_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) @@ -2846,6 +2896,7 @@ struct xlator_fops fops = { .fsetxattr = iot_fsetxattr, /* O */ .removexattr = iot_removexattr, /* U */ .readdir = iot_readdir, /* O */ + .readdirp = iot_readdirp, /* O */ .xattrop = iot_xattrop, /* U */ .fxattrop = iot_fxattrop, /* O */ }; |