summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/rdma
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-02-14 15:05:19 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-20 00:46:27 -0800
commitc0b8e886cac4ef0f16d5f93adab02229bb1414cd (patch)
tree03f5bc6550d5f2501d5b968776f4bb0ee8025310 /rpc/rpc-transport/rdma
parent975933a25d14cbac861e809b40c6edd01acaa28d (diff)
iobuf: use 'iobuf_get2()' to get variable sized buffers
added 'TODO' in places where it is missing. Change-Id: Ia802c94e3bb76930f7c88c990f078525be5459f5 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 765264 Reviewed-on: http://review.gluster.com/388 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'rpc/rpc-transport/rdma')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index d3a8e9c8d..04531cda0 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -1992,7 +1992,7 @@ gf_rdma_receive (rpc_transport_t *this, char **hdr_p, size_t *hdrlen_p,
*hdrlen_p = size1;
if (size2) {
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool, size2);
if (!iobuf) {
gf_log (this->name, GF_LOG_ERROR,
"unable to allocate IO buffer for peer %s",
@@ -2716,7 +2716,7 @@ gf_rdma_decode_error_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
ntoh32 (header->rm_body.rm_error.rm_version.gf_rdma_vers_high);
}
- iobuf = iobuf_get (peer->trans->ctx->iobuf_pool);
+ iobuf = iobuf_get2 (peer->trans->ctx->iobuf_pool, bytes_in_post);
if (iobuf == NULL) {
ret = -1;
goto out;
@@ -2822,15 +2822,17 @@ gf_rdma_decode_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
/* skip terminator of reply chunk */
ptr = ptr + sizeof (uint32_t);
if (header->rm_type != GF_RDMA_NOMSG) {
- post->ctx.hdr_iobuf = iobuf_get (peer->trans->ctx->iobuf_pool);
+ header_len = (long)ptr - (long)post->buf;
+ post->ctx.vector[0].iov_len = (bytes_in_post - header_len);
+
+ post->ctx.hdr_iobuf = iobuf_get2 (peer->trans->ctx->iobuf_pool,
+ (bytes_in_post - header_len));
if (post->ctx.hdr_iobuf == NULL) {
ret = -1;
goto out;
}
- header_len = (long)ptr - (long)post->buf;
post->ctx.vector[0].iov_base = iobuf_ptr (post->ctx.hdr_iobuf);
- post->ctx.vector[0].iov_len = bytes_in_post - header_len;
memcpy (post->ctx.vector[0].iov_base, ptr,
post->ctx.vector[0].iov_len);
post->ctx.count = 1;
@@ -2965,16 +2967,7 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post,
post->ctx.gf_rdma_reads = i;
- if (size > peer->trans->ctx->page_size) {
- gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR,
- "total size of rdma-read (%lu) is greater than "
- "page-size (%lu). This is not supported till variable "
- "sized iobufs are implemented", (unsigned long)size,
- (unsigned long)peer->trans->ctx->page_size);
- goto out;
- }
-
- iobuf = iobuf_get (peer->trans->ctx->iobuf_pool);
+ iobuf = iobuf_get2 (peer->trans->ctx->iobuf_pool, size);
if (iobuf == NULL) {
goto out;
}