diff options
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 101 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops_v2.c | 27 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 13 |
3 files changed, 22 insertions, 119 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 18a50785c54..87401577ba9 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -22,97 +22,6 @@ int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data); rpc_clnt_prog_t clnt3_3_fop_prog; -int -client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, - rpc_clnt_prog_t *prog, int procnum, - fop_cbk_fn_t cbkfn, - struct iovec *payload, int payloadcnt, - struct iobref *iobref, xdrproc_t xdrproc) -{ - int ret = 0; - clnt_conf_t *conf = NULL; - struct iovec iov = {0, }; - struct iobuf *iobuf = NULL; - int count = 0; - struct iobref *new_iobref = NULL; - ssize_t xdr_size = 0; - struct rpc_req rpcreq = {0, }; - - conf = this->private; - - if (req && xdrproc) { - xdr_size = xdr_sizeof (xdrproc, req); - iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); - if (!iobuf) { - goto unwind; - }; - - new_iobref = iobref_new (); - if (!new_iobref) { - goto unwind; - } - - if (iobref != NULL) { - ret = iobref_merge (new_iobref, iobref); - if (ret != 0) { - gf_msg (this->name, GF_LOG_WARNING, ENOMEM, - PC_MSG_NO_MEMORY, "cannot merge " - "iobref passed from caller into " - "new_iobref"); - } - } - - ret = iobref_add (new_iobref, iobuf); - if (ret != 0) { - gf_msg (this->name, GF_LOG_WARNING, ENOMEM, - PC_MSG_NO_MEMORY, "cannot add iobuf into " - "iobref"); - goto unwind; - } - - iov.iov_base = iobuf->ptr; - iov.iov_len = iobuf_size (iobuf); - - /* Create the xdr payload */ - ret = xdr_serialize_generic (iov, req, xdrproc); - if (ret == -1) { - gf_log_callingfn ("", GF_LOG_WARNING, - "XDR function failed"); - goto unwind; - } - - iov.iov_len = ret; - count = 1; - } - - /* Send the msg */ - ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count, - payload, payloadcnt, new_iobref, frame, NULL, 0, - NULL, 0, NULL); - if (ret < 0) { - gf_msg_debug (this->name, 0, "rpc_clnt_submit failed"); - } - - if (new_iobref) - iobref_unref (new_iobref); - - if (iobuf) - iobuf_unref (iobuf); - - return ret; - -unwind: - rpcreq.rpc_status = -1; - cbkfn (&rpcreq, NULL, 0, frame); - - if (new_iobref) - iobref_unref (new_iobref); - - if (iobuf) - iobuf_unref (iobuf); - - return ret; -} /* CBK */ @@ -4270,11 +4179,11 @@ client3_3_writev (call_frame_t *frame, xlator_t *this, void *data) op_errno = -ret; goto unwind; } - ret = client_submit_vec_request (this, &req, frame, conf->fops, - GFS3_OP_WRITE, client3_3_writev_cbk, - args->vector, args->count, - args->iobref, - (xdrproc_t)xdr_gfs3_write_req); + ret = client_submit_request (this, &req, frame, conf->fops, + GFS3_OP_WRITE, client3_3_writev_cbk, + args->iobref, args->vector, args->count, + NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_write_req); if (ret) { /* * If the lower layers fail to submit a request, they'll also diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c index 7748a216a23..35731920a2e 100644 --- a/xlators/protocol/client/src/client-rpc-fops_v2.c +++ b/xlators/protocol/client/src/client-rpc-fops_v2.c @@ -23,13 +23,6 @@ client3_getspec (call_frame_t *frame, xlator_t *this, void *data); extern int32_t client3_3_getxattr (call_frame_t *frame, xlator_t *this, void *data); -extern int -client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, - rpc_clnt_prog_t *prog, int procnum, - fop_cbk_fn_t cbkfn, - struct iovec *payload, int payloadcnt, - struct iobref *iobref, xdrproc_t xdrproc); - int client4_0_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) @@ -3770,11 +3763,11 @@ client4_0_writev (call_frame_t *frame, xlator_t *this, void *data) goto unwind; } - ret = client_submit_vec_request (this, &req, frame, conf->fops, - GFS3_OP_WRITE, client4_0_writev_cbk, - args->vector, args->count, - args->iobref, - (xdrproc_t)xdr_gfx_write_req); + ret = client_submit_request (this, &req, frame, conf->fops, + GFS3_OP_WRITE, client4_0_writev_cbk, + args->iobref, args->vector, args->count, + NULL, 0, NULL, + (xdrproc_t)xdr_gfx_write_req); if (ret) { /* * If the lower layers fail to submit a request, they'll also @@ -5704,11 +5697,11 @@ client4_0_put (call_frame_t *frame, xlator_t *this, void *data) goto unwind; } - ret = client_submit_vec_request (this, &req, frame, conf->fops, - GFS3_OP_PUT, client4_0_put_cbk, - args->vector, args->count, - args->iobref, - (xdrproc_t)xdr_gfx_put_req); + ret = client_submit_request (this, &req, frame, conf->fops, + GFS3_OP_PUT, client4_0_put_cbk, + args->iobref, args->vector, args->count, + NULL, 0, NULL, + (xdrproc_t)xdr_gfx_put_req); if (ret) { /* * If the lower layers fail to submit a request, they'll also diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 078236647ad..0d0267d8f62 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -129,8 +129,8 @@ client_type_to_gf_type (short l_type) int client_submit_request (xlator_t *this, void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn, - struct iobref *iobref, struct iovec *rsphdr, - int rsphdr_count, struct iovec *rsp_payload, + struct iobref *iobref, struct iovec *payload, + int payloadcnt, struct iovec *rsp_payload, int rsp_payload_count, struct iobref *rsp_iobref, xdrproc_t xdrproc) { @@ -169,7 +169,7 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); if (!iobuf) { goto out; - }; + } new_iobref = iobref_new (); if (!new_iobref) { @@ -221,8 +221,9 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, /* Send the msg */ ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count, - NULL, 0, new_iobref, frame, rsphdr, rsphdr_count, - rsp_payload, rsp_payload_count, rsp_iobref); + payload, payloadcnt, new_iobref, frame, + payload, payloadcnt, rsp_payload, + rsp_payload_count, rsp_iobref); if (ret < 0) { gf_msg_debug (this->name, 0, "rpc_clnt_submit failed"); @@ -249,7 +250,7 @@ out: if (iobuf) iobuf_unref (iobuf); - return 0; + return ret; } |