From 4acbecec9a605ba4f1ba360923d7903465183e1a Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 13 Dec 2010 23:02:34 +0000 Subject: performance/io-threads: implement rchecksum fop. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 2220 (Implement rchecksum fop) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2220 --- xlators/performance/io-threads/src/io-threads.c | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'xlators/performance') diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index e99012cc0..8c15a96a5 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -1989,6 +1989,57 @@ out: } +int32_t +iot_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, + uint8_t *strong_checksum) +{ + STACK_UNWIND_STRICT (rchecksum, frame, op_ret, op_errno, weak_checksum, + strong_checksum); + return 0; +} + + +int32_t +iot_rchecksum_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, + off_t offset, int32_t len) +{ + STACK_WIND (frame, iot_rchecksum_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->rchecksum, fd, offset, len); + return 0; +} + + +int32_t +iot_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, + int32_t len) +{ + call_stub_t *stub = NULL; + int ret = -1; + + stub = fop_rchecksum_stub (frame, iot_rchecksum_wrapper, fd, offset, + len); + if (!stub) { + gf_log (this->name, GF_LOG_ERROR, "cannot create rchecksum 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_STRICT (rchecksum, frame, -1, -ret, -1, NULL); + if (stub != NULL) { + call_stub_destroy (stub); + } + } + + 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) @@ -2911,6 +2962,7 @@ struct xlator_fops fops = { .readdirp = iot_readdirp, /* O */ .xattrop = iot_xattrop, /* U */ .fxattrop = iot_fxattrop, /* O */ + .rchecksum = iot_rchecksum, /* O */ }; struct xlator_mops mops = { -- cgit