From f78c8253d7fb75762effcf64683cbce10783a55b Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sun, 28 Aug 2011 12:53:12 +0530 Subject: glusterfs protocol: bring in variable sized iobuf support is a step towards reducing glusterfs memory footprint. should also help a bit in overall performance. Change-Id: I074d5813602b2c960d59562e792b3dc6e43d2f42 BUG: 3475 Reviewed-on: http://review.gluster.com/322 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/protocol/client/src/client-handshake.c | 19 ++- xlators/protocol/client/src/client.c | 75 +++++----- xlators/protocol/client/src/client.h | 2 +- xlators/protocol/client/src/client3_1-fops.c | 190 +++++++++++++++---------- xlators/protocol/server/src/server-handshake.c | 9 +- xlators/protocol/server/src/server.c | 63 ++++---- xlators/protocol/server/src/server.h | 3 +- xlators/protocol/server/src/server3_1-fops.c | 132 +++++++++++------ xlators/storage/posix/src/posix.c | 2 +- 9 files changed, 297 insertions(+), 198 deletions(-) diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index b7048b913..93be68911 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -212,7 +212,7 @@ client_start_ping (void *data) ret = client_submit_request (this, NULL, frame, conf->handshake, GF_HNDSK_PING, client_ping_cbk, NULL, NULL, - NULL, 0, NULL, 0, NULL); + NULL, 0, NULL, 0, NULL, NULL); if (ret) goto fail; @@ -360,7 +360,8 @@ int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data) ret = client_submit_request (this, &req, frame, conf->handshake, GF_HNDSK_GETSPEC, client3_getspec_cbk, NULL, xdr_from_getspec_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gf_getspec_req); if (ret) goto unwind; @@ -633,7 +634,8 @@ protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx) GFS3_OP_OPENDIR, client3_1_reopendir_cbk, NULL, xdr_from_opendir_req, NULL, 0, NULL, 0, - NULL); + NULL, + (xdrproc_t)xdr_gfs3_opendir_req); if (ret) goto out; @@ -714,7 +716,8 @@ protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx) local = NULL; ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_OPEN, client3_1_reopen_cbk, NULL, - xdr_from_open_req, NULL, 0, NULL, 0, NULL); + xdr_from_open_req, NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_open_req); if (ret) goto out; @@ -1040,7 +1043,8 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) ret = client_submit_request (this, &req, fr, conf->handshake, GF_HNDSK_SETVOLUME, client_setvolume_cbk, NULL, xdr_from_setvolume_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gf_setvolume_req); fail: if (req.dict.dict_val) @@ -1233,7 +1237,8 @@ client_query_portmap (xlator_t *this, struct rpc_clnt *rpc) GF_PMAP_PORTBYBRICK, client_query_portmap_cbk, NULL, xdr_from_pmap_port_by_brick_req, - NULL, 0, NULL, 0, NULL); + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_pmap_port_by_brick_req); fail: return ret; @@ -1329,7 +1334,7 @@ client_handshake (xlator_t *this, struct rpc_clnt *rpc) ret = client_submit_request (this, &req, frame, conf->dump, GF_DUMP_DUMP, client_dump_version_cbk, NULL, xdr_from_dump_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gf_dump_req); out: return ret; diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index f9c86835f..77e3f5413 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -47,7 +47,7 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, struct iobref *iobref, gfs_serialize_t sfunc, struct iovec *rsphdr, int rsphdr_count, struct iovec *rsp_payload, int rsp_payload_count, - struct iobref *rsp_iobref) + struct iobref *rsp_iobref, xdrproc_t xdrproc) { int ret = -1; clnt_conf_t *conf = NULL; @@ -56,6 +56,7 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, int count = 0; char start_ping = 0; struct iobref *new_iobref = NULL; + ssize_t xdr_size = 0; GF_VALIDATE_OR_GOTO ("client", this, out); GF_VALIDATE_OR_GOTO (this->name, prog, out); @@ -78,48 +79,52 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame, goto out; } - iobuf = iobuf_get (this->ctx->iobuf_pool); - if (!iobuf) { - goto out; - }; + if (req && xdrproc) { + xdr_size = xdr_sizeof (xdrproc, req); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); + if (!iobuf) { + goto out; + }; - new_iobref = iobref_new (); - if (!new_iobref) { - goto out; - } + new_iobref = iobref_new (); + if (!new_iobref) { + goto out; + } - if (iobref != NULL) { - ret = iobref_merge (new_iobref, iobref); + if (iobref != NULL) { + ret = iobref_merge (new_iobref, iobref); + if (ret != 0) { + gf_log (this->name, GF_LOG_WARNING, + "cannot merge iobref passed from caller " + "into new_iobref"); + } + } + + ret = iobref_add (new_iobref, iobuf); if (ret != 0) { gf_log (this->name, GF_LOG_WARNING, - "cannot merge iobref passed from caller " - "into new_iobref"); + "cannot add iobuf into iobref"); + goto out; } - } - - ret = iobref_add (new_iobref, iobuf); - if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot add iobuf into iobref"); - goto out; - } - iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; - - /* Create the xdr payload */ - if (req && sfunc) { - ret = sfunc (iov, req); - if (ret == -1) { - /* callingfn so that, we can get to know which xdr - function was called */ - gf_log_callingfn (this->name, GF_LOG_WARNING, - "XDR payload creation failed"); - goto out; + iov.iov_base = iobuf->ptr; + iov.iov_len = iobuf_size (iobuf); + + /* Create the xdr payload */ + if (sfunc) { + ret = sfunc (iov, req); + if (ret == -1) { + /* callingfn so that, we can get to know which xdr + function was called */ + gf_log_callingfn (this->name, GF_LOG_WARNING, + "XDR payload creation failed"); + goto out; + } + iov.iov_len = ret; + count = 1; } - iov.iov_len = ret; - count = 1; } + /* Send the msg */ ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbk, &iov, count, NULL, 0, new_iobref, frame, rsphdr, rsphdr_count, diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index a595df6a0..328e1ca24 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -164,7 +164,7 @@ int client_submit_request (xlator_t *this, void *req, struct iobref *iobref, gfs_serialize_t sfunc, struct iovec *rsphdr, int rsphdr_count, struct iovec *rsp_payload, int rsp_count, - struct iobref *rsp_iobref); + struct iobref *rsp_iobref, xdrproc_t xdrproc); int protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx); int protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx); diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index b7101c4d6..c1a7f4e43 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -35,7 +35,8 @@ 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 cbk, struct iovec *payload, int payloadcnt, - struct iobref *iobref, gfs_serialize_t sfunc) + struct iobref *iobref, gfs_serialize_t sfunc, + xdrproc_t xdrproc) { int ret = 0; clnt_conf_t *conf = NULL; @@ -44,52 +45,55 @@ client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, int count = 0; int start_ping = 0; struct iobref *new_iobref = NULL; + ssize_t xdr_size = 0; start_ping = 0; conf = this->private; - iobuf = iobuf_get (this->ctx->iobuf_pool); - if (!iobuf) { - goto out; - }; + if (req && xdrproc) { + xdr_size = xdr_sizeof (xdrproc, req); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); + if (!iobuf) { + goto out; + }; - new_iobref = iobref_new (); - if (!new_iobref) { - goto out; - } + new_iobref = iobref_new (); + if (!new_iobref) { + goto out; + } + + if (iobref != NULL) { + ret = iobref_merge (new_iobref, iobref); + if (ret != 0) { + gf_log (this->name, GF_LOG_WARNING, + "cannot merge iobref passed from caller " + "into new_iobref"); + } + } - if (iobref != NULL) { - ret = iobref_merge (new_iobref, iobref); + ret = iobref_add (new_iobref, iobuf); if (ret != 0) { gf_log (this->name, GF_LOG_WARNING, - "cannot merge iobref passed from caller into " - "new_iobref"); + "cannot add iobuf into iobref"); goto out; } - } - ret = iobref_add (new_iobref, iobuf); - if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "cannot add iobuf into iobref"); - goto out; - } + iov.iov_base = iobuf->ptr; + iov.iov_len = iobuf_size (iobuf); - iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; + /* Create the xdr payload */ + if (sfunc) { + ret = sfunc (iov, req); + if (ret == -1) { + gf_log_callingfn ("", GF_LOG_WARNING, + "XDR function failed"); + goto out; + } - /* Create the xdr payload */ - if (req && sfunc) { - ret = sfunc (iov, req); - if (ret == -1) { - gf_log_callingfn ("", GF_LOG_WARNING, - "XDR function failed"); - goto out; + iov.iov_len = ret; + count = 1; } - - iov.iov_len = ret; - count = 1; } /* Send the msg */ ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbk, &iov, count, @@ -2357,7 +2361,8 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx) GFS3_OP_RELEASEDIR, client3_1_releasedir_cbk, NULL, xdr_from_releasedir_req, - NULL, 0, NULL, 0, NULL); + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_releasedir_req); } else { gfs3_release_req req = {{0,},}; req.fd = fdctx->remote_fd; @@ -2366,7 +2371,8 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx) GFS3_OP_RELEASE, client3_1_release_cbk, NULL, xdr_from_release_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_release_req); } out: @@ -2424,7 +2430,8 @@ client3_1_releasedir (call_frame_t *frame, xlator_t *this, GFS3_OP_RELEASEDIR, client3_1_releasedir_cbk, NULL, xdr_from_releasedir_req, - NULL, 0, NULL, 0, NULL); + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_releasedir_req); inode_unref (fdctx->inode); GF_FREE (fdctx); } @@ -2481,7 +2488,8 @@ client3_1_release (call_frame_t *frame, xlator_t *this, GFS3_OP_RELEASE, client3_1_release_cbk, NULL, xdr_from_release_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_release_req); inode_unref (fdctx->inode); GF_FREE (fdctx); } @@ -2550,6 +2558,7 @@ client3_1_lookup (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); if (rsp_iobuf == NULL) { goto unwind; @@ -2585,7 +2594,8 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LOOKUP, client3_1_lookup_cbk, NULL, xdr_from_lookup_req, rsphdr, count, - NULL, 0, local->iobref); + NULL, 0, local->iobref, + (xdrproc_t)xdr_gfs3_lookup_req); if (ret) { op_errno = ENOTCONN; @@ -2657,7 +2667,8 @@ client3_1_stat (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_STAT, client3_1_stat_cbk, NULL, - xdr_from_stat_req, NULL, 0, NULL, 0, NULL); + xdr_from_stat_req, NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_stat_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -2704,7 +2715,7 @@ client3_1_truncate (call_frame_t *frame, xlator_t *this, GFS3_OP_TRUNCATE, client3_1_truncate_cbk, NULL, xdr_from_truncate_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_truncate_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -2763,7 +2774,7 @@ client3_1_ftruncate (call_frame_t *frame, xlator_t *this, GFS3_OP_FTRUNCATE, client3_1_ftruncate_cbk, NULL, xdr_from_ftruncate_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_ftruncate_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -2809,7 +2820,7 @@ client3_1_access (call_frame_t *frame, xlator_t *this, GFS3_OP_ACCESS, client3_1_access_cbk, NULL, xdr_from_access_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_access_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -2853,7 +2864,7 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this, GFS3_OP_READLINK, client3_1_readlink_cbk, NULL, xdr_from_readlink_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_readlink_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -2900,7 +2911,7 @@ client3_1_unlink (call_frame_t *frame, xlator_t *this, GFS3_OP_UNLINK, client3_1_unlink_cbk, NULL, xdr_from_unlink_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_unlink_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -2945,7 +2956,7 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_RMDIR, client3_1_rmdir_cbk, NULL, xdr_from_rmdir_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_rmdir_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3013,7 +3024,7 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_SYMLINK, client3_1_symlink_cbk, NULL, xdr_from_symlink_req, NULL, 0, NULL, - 0, NULL); + 0, NULL, (xdrproc_t)xdr_gfs3_symlink_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3077,7 +3088,7 @@ client3_1_rename (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_RENAME, client3_1_rename_cbk, NULL, xdr_from_rename_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_rename_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3137,7 +3148,8 @@ client3_1_link (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LINK, client3_1_link_cbk, NULL, - xdr_from_link_req, NULL, 0, NULL, 0, NULL); + xdr_from_link_req, NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_link_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3207,7 +3219,7 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_MKNOD, client3_1_mknod_cbk, NULL, xdr_from_mknod_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_mknod_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3288,7 +3300,7 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_MKDIR, client3_1_mkdir_cbk, NULL, xdr_from_mkdir_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_mkdir_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3371,7 +3383,7 @@ client3_1_create (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_CREATE, client3_1_create_cbk, NULL, xdr_from_create_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_create_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3440,7 +3452,8 @@ client3_1_open (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_OPEN, client3_1_open_cbk, NULL, - xdr_from_open_req, NULL, 0, NULL, 0, NULL); + xdr_from_open_req, NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_open_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3506,6 +3519,7 @@ client3_1_readv (call_frame_t *frame, xlator_t *this, req.offset = args->offset; req.fd = fdctx->remote_fd; + /* TODO: what is the size we should send ? */ rsp_iobuf = iobuf_get (this->ctx->iobuf_pool); if (rsp_iobuf == NULL) { op_errno = ENOMEM; @@ -3547,7 +3561,8 @@ client3_1_readv (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_READ, client3_1_readv_cbk, NULL, xdr_from_readv_req, NULL, 0, &rsp_vec, 1, - local->iobref); + local->iobref, + (xdrproc_t)xdr_gfs3_read_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3611,9 +3626,10 @@ client3_1_writev (call_frame_t *frame, xlator_t *this, void *data) req.fd = fdctx->remote_fd; ret = client_submit_vec_request (this, &req, frame, conf->fops, GFS3_OP_WRITE, - client3_1_writev_cbk, - args->vector, args->count, - args->iobref, xdr_from_writev_req); + client3_1_writev_cbk, args->vector, + args->count, args->iobref, + xdr_from_writev_req, + (xdrproc_t)xdr_gfs3_write_req); if (ret) goto unwind; @@ -3682,7 +3698,7 @@ client3_1_flush (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FLUSH, client3_1_flush_cbk, NULL, xdr_from_flush_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_flush_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3740,7 +3756,7 @@ client3_1_fsync (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSYNC, client3_1_fsync_cbk, NULL, xdr_from_fsync_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_fsync_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3797,7 +3813,7 @@ client3_1_fstat (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSTAT, client3_1_fstat_cbk, NULL, xdr_from_fstat_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_fstat_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3851,7 +3867,8 @@ client3_1_opendir (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_OPENDIR, client3_1_opendir_cbk, NULL, xdr_from_opendir_req, - NULL, 0, NULL, 0, NULL); + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_opendir_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3914,7 +3931,8 @@ client3_1_fsyncdir (call_frame_t *frame, xlator_t *this, void *data) ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR, client3_1_fsyncdir_cbk, NULL, xdr_from_fsyncdir_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_fsyncdir_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -3961,7 +3979,7 @@ client3_1_statfs (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_STATFS, client3_1_statfs_cbk, NULL, xdr_from_statfs_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_statfs_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4019,7 +4037,8 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_SETXATTR, client3_1_setxattr_cbk, NULL, xdr_from_setxattr_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_setxattr_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4098,7 +4117,8 @@ client3_1_fsetxattr (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSETXATTR, client3_1_fsetxattr_cbk, NULL, xdr_from_fsetxattr_req, NULL, 0, - NULL, 0, NULL); + NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_fsetxattr_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4179,6 +4199,7 @@ 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); if (rsp_iobuf == NULL) { op_errno = ENOMEM; @@ -4207,7 +4228,8 @@ client3_1_fgetxattr (call_frame_t *frame, xlator_t *this, GFS3_OP_FGETXATTR, client3_1_fgetxattr_cbk, NULL, xdr_from_fgetxattr_req, rsphdr, count, - NULL, 0, local->iobref); + NULL, 0, local->iobref, + (xdrproc_t)xdr_gfs3_fgetxattr_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4283,6 +4305,7 @@ 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); if (rsp_iobuf == NULL) { op_ret = -1; @@ -4338,7 +4361,8 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this, GFS3_OP_GETXATTR, client3_1_getxattr_cbk, NULL, xdr_from_getxattr_req, rsphdr, count, - NULL, 0, local->iobref); + NULL, 0, local->iobref, + (xdrproc_t)xdr_gfs3_getxattr_req); if (ret) { op_ret = -1; op_errno = ENOTCONN; @@ -4406,6 +4430,7 @@ 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); if (rsp_iobuf == NULL) { op_errno = ENOMEM; @@ -4448,7 +4473,8 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this, GFS3_OP_XATTROP, client3_1_xattrop_cbk, NULL, xdr_from_xattrop_req, rsphdr, count, - NULL, 0, local->iobref); + NULL, 0, local->iobref, + (xdrproc_t)xdr_gfs3_xattrop_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4547,6 +4573,7 @@ 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); if (rsp_iobuf == NULL) { op_errno = ENOMEM; @@ -4579,7 +4606,8 @@ client3_1_fxattrop (call_frame_t *frame, xlator_t *this, GFS3_OP_FXATTROP, client3_1_fxattrop_cbk, NULL, xdr_from_fxattrop_req, rsphdr, count, - NULL, 0, local->iobref); + NULL, 0, local->iobref, + (xdrproc_t)xdr_gfs3_fxattrop_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4648,7 +4676,8 @@ client3_1_removexattr (call_frame_t *frame, xlator_t *this, GFS3_OP_REMOVEXATTR, client3_1_removexattr_cbk, NULL, xdr_from_removexattr_req, NULL, 0, NULL, - 0, NULL); + 0, NULL, + (xdrproc_t)xdr_gfs3_removexattr_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4740,7 +4769,8 @@ client3_1_lk (call_frame_t *frame, xlator_t *this, ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LK, client3_1_lk_cbk, NULL, xdr_from_lk_req, - NULL, 0, NULL, 0, NULL); + NULL, 0, NULL, 0, NULL, + (xdrproc_t)xdr_gfs3_lk_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4815,7 +4845,7 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this, GFS3_OP_INODELK, client3_1_inodelk_cbk, NULL, xdr_from_inodelk_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_inodelk_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4904,7 +4934,7 @@ client3_1_finodelk (call_frame_t *frame, xlator_t *this, GFS3_OP_FINODELK, client3_1_finodelk_cbk, NULL, xdr_from_finodelk_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_finodelk_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -4957,7 +4987,7 @@ client3_1_entrylk (call_frame_t *frame, xlator_t *this, GFS3_OP_ENTRYLK, client3_1_entrylk_cbk, NULL, xdr_from_entrylk_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_entrylk_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -5024,7 +5054,7 @@ client3_1_fentrylk (call_frame_t *frame, xlator_t *this, GFS3_OP_FENTRYLK, client3_1_fentrylk_cbk, NULL, xdr_from_fentrylk_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_fentrylk_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -5084,7 +5114,7 @@ client3_1_rchecksum (call_frame_t *frame, xlator_t *this, GFS3_OP_RCHECKSUM, client3_1_rchecksum_cbk, NULL, xdr_from_rchecksum_req, NULL, 0, NULL, - 0, NULL); + 0, NULL, (xdrproc_t)xdr_gfs3_rchecksum_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -5163,6 +5193,7 @@ client3_1_readdir (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); if (rsp_iobuf == NULL) { goto unwind; @@ -5187,7 +5218,8 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this, GFS3_OP_READDIR, client3_1_readdir_cbk, NULL, xdr_from_readdir_req, rsphdr, count, - NULL, 0, rsp_iobref); + NULL, 0, rsp_iobref, + (xdrproc_t)xdr_gfs3_readdir_req); rsp_iobref = NULL; if (ret) { @@ -5281,6 +5313,7 @@ client3_1_readdirp (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); if (rsp_iobuf == NULL) { goto unwind; @@ -5306,7 +5339,8 @@ client3_1_readdirp (call_frame_t *frame, xlator_t *this, GFS3_OP_READDIRP, client3_1_readdirp_cbk, NULL, xdr_from_readdirp_req, rsphdr, count, NULL, - 0, rsp_iobref); + 0, rsp_iobref, + (xdrproc_t)xdr_gfs3_readdirp_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -5365,7 +5399,7 @@ client3_1_setattr (call_frame_t *frame, xlator_t *this, GFS3_OP_SETATTR, client3_1_setattr_cbk, NULL, xdr_from_setattr_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_setattr_req); if (ret) { op_errno = ENOTCONN; goto unwind; @@ -5423,7 +5457,7 @@ client3_1_fsetattr (call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_FSETATTR, client3_1_fsetattr_cbk, NULL, xdr_from_fsetattr_req, NULL, 0, NULL, 0, - NULL); + NULL, (xdrproc_t)xdr_gfs3_fsetattr_req); if (ret) { op_errno = ENOTCONN; goto unwind; diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index fc22fffe4..694853417 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -326,7 +326,8 @@ fail: rsp.op_ret = ret; server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, - (gfs_serialize_t)xdr_serialize_getspec_rsp); + (gfs_serialize_t)xdr_serialize_getspec_rsp, + (xdrproc_t)xdr_gf_getspec_rsp); return 0; } @@ -620,7 +621,8 @@ fail: rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, - (gfs_serialize_t)xdr_serialize_setvolume_rsp); + (gfs_serialize_t)xdr_serialize_setvolume_rsp, + (xdrproc_t)xdr_gf_setvolume_rsp); if (args.dict.dict_val) @@ -650,7 +652,8 @@ server_ping (rpcsvc_request_t *req) rsp.op_ret = 0; server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 28df5c5dc..32ecc4d8c 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -38,39 +38,46 @@ struct iobuf * gfs_serialize_reply (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc, - struct iovec *outmsg) + struct iovec *outmsg, xdrproc_t xdrproc) { - struct iobuf *iob = NULL; - ssize_t retlen = -1; + struct iobuf *iob = NULL; + ssize_t retlen = 0; + ssize_t xdr_size = 0; GF_VALIDATE_OR_GOTO ("server", req, ret); /* First, get the io buffer into which the reply in arg will * be serialized. */ - iob = iobuf_get (req->svc->ctx->iobuf_pool); - if (!iob) { - gf_log_callingfn ("", GF_LOG_ERROR, "Failed to get iobuf"); - goto ret; - } - - iobuf_to_iovec (iob, outmsg); - /* Use the given serializer to translate the give C structure in arg - * to XDR format which will be written into the buffer in outmsg. - */ - /* retlen is used to received the error since size_t is unsigned and we - * need -1 for error notification during encoding. - */ - retlen = sfunc (*outmsg, arg); - if (retlen == -1) { - /* Failed to Encode 'GlusterFS' msg in RPC is not exactly - failure of RPC return values.. client should get - notified about this, so there are no missing frames */ - gf_log_callingfn ("", GF_LOG_ERROR, "Failed to encode message"); - req->rpc_err = GARBAGE_ARGS; - retlen = 0; + if (arg && xdrproc) { + xdr_size = xdr_sizeof (xdrproc, arg); + iob = iobuf_get2 (req->svc->ctx->iobuf_pool, xdr_size); + if (!iob) { + gf_log_callingfn (THIS->name, GF_LOG_ERROR, + "Failed to get iobuf"); + goto ret; + }; + + iobuf_to_iovec (iob, outmsg); + /* Use the given serializer to translate the give C structure in arg + * to XDR format which will be written into the buffer in outmsg. + */ + /* retlen is used to received the error since size_t is unsigned and we + * need -1 for error notification during encoding. + */ + retlen = -1; + if (sfunc) { + retlen = sfunc (*outmsg, arg); + if (retlen == -1) { + /* Failed to Encode 'GlusterFS' msg in RPC is not exactly + failure of RPC return values.. client should get + notified about this, so there are no missing frames */ + gf_log_callingfn ("", GF_LOG_ERROR, "Failed to encode message"); + req->rpc_err = GARBAGE_ARGS; + retlen = 0; + } + } } - outmsg->iov_len = retlen; ret: if (retlen == -1) { @@ -83,11 +90,11 @@ ret: -/* Generic reply function for NFSv3 specific replies. */ int server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gfs_serialize_t sfunc) + struct iobref *iobref, gfs_serialize_t sfunc, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; int ret = -1; @@ -111,7 +118,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, new_iobref = 1; } - iob = gfs_serialize_reply (req, arg, sfunc, &rsp); + iob = gfs_serialize_reply (req, arg, sfunc, &rsp, xdrproc); if (!iob) { gf_log ("", GF_LOG_ERROR, "Failed to serialize reply"); goto ret; diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index 0ca8b29f3..9c7459fb1 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -198,7 +198,8 @@ typedef ssize_t (*gfs_serialize_t) (struct iovec outmsg, void *args); int server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gfs_serialize_t sfunc); + struct iobref *iobref, gfs_serialize_t sfunc, + xdrproc_t xdrproc); int xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc); diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 0eaefab4c..a4666343e 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -55,7 +55,8 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_statfs_rsp); + xdr_serialize_statfs_rsp, + (xdrproc_t)xdr_gfs3_statfs_rsp); return 0; } @@ -170,7 +171,8 @@ out: } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - (gfs_serialize_t)xdr_serialize_lookup_rsp); + (gfs_serialize_t)xdr_serialize_lookup_rsp, + (xdrproc_t)xdr_gfs3_lookup_rsp); if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); @@ -221,7 +223,8 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_lk_rsp); + xdr_serialize_lk_rsp, + (xdrproc_t)xdr_gfs3_lk_rsp); return 0; } @@ -261,7 +264,8 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -303,7 +307,8 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -342,7 +347,8 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -381,7 +387,8 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -409,7 +416,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -451,7 +459,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_rmdir_rsp); + xdr_serialize_rmdir_rsp, + (xdrproc_t)xdr_gfs3_rmdir_rsp); return 0; } @@ -490,7 +499,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_mkdir_rsp); + xdr_serialize_mkdir_rsp, + (xdrproc_t)xdr_gfs3_mkdir_rsp); return 0; } @@ -529,7 +539,8 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_mknod_rsp); + xdr_serialize_mknod_rsp, + (xdrproc_t)xdr_gfs3_mknod_rsp); return 0; @@ -559,7 +570,8 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -596,7 +608,8 @@ unwind: rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_readdir_rsp); + xdr_serialize_readdir_rsp, + (xdrproc_t)xdr_gfs3_readdir_rsp); readdir_rsp_cleanup (&rsp); @@ -617,7 +630,8 @@ server_releasedir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -655,7 +669,8 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_opendir_rsp); + xdr_serialize_opendir_rsp, + (xdrproc_t)xdr_gfs3_opendir_rsp); return 0; } @@ -681,7 +696,8 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -742,7 +758,8 @@ out: state->name, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_getxattr_rsp); + xdr_serialize_getxattr_rsp, + (xdrproc_t)xdr_gfs3_getxattr_rsp); if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); @@ -806,7 +823,8 @@ out: state->name, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_fgetxattr_rsp); + xdr_serialize_fgetxattr_rsp, + (xdrproc_t)xdr_gfs3_fgetxattr_rsp); if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); @@ -835,7 +853,8 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? state->loc.inode->ino : 0, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -863,7 +882,8 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } @@ -917,7 +937,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_rename_rsp); + xdr_serialize_rename_rsp, + (xdrproc_t)xdr_gfs3_rename_rsp); return 0; } @@ -966,7 +987,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_unlink_rsp); + xdr_serialize_unlink_rsp, + (xdrproc_t)xdr_gfs3_unlink_rsp); return 0; } @@ -1006,7 +1028,8 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_symlink_rsp); + xdr_serialize_symlink_rsp, + (xdrproc_t)xdr_gfs3_symlink_rsp); return 0; } @@ -1051,7 +1074,8 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_link_rsp); + xdr_serialize_link_rsp, + (xdrproc_t)xdr_gfs3_link_rsp); return 0; } @@ -1084,7 +1108,8 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_truncate_rsp); + xdr_serialize_truncate_rsp, + (xdrproc_t)xdr_gfs3_truncate_rsp); return 0; } @@ -1115,7 +1140,8 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_fstat_rsp); + xdr_serialize_fstat_rsp, + (xdrproc_t)xdr_gfs3_fstat_rsp); return 0; } @@ -1148,7 +1174,8 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_ftruncate_rsp); + xdr_serialize_ftruncate_rsp, + (xdrproc_t)xdr_gfs3_ftruncate_rsp); return 0; } @@ -1176,7 +1203,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; @@ -1210,7 +1238,8 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_fsync_rsp); + xdr_serialize_fsync_rsp, + (xdrproc_t)xdr_gfs3_fsync_rsp); return 0; } @@ -1242,7 +1271,8 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_writev_rsp); + xdr_serialize_writev_rsp, + (xdrproc_t)xdr_gfs3_write_rsp); return 0; } @@ -1276,7 +1306,8 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, vector, count, iobref, - xdr_serialize_readv_rsp); + xdr_serialize_readv_rsp, + (xdrproc_t)xdr_gfs3_read_rsp); return 0; } @@ -1310,7 +1341,8 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_rchecksum_rsp); + xdr_serialize_rchecksum_rsp, + (xdrproc_t)xdr_gfs3_rchecksum_rsp); return 0; } @@ -1348,7 +1380,8 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_open_rsp); + xdr_serialize_open_rsp, + (xdrproc_t)xdr_gfs3_open_rsp); return 0; } @@ -1426,7 +1459,8 @@ out: rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_create_rsp); + xdr_serialize_create_rsp, + (xdrproc_t)xdr_gfs3_create_rsp); return 0; } @@ -1463,7 +1497,8 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.path = ""; server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_readlink_rsp); + xdr_serialize_readlink_rsp, + (xdrproc_t)xdr_gfs3_readlink_rsp); return 0; } @@ -1494,7 +1529,8 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_stat_rsp); + xdr_serialize_stat_rsp, + (xdrproc_t)xdr_gfs3_stat_rsp); return 0; } @@ -1528,7 +1564,8 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_setattr_rsp); + xdr_serialize_setattr_rsp, + (xdrproc_t)xdr_gfs3_setattr_rsp); return 0; } @@ -1562,7 +1599,8 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_fsetattr_rsp); + xdr_serialize_fsetattr_rsp, + (xdrproc_t)xdr_gfs3_fsetattr_rsp); return 0; } @@ -1632,7 +1670,8 @@ out: op_ret, strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_xattrop_rsp); + xdr_serialize_xattrop_rsp, + (xdrproc_t)xdr_gfs3_xattrop_rsp); if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); @@ -1706,7 +1745,8 @@ out: strerror (op_errno)); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_fxattrop_rsp); + xdr_serialize_fxattrop_rsp, + (xdrproc_t)xdr_gfs3_fxattrop_rsp); if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); @@ -1749,7 +1789,8 @@ out: rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_readdirp_rsp); + xdr_serialize_readdirp_rsp, + (xdrproc_t)xdr_gfs3_readdirp_rsp); readdirp_rsp_cleanup (&rsp); @@ -3158,7 +3199,8 @@ server_release (rpcsvc_request_t *req) gf_fd_put (conn->fdtable, args.fd); server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); ret = 0; out: return ret; @@ -3182,7 +3224,8 @@ server_releasedir (rpcsvc_request_t *req) gf_fd_put (conn->fdtable, args.fd); server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, - xdr_serialize_common_rsp); + xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); ret = 0; out: return ret; @@ -5017,7 +5060,8 @@ server_null (rpcsvc_request_t *req) rsp.op_ret = 0; server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, - (gfs_serialize_t)xdr_serialize_common_rsp); + (gfs_serialize_t)xdr_serialize_common_rsp, + (xdrproc_t)xdr_gf_common_rsp); return 0; } diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 9ac400a0c..f816128f4 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1989,7 +1989,7 @@ posix_readv (call_frame_t *frame, xlator_t *this, align = 4096; /* align to page boundary */ } - iobuf = iobuf_get (this->ctx->iobuf_pool); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, size); if (!iobuf) { op_errno = ENOMEM; goto out; -- cgit