From 2bcd6ffad9d9445b90627a219ccfff9535a22c6a Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Fri, 2 Oct 2009 03:08:03 +0000 Subject: io-threads: Support readdirp fop Signed-off-by: Anand V. Avati BUG: 292 (Separate readdirp functionality from readdir fop) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=292 --- xlators/performance/io-threads/src/io-threads.c | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'xlators/performance/io-threads/src') 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 */ }; -- cgit