summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c25
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c49
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c23
-rw-r--r--rpc/rpc-transport/socket/src/socket.c15
-rw-r--r--xlators/cluster/stripe/src/stripe.c3
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c5
-rw-r--r--xlators/nfs/server/src/mount3.c1
-rw-r--r--xlators/nfs/server/src/nfs3.c2
-rw-r--r--xlators/performance/quick-read/src/quick-read.c3
-rw-r--r--xlators/performance/write-behind/src/write-behind.c1
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c30
11 files changed, 92 insertions, 65 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 631d7fcf7e1..540c72c82d6 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1117,7 +1117,7 @@ ret:
int
-rpc_clnt_fill_request (int prognum, int progver, int procnum, int payload,
+rpc_clnt_fill_request (int prognum, int progver, int procnum,
uint64_t xid, struct auth_glusterfs_parms_v2 *au,
struct rpc_msg *request, char *auth_data)
{
@@ -1197,7 +1197,7 @@ out:
struct iobuf *
rpc_clnt_record_build_record (struct rpc_clnt *clnt, int prognum, int progver,
- int procnum, size_t payload, uint64_t xid,
+ int procnum, size_t hdrsize, uint64_t xid,
struct auth_glusterfs_parms_v2 *au,
struct iovec *recbuf)
{
@@ -1207,16 +1207,19 @@ rpc_clnt_record_build_record (struct rpc_clnt *clnt, int prognum, int progver,
struct iovec recordhdr = {0, };
size_t pagesize = 0;
int ret = -1;
+ size_t xdr_size = 0;
char auth_data[GF_MAX_AUTH_BYTES] = {0, };
if ((!clnt) || (!recbuf) || (!au)) {
goto out;
}
+ xdr_size = xdr_sizeof ((xdrproc_t)xdr_callmsg, &request);
+
/* First, try to get a pointer into the buffer which the RPC
* layer can use.
*/
- request_iob = iobuf_get (clnt->ctx->iobuf_pool);
+ request_iob = iobuf_get2 (clnt->ctx->iobuf_pool, (xdr_size + hdrsize));
if (!request_iob) {
goto out;
}
@@ -1226,7 +1229,7 @@ rpc_clnt_record_build_record (struct rpc_clnt *clnt, int prognum, int progver,
record = iobuf_ptr (request_iob); /* Now we have it. */
/* Fill the rpc structure and XDR it into the buffer got above. */
- ret = rpc_clnt_fill_request (prognum, progver, procnum, payload, xid,
+ ret = rpc_clnt_fill_request (prognum, progver, procnum, xid,
au, &request, auth_data);
if (ret == -1) {
gf_log (clnt->conn.trans->name, GF_LOG_WARNING,
@@ -1235,7 +1238,7 @@ rpc_clnt_record_build_record (struct rpc_clnt *clnt, int prognum, int progver,
}
recordhdr = rpc_clnt_record_build_header (record, pagesize, &request,
- payload);
+ hdrsize);
if (!recordhdr.iov_base) {
gf_log (clnt->conn.trans->name, GF_LOG_ERROR,
@@ -1256,7 +1259,7 @@ out:
struct iobuf *
rpc_clnt_record (struct rpc_clnt *clnt, call_frame_t *call_frame,
- rpc_clnt_prog_t *prog,int procnum, size_t payload_len,
+ rpc_clnt_prog_t *prog, int procnum, size_t hdrlen,
struct iovec *rpchdr, uint64_t callid)
{
struct auth_glusterfs_parms_v2 au = {0, };
@@ -1292,12 +1295,9 @@ rpc_clnt_record (struct rpc_clnt *clnt, call_frame_t *call_frame,
", gid: %d, owner: %s", au.pid, au.uid, au.gid,
lkowner_utoa (&call_frame->root->lk_owner));
- /* Assuming the client program would like to speak to the same version of
- * program on server.
- */
request_iob = rpc_clnt_record_build_record (clnt, prog->prognum,
prog->progver,
- procnum, payload_len,
+ procnum, hdrlen,
callid, &au,
rpchdr);
if (!request_iob) {
@@ -1432,11 +1432,6 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
proglen += iov_length (proghdr, proghdrcount);
}
- if (progpayload) {
- proglen += iov_length (progpayload,
- progpayloadcount);
- }
-
request_iob = rpc_clnt_record (rpc, frame, prog,
procnum, proglen,
&rpchdr, callid);
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index e0fc2918473..ca6a6ca4cdb 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -768,16 +768,28 @@ rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
char *record = NULL;
struct iovec recordhdr = {0, };
size_t pagesize = 0;
+ size_t xdr_size = 0;
int ret = -1;
if ((!rpc) || (!recbuf)) {
goto out;
}
+ /* Fill the rpc structure and XDR it into the buffer got above. */
+ ret = rpcsvc_fill_callback (prognum, progver, procnum, payload, xid,
+ &request);
+ if (ret == -1) {
+ gf_log ("rpcsvc", GF_LOG_WARNING, "cannot build a rpc-request "
+ "xid (%"PRIu64")", xid);
+ goto out;
+ }
+
/* First, try to get a pointer into the buffer which the RPC
* layer can use.
*/
- request_iob = iobuf_get (rpc->ctx->iobuf_pool);
+ xdr_size = xdr_sizeof ((xdrproc_t)xdr_callmsg, &request);
+
+ request_iob = iobuf_get2 (rpc->ctx->iobuf_pool, (xdr_size + payload));
if (!request_iob) {
goto out;
}
@@ -786,15 +798,6 @@ rpcsvc_callback_build_record (rpcsvc_t *rpc, int prognum, int progver,
record = iobuf_ptr (request_iob); /* Now we have it. */
- /* Fill the rpc structure and XDR it into the buffer got above. */
- ret = rpcsvc_fill_callback (prognum, progver, procnum, payload, xid,
- &request);
- if (ret == -1) {
- gf_log ("rpcsvc", GF_LOG_WARNING, "cannot build a rpc-request "
- "xid (%"PRIu64")", xid);
- goto out;
- }
-
recordhdr = rpcsvc_callback_build_header (record, pagesize, &request,
payload);
@@ -938,13 +941,14 @@ out:
*/
struct iobuf *
rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload,
- struct iovec *recbuf)
+ size_t hdrlen, struct iovec *recbuf)
{
struct rpc_msg reply;
struct iobuf *replyiob = NULL;
char *record = NULL;
struct iovec recordhdr = {0, };
size_t pagesize = 0;
+ size_t xdr_size = 0;
rpcsvc_t *svc = NULL;
int ret = -1;
@@ -952,19 +956,25 @@ rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload,
return NULL;
svc = req->svc;
- replyiob = iobuf_get (svc->ctx->iobuf_pool);
- pagesize = iobuf_pagesize (replyiob);
- if (!replyiob) {
- goto err_exit;
- }
-
- record = iobuf_ptr (replyiob); /* Now we have it. */
/* Fill the rpc structure and XDR it into the buffer got above. */
ret = rpcsvc_fill_reply (req, &reply);
if (ret)
goto err_exit;
+ xdr_size = xdr_sizeof ((xdrproc_t)xdr_replymsg, &reply);
+
+ /* Payload would include 'readv' size etc too, where as
+ that comes as another payload iobuf */
+ replyiob = iobuf_get2 (svc->ctx->iobuf_pool, (xdr_size + hdrlen));
+ if (!replyiob) {
+ goto err_exit;
+ }
+
+ pagesize = iobuf_pagesize (replyiob);
+
+ record = iobuf_ptr (replyiob); /* Now we have it. */
+
recordhdr = rpcsvc_record_build_header (record, pagesize, reply,
payload);
if (!recordhdr.iov_base) {
@@ -1019,6 +1029,7 @@ rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec *proghdr,
struct iovec recordhdr = {0, };
rpc_transport_t *trans = NULL;
size_t msglen = 0;
+ size_t hdrlen = 0;
char new_iobref = 0;
if ((!req) || (!req->trans))
@@ -1037,7 +1048,7 @@ rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec *proghdr,
gf_log (GF_RPCSVC, GF_LOG_TRACE, "Tx message: %zu", msglen);
/* Build the buffer containing the encoded RPC reply. */
- replyiob = rpcsvc_record_build_record (req, msglen, &recordhdr);
+ replyiob = rpcsvc_record_build_record (req, msglen, hdrlen, &recordhdr);
if (!replyiob) {
gf_log (GF_RPCSVC, GF_LOG_ERROR,"Reply record creation failed");
goto disconnect_exit;
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index d3a8e9c8d97..04531cda036 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;
}
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 3b2d05c450b..120e193ddf1 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -823,6 +823,7 @@ __socket_read_vectored_request (rpc_transport_t *this, rpcsvc_vector_sizer vecto
struct iobuf *iobuf = NULL;
uint32_t remaining_size = 0;
ssize_t readsize = 0;
+ size_t size = 0;
GF_VALIDATE_OR_GOTO ("socket", this, out);
GF_VALIDATE_OR_GOTO ("socket", this->private, out);
@@ -907,7 +908,10 @@ sp_state_reading_proghdr:
case SP_STATE_READ_PROGHDR:
if (priv->incoming.payload_vector.iov_base == NULL) {
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+
+ size = RPC_FRAGSIZE (priv->incoming.fraghdr) -
+ priv->incoming.frag.bytes_read;
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool, size);
if (!iobuf) {
ret = -1;
break;
@@ -1048,6 +1052,7 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
struct iobuf *iobuf = NULL;
uint32_t gluster_read_rsp_hdr_len = 0;
gfs3_read_rsp read_rsp = {0, };
+ size_t size = 0;
GF_VALIDATE_OR_GOTO ("socket", this, out);
GF_VALIDATE_OR_GOTO ("socket", this->private, out);
@@ -1080,7 +1085,11 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
= SP_STATE_READ_PROC_HEADER;
if (priv->incoming.payload_vector.iov_base == NULL) {
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+
+ size = (RPC_FRAGSIZE (priv->incoming.fraghdr) -
+ priv->incoming.frag.bytes_read);
+
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool, size);
if (iobuf == NULL) {
ret = -1;
goto out;
@@ -1100,6 +1109,8 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
priv->incoming.payload_vector.iov_base
= iobuf_ptr (iobuf);
+
+ priv->incoming.payload_vector.iov_len = size;
}
priv->incoming.frag.fragcurrent
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 5e369d64bcf..ec9b6a744a1 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -3372,7 +3372,8 @@ stripe_readv_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
vec[count].iov_len =
(local->replies[i].requested_size -
local->replies[i].op_ret);
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool,
+ vec[count].iov_len);
if (!iobuf) {
gf_log (this->name, GF_LOG_ERROR,
"Out of memory.");
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 1da2dcdb223..e644290e42d 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3474,7 +3474,12 @@ fuse_thread_proc (void *data)
if (priv->init_recvd)
fuse_graph_sync (this);
+ /* TODO: This place should always get maximum supported buffer
+ size from 'fuse', which is as of today 128KB. If we bring in
+ support for higher block sizes support, then we should be
+ changing this one too */
iobuf = iobuf_get (this->ctx->iobuf_pool);
+
/* Add extra 128 byte to the first iov so that it can
* accommodate "ordinary" non-write requests. It's not
* guaranteed to be big enough, as SETXATTR and namespace
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index 0f14c8d5a03..cebdf527065 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -70,6 +70,7 @@ mnt3svc_submit_reply (rpcsvc_request_t *req, void *arg, mnt3_serializer sfunc)
/* First, get the io buffer into which the reply in arg will
* be serialized.
*/
+ /* TODO: use 'xdrproc_t' instead of 'sfunc' to get the xdr-size */
iob = iobuf_get (ms->iobpool);
if (!iob) {
gf_log (GF_MNT, GF_LOG_ERROR, "Failed to get iobuf");
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 422646bc02b..527101de22b 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -487,6 +487,8 @@ nfs3_serialize_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc,
/* First, get the io buffer into which the reply in arg will
* be serialized.
*/
+ /* TODO: get rid of 'sfunc' and use 'xdrproc_t' so we
+ can have 'xdr_sizeof' */
iob = iobuf_get (nfs3->iobpool);
if (!iob) {
gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to get iobuf");
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 14ff58b5157..c1460b1debf 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -1180,6 +1180,9 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
}
for (i = 0; i < count; i++) {
+ /* TODO: Now that we have support for variable
+ io-buf-sizes, i guess we need to get rid of
+ default size here */
iobuf = iobuf_get (iobuf_pool);
if (iobuf == NULL) {
op_ret = -1;
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 7c666b40339..be7da2f44ce 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1901,6 +1901,7 @@ __wb_copy_into_holder (wb_request_t *holder, wb_request_t *request)
int ret = -1;
if (holder->flags.write_request.virgin) {
+ /* TODO: check the required size */
iobuf = iobuf_get (request->file->this->ctx->iobuf_pool);
if (iobuf == NULL) {
goto out;
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 234b0dd6e03..e3d6d36dba6 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2493,6 +2493,8 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this,
}
/* TODO: what is the size we should send ? */
+ /* This change very much depends on quick-read
+ changes */
rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
if (rsp_iobuf == NULL) {
goto unwind;
@@ -3409,8 +3411,7 @@ client3_1_readv (call_frame_t *frame, xlator_t *this,
memcpy (req.gfid, args->fd->inode->gfid, 16);
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
+ rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size);
if (rsp_iobuf == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -3959,8 +3960,8 @@ client3_1_fgetxattr (call_frame_t *frame, xlator_t *this,
goto unwind;
}
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
if (rsp_iobuf == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -4062,8 +4063,8 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,
goto unwind;
}
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
if (rsp_iobuf == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -4188,8 +4189,8 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this,
goto unwind;
}
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
if (rsp_iobuf == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -4308,8 +4309,8 @@ client3_1_fxattrop (call_frame_t *frame, xlator_t *this,
goto unwind;
}
- /* TODO: what is the size we should send ? */
- rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
+ /* TODO: what is the size we should send ? */
+ rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB);
if (rsp_iobuf == NULL) {
op_errno = ENOMEM;
goto unwind;
@@ -4880,7 +4881,9 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this,
goto unwind;
}
- /* TODO: what is the size we should send ? */
+ /* TODO: what is the size we should send ? */
+ /* This iobuf will live for only receiving the response,
+ so not harmful */
rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
if (rsp_iobuf == NULL) {
goto unwind;
@@ -4890,8 +4893,7 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this,
iobuf_unref (rsp_iobuf);
rsphdr = &vector[0];
rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
- rsphdr->iov_len
- = iobuf_pagesize (rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
count = 1;
rsp_iobuf = NULL;
local->iobref = rsp_iobref;
@@ -4983,6 +4985,8 @@ client3_1_readdirp (call_frame_t *frame, xlator_t *this,
}
/* TODO: what is the size we should send ? */
+ /* This iobuf will live for only receiving the response,
+ so not harmful */
rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
if (rsp_iobuf == NULL) {
goto unwind;
yes" if test "x$enable_fusermount" = "xno"; then BUILD_FUSERMOUNT="no" else AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount]) FUSERMOUNT_SUBDIR="contrib/fuse-util" fi AC_SUBST(FUSERMOUNT_SUBDIR) #end FUSERMOUNT section # QEMU_BLOCK section AC_ARG_ENABLE([qemu-block], AC_HELP_STRING([--enable-qemu-block], [Build QEMU Block formats translator])) if test "x$enable_qemu_block" != "xno"; then PKG_CHECK_MODULES([GLIB], [glib-2.0], [HAVE_GLIB_2="yes"], [HAVE_GLIB_2="no"]) fi if test "x$enable_qemu_block" = "xyes" -a "x$HAVE_GLIB_2" = "xno"; then echo "QEMU Block formats translator requires libglib-2.0, but missing." exit 1 fi BUILD_QEMU_BLOCK=no if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then BUILD_QEMU_BLOCK=yes AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU Block translator enabled]) fi AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes]) # end QEMU_BLOCK section # EPOLL section AC_ARG_ENABLE([epoll], AC_HELP_STRING([--disable-epoll], [Use poll instead of epoll.])) BUILD_EPOLL=no if test "x$enable_epoll" != "xno"; then AC_CHECK_HEADERS([sys/epoll.h], [BUILD_EPOLL=yes], [BUILD_EPOLL=no]) fi # end EPOLL section # IBVERBS section AC_ARG_ENABLE([ibverbs], AC_HELP_STRING([--disable-ibverbs], [Do not build the ibverbs transport])) if test "x$enable_ibverbs" != "xno"; then AC_CHECK_LIB([ibverbs], [ibv_get_device_list], [HAVE_LIBIBVERBS="yes"], [HAVE_LIBIBVERBS="no"]) AC_CHECK_LIB([rdmacm], [rdma_create_id], [HAVE_RDMACM="yes"], [HAVE_RDMACM="no"]) fi if test "x$enable_ibverbs" = "xyes"; then if test "x$HAVE_LIBIBVERBS" = "xno"; then echo "ibverbs-transport requested, but libibverbs is not present." exit 1 fi if test "x$HAVE_RDMACM" = "xno"; then echo "ibverbs-transport requested, but librdmacm is not present." exit 1 fi fi BUILD_RDMA=no BUILD_IBVERBS=no if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then IBVERBS_SUBDIR=ib-verbs BUILD_IBVERBS=yes RDMA_SUBDIR=rdma BUILD_RDMA=yes fi AC_SUBST(IBVERBS_SUBDIR) AC_SUBST(RDMA_SUBDIR) # end IBVERBS section # SYNCDAEMON section AC_ARG_ENABLE([georeplication], AC_HELP_STRING([--disable-georeplication], [Do not install georeplication components])) BUILD_SYNCDAEMON=no case $host_os in linux*) #do nothing ;; netbsd*) #do nothing ;; *) #disabling geo replication for non-linux platforms enable_georeplication=no ;; esac SYNCDAEMON_COMPILE=0 if test "x$enable_georeplication" != "xno"; then SYNCDAEMON_SUBDIR=geo-replication SYNCDAEMON_COMPILE=1 BUILD_SYNCDAEMON="yes" AM_PATH_PYTHON([2.4]) echo -n "checking if python is python 2.x... " if echo $PYTHON_VERSION | grep ^2; then : else echo no AC_MSG_ERROR([only python 2.x is supported]) fi echo -n "checking if python has ctypes support... " if "$PYTHON" -c 'import ctypes' 2>/dev/null; then echo yes else echo no AC_MSG_ERROR([python does not have ctypes support]) fi fi AC_SUBST(SYNCDAEMON_COMPILE) AC_SUBST(SYNCDAEMON_SUBDIR) # end SYNCDAEMON section # CDC xlator - check if libz is present if so enable HAVE_LIB_Z echo -n "checking if libz is present... " PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [echo "yes (features requiring zlib enabled)" AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])], [echo "no"] ) AC_SUBST(LIBZ_CFLAGS) AC_SUBST(LIBZ_LIBS) # end CDC xlator secion # check for systemtap/dtrace BUILD_SYSTEMTAP=no AC_MSG_CHECKING([whether to include systemtap tracing support]) AC_ARG_ENABLE([systemtap], [AS_HELP_STRING([--enable-systemtap], [Enable inclusion of systemtap trace support])], [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"]) AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"]) AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) if test "x${ENABLE_SYSTEMTAP}" != "xno"; then AC_CHECK_PROG(DTRACE, dtrace, "yes", "no") AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"], [SDT_H_FOUND="no"]) fi if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then if test "x${DTRACE}" = "xno"; then AC_MSG_ERROR([dtrace not found]) elif test "$x{SDT_H_FOUND}" = "xno"; then AC_MSG_ERROR([systemtap support needs sys/sdt.h header]) fi fi if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y]) AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.]) BUILD_SYSTEMTAP=yes fi # end of systemtap/dtrace # xml-output AC_ARG_ENABLE([xml-output], AC_HELP_STRING([--disable-xml-output], [Disable the xml output])) BUILD_XML_OUTPUT="yes" if test "x$enable_xml_output" != "xno"; then #check if libxml is present if so enable HAVE_LIB_XML m4_ifdef([AM_PATH_XML2],[AM_PATH_XML2([2.6.19])], [no_xml=yes]) if test "x${no_xml}" = "x"; then AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.]) else AC_MSG_WARN([libxml2 devel libraries not found disabling XML support]) BUILD_XML_OUTPUT="no" fi else BUILD_XML_OUTPUT="no" fi # end of xml-output dnl FreeBSD > 5 has execinfo as a Ported library for giving a workaround dnl solution to GCC backtrace functionality AC_CHECK_HEADERS([execinfo.h], [have_backtrace=yes], AC_CHECK_LIB([execinfo], [backtrace], [have_backtrace=yes])) dnl AC_MSG_ERROR([libexecinfo not found libexecinfo required.]))) if test "x${have_backtrace}" = "xyes"; then AC_DEFINE(HAVE_BACKTRACE, 1, [define if found backtrace]) fi AC_SUBST(HAVE_BACKTRACE) dnl glusterfs prints memory usage to stderr by sending it SIGUSR1 AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes]) if test "x${have_malloc_stats}" = "xyes"; then AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats]) fi AC_SUBST(HAVE_MALLOC_STATS) dnl Linux, Solaris, Cygwin AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec]) dnl FreeBSD, NetBSD AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec]) case $host_os in *netbsd*) CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063 -DCONFIG_MACHINE_BSWAP_H" ;; esac AC_CHECK_FUNC([linkat], [have_linkat=yes]) if test "x${have_linkat}" = "xyes"; then AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat]) fi AC_SUBST(HAVE_LINKAT) dnl check for Monotonic clock AC_CHECK_FUNC([clock_gettime], [has_monotonic_clock=yes], AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_WARN([System doesn't have monotonic clock using contrib]))) dnl Check for argp AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp])) AC_CONFIG_SUBDIRS(argp-standalone) BUILD_ARGP_STANDALONE=no if test "x${ac_cv_header_argp_h}" = "xno"; then BUILD_ARGP_STANDALONE=yes ARGP_STANDALONE_CPPFLAGS='-I${top_srcdir}/argp-standalone' ARGP_STANDALONE_LDADD='${top_builddir}/argp-standalone/libargp.a' ARGP_STANDALONE_DIR='${top_builddir}/argp-standalone' fi AC_SUBST(ARGP_STANDALONE_CPPFLAGS) AC_SUBST(ARGP_STANDALONE_LDADD) AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h])) AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes]) if test "x${have_llistxattr}" = "xyes"; then AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists]) fi AC_CHECK_FUNC([fdatasync], [have_fdatasync=yes]) if test "x${have_fdatasync}" = "xyes"; then AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists]) fi AC_CHECK_FUNC([fallocate], [have_fallocate=yes]) if test "x${have_fallocate}" = "xyes"; then AC_DEFINE(HAVE_FALLOCATE, 1, [define if fallocate exists]) fi AC_CHECK_FUNC([posix_fallocate], [have_posix_fallocate=yes]) if test "x${have_posix_fallocate}" = "xyes"; then AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists]) fi # Check the distribution where you are compiling glusterfs on GF_DISTRIBUTION= AC_CHECK_FILE([/etc/debian_version]) AC_CHECK_FILE([/etc/SuSE-release]) AC_CHECK_FILE([/etc/redhat-release]) if test "x$ac_cv_file__etc_debian_version" = "xyes"; then GF_DISTRIBUTION=Debian fi if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then GF_DISTRIBUTION=SuSE fi if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then GF_DISTRIBUTION=Redhat fi AC_SUBST(GF_DISTRIBUTION) GF_HOST_OS="" GF_LDFLAGS="-rdynamic" # check for gcc -Werror=format-security saved_CFLAGS=$CFLAGS CFLAGS="-Wformat -Werror=format-security" AC_MSG_CHECKING([whether $CC accepts -Werror=format-security]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no]) echo $cc_werror_format_security if test "x$cc_werror_format_security" = "xno"; then CFLAGS="$saved_CFLAGS" else CFLAGS="$saved_CFLAGS $CFLAGS" fi # check for gcc -Werror=implicit-function-declaration saved_CFLAGS=$CFLAGS CFLAGS="-Werror=implicit-function-declaration" AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no]) echo $cc_werror_implicit if test "x$cc_werror_implicit" = "xno"; then CFLAGS="$saved_CFLAGS" else CFLAGS="$saved_CFLAGS $CFLAGS" fi case $host_os in linux*) GF_HOST_OS="GF_LINUX_HOST_OS" GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\"" ;; solaris*) GF_HOST_OS="GF_SOLARIS_HOST_OS" GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -O0 -m64" GF_LDFLAGS="" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket" BUILD_FUSE_CLIENT=no FUSE_CLIENT_SUBDIR="" ;; *netbsd*) GF_HOST_OS="GF_BSD_HOST_OS" GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" if test "x$ac_cv_header_execinfo_h" = "xyes"; then GF_GLUSTERFS_LIBS="-lexecinfo" fi GF_FUSE_LDADD="-lperfuse" BUILD_FUSE_CLIENT=yes LEXLIB="" ;; *bsd*) GF_HOST_OS="GF_BSD_HOST_OS" GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" if test "x$ac_cv_header_execinfo_h" = "xyes"; then GF_GLUSTERFS_LIBS="-lexecinfo" fi BUILD_FUSE_CLIENT=no ;; darwin*) GF_HOST_OS="GF_DARWIN_HOST_OS" LIBTOOL=glibtool GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE -O0" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace -O0" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse" ;; esac # enable debug section AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable debug build options.])) # syslog section AC_ARG_ENABLE([syslog], AC_HELP_STRING([--disable-syslog], [Disable syslog for logging])) USE_SYSLOG="yes" if test "x$enable_syslog" != "xno"; then AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging]) else USE_SYSLOG="no" fi AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes]) #end syslog section BUILD_READLINE=no AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"]) AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"]) AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"]) AC_CHECK_LIB([intl], [gettext]) if test "x$RLLIBS" != "x"; then AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI]) BUILD_READLINE=yes fi BUILD_LIBAIO=no AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"]) if test "x$LIBAIO" != "x"; then AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled]) BUILD_LIBAIO=yes fi # glupy section BUILD_GLUPY=no have_python2=no have_Python_h=no AM_PATH_PYTHON() if echo $PYTHON_VERSION | grep ^2; then have_python2=yes fi saved_CFLAGS=$CFLAGS saved_CPPFLAGS=$CPPFLAGS saved_LDFLAGS=$LDFLAGS CFLAGS=`${PYTHON}-config --cflags` CPPFLAGS=$CFLAGS LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`" AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[]) AC_ARG_ENABLE([glupy], AS_HELP_STRING([--enable-glupy], [build glupy])) case x$enable_glupy in xyes) if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then BUILD_GLUPY=yes saved_CFLAGS="$saved_CFLAGS $CFLAGS" saved_CPPFLAGS="$saved_CPPFLAGS $CPPFLAGS" saved_LDFLAGS="$saved_LDFLAGS $LDFLAGS" else AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x]) fi ;; xno) ;; *) if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then BUILD_GLUPY=yes saved_CFLAGS="$saved_CFLAGS $CFLAGS" saved_CPPFLAGS="$saved_CPPFLAGS $CPPFLAGS" saved_LDFLAGS="$saved_LDFLAGS $LDFLAGS" else AC_MSG_WARN([ --------------------------------------------------------------------------------- cannot build glupy. python 2.x and python-devel/python-dev package are required. ---------------------------------------------------------------------------------]) fi ;; esac CFLAGS=$saved_CFLAGS CPPFLAGS=$saved_CPPFLAGS LDFLAGS=$saved_LDFLAGS if test "x$BUILD_GLUPY" = "xyes"; then BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"` BUILD_PYTHON_LIB=python$PYTHON_VERSION GLUPY_SUBDIR=glupy GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB" AC_SUBST(BUILD_PYTHON_INC) AC_SUBST(BUILD_PYTHON_LIB) AC_SUBST(GLUPY_SUBDIR) AC_SUBST(GLUPY_SUBDIR_MAKEFILE) AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE) fi # end glupy section # Other stuff (most notably the glupy section) might have injected another -O2 # into CFLAGS, so *do this last*. BUILD_DEBUG=no if test "x$enable_debug" = "xyes"; then BUILD_DEBUG=yes CFLAGS=`echo $CFLAGS | sed -e s/O2/O0/g` else BUILD_DEBUG=no fi AC_SUBST(CFLAGS) # end enable debug section AC_SUBST(GF_HOST_OS) AC_SUBST([GF_GLUSTERFS_LIBS]) AC_SUBST(GF_GLUSTERFS_CFLAGS) AC_SUBST(GF_CFLAGS) AC_SUBST(GF_LDFLAGS) AC_SUBST(GF_LDADD) AC_SUBST(GF_FUSE_LDADD) AC_SUBST(GF_FUSE_CFLAGS) AC_SUBST(RLLIBS) AC_SUBST(LIBAIO) AC_SUBST(AM_MAKEFLAGS) AC_SUBST(AM_LIBTOOLFLAGS) CONTRIBDIR='$(top_srcdir)/contrib' AC_SUBST(CONTRIBDIR) GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)' GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid' GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES" AC_SUBST([GF_CPPFLAGS]) AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS") AM_CONDITIONAL([GF_INSTALL_VAR_LIB_GLUSTERD], test ! -d ${localstatedir}/lib/glusterd && test -d ${sysconfdir}/glusterd ) dnl pkg-config versioning dnl dnl Once we released gluster-api.pc with version=4. Since then we undid the dnl library versioning and replaced it with symbol-versioning. The current dnl libgfapi.so has version 0, but the symbols have the version from the main dnl package at the time they were added. dnl dnl Because other packages (like samba) use the pkg-config version, we can not dnl drop it, or decrease the version easily. The simplest solution is to keep dnl the version=4 and add sub-digits for the actual package/symbol versions. GFAPI_VERSION="4."${PACKAGE_VERSION} AC_SUBST(GFAPI_VERSION) AC_OUTPUT echo echo "GlusterFS configure summary" echo "===========================" echo "FUSE client : $BUILD_FUSE_CLIENT" echo "Infiniband verbs : $BUILD_IBVERBS" echo "epoll IO multiplex : $BUILD_EPOLL" echo "argp-standalone : $BUILD_ARGP_STANDALONE" echo "fusermount : $BUILD_FUSERMOUNT" echo "readline : $BUILD_READLINE" echo "georeplication : $BUILD_SYNCDAEMON" echo "Linux-AIO : $BUILD_LIBAIO" echo "Enable Debug : $BUILD_DEBUG" echo "systemtap : $BUILD_SYSTEMTAP" echo "Block Device xlator : $BUILD_BD_XLATOR" echo "glupy : $BUILD_GLUPY" echo "Use syslog : $USE_SYSLOG" echo "XML output : $BUILD_XML_OUTPUT" echo "QEMU Block formats : $BUILD_QEMU_BLOCK" echo "Encryption xlator : $BUILD_CRYPT_XLATOR" echo