From df0a72d9c118c2a1146f2787eee6d5f0a58853f0 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Fri, 29 Jul 2011 16:36:27 +0530 Subject: Variable IOBUF: Use variable iobuf for cli/glusterd/glusterfsd(mgmt) By using variable iobufs, xfer data size is no more limited to 128K (default). This helps in scaling. Change-Id: Iab453db9223d887306d150cd6fe0b1eae9c422cc BUG: 2472 Reviewed-on: http://review.gluster.com/13 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-handler.c | 57 +++++++++++++++++--------- xlators/mgmt/glusterd/src/glusterd-handshake.c | 6 ++- xlators/mgmt/glusterd/src/glusterd-pmap.c | 15 ++++--- xlators/mgmt/glusterd/src/glusterd-rebalance.c | 6 ++- xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 47 ++++++++++++++++----- xlators/mgmt/glusterd/src/glusterd-utils.c | 20 +++++---- xlators/mgmt/glusterd/src/glusterd-utils.h | 5 ++- 7 files changed, 109 insertions(+), 47 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 1cc27d925..e18bce618 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1030,7 +1030,8 @@ out: rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_submit_reply(req, cli_rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_create_vol_rsp); + gf_xdr_serialize_cli_create_vol_rsp, + (xdrproc_t)xdr_gf1_cli_create_vol_rsp); if (!lock_fail) (void) glusterd_opinfo_unlock (); @@ -1454,7 +1455,8 @@ out: rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_submit_reply(req, cli_rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_add_brick_rsp); + gf_xdr_serialize_cli_add_brick_rsp, + (xdrproc_t)xdr_gf1_cli_add_brick_rsp); if (!lock_fail) glusterd_opinfo_unlock(); ret = 0; //sent error to cli, prevent second reply @@ -2169,7 +2171,8 @@ out: rsp.op_errstr = err_str; cli_rsp = &rsp; glusterd_submit_reply(req, cli_rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_remove_brick_rsp); + gf_xdr_serialize_cli_remove_brick_rsp, + (xdrproc_t)xdr_gf1_cli_remove_brick_rsp); if (!lock_fail) glusterd_opinfo_unlock(); @@ -2352,7 +2355,8 @@ out: rsp.path = "Operation failed"; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_log_locate_rsp); + gf_xdr_serialize_cli_log_locate_rsp, + (xdrproc_t)xdr_gf1_cli_log_locate_rsp); if (cli_req.brick) free (cli_req.brick); //its malloced by xdr @@ -2594,7 +2598,8 @@ out: if (msg[0] == '\0') snprintf (msg, sizeof (msg), "Operation failed"); glusterd_submit_reply(req, &cli_rsp, NULL, 0, NULL, - gf_xdr_from_cli_sync_volume_rsp); + gf_xdr_from_cli_sync_volume_rsp, + (xdrproc_t)xdr_gf1_cli_sync_volume_rsp); if (free_hostname && cli_req.hostname) free (cli_req.hostname); if (free_volname && cli_req.volname) @@ -2632,7 +2637,8 @@ glusterd_fsm_log_send_resp (rpcsvc_request_t *req, int op_ret, (size_t *)&rsp.fsm_log.fsm_log_len); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_from_cli_fsm_log_rsp); + gf_xdr_from_cli_fsm_log_rsp, + (xdrproc_t)xdr_gf1_cli_fsm_log_rsp); if (rsp.fsm_log.fsm_log_val) GF_FREE (rsp.fsm_log.fsm_log_val); @@ -2709,7 +2715,8 @@ glusterd_op_lock_send_resp (rpcsvc_request_t *req, int32_t status) rsp.op_ret = status; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_cluster_lock_rsp); + gd_xdr_serialize_mgmt_cluster_lock_rsp, + (xdrproc_t)xdr_gd1_mgmt_cluster_lock_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded, ret: %d", ret); @@ -2729,7 +2736,8 @@ glusterd_op_unlock_send_resp (rpcsvc_request_t *req, int32_t status) glusterd_get_uuid (&rsp.uuid); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_cluster_unlock_rsp); + gd_xdr_serialize_mgmt_cluster_unlock_rsp, + (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to unlock, ret: %d", ret); @@ -2801,7 +2809,8 @@ glusterd_op_stage_send_resp (rpcsvc_request_t *req, } ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_stage_op_rsp); + gd_xdr_serialize_mgmt_stage_op_rsp, + (xdrproc_t)xdr_gd1_mgmt_stage_op_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to stage, ret: %d", ret); @@ -2842,7 +2851,8 @@ glusterd_op_commit_send_resp (rpcsvc_request_t *req, ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_commit_op_rsp); + gd_xdr_serialize_mgmt_commit_op_rsp, + (xdrproc_t)xdr_gd1_mgmt_commit_op_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to commit, ret: %d", ret); @@ -3089,7 +3099,8 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) out: uuid_copy (rsp.uuid, priv->uuid); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_friend_update_rsp); + gd_xdr_serialize_mgmt_friend_update_rsp, + (xdrproc_t)xdr_gd1_mgmt_friend_update_rsp); if (dict) { if (!dict->extra_stdfree && friend_req.friends.friends_val) free (friend_req.friends.friends_val);//malloced by xdr @@ -3167,7 +3178,8 @@ glusterd_handle_probe_query (rpcsvc_request_t *req) rsp.hostname = probe_req.hostname; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_probe_rsp); + gd_xdr_serialize_mgmt_probe_rsp, + (xdrproc_t)xdr_gd1_mgmt_probe_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to %s, op_ret: %d, " "op_errno: %d, ret: %d", probe_req.hostname, @@ -3292,7 +3304,8 @@ glusterd_handle_getwd (rpcsvc_request_t *req) rsp.wd = priv->workdir; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_from_cli_getwd_rsp); + gf_xdr_from_cli_getwd_rsp, + (xdrproc_t)xdr_gf1_cli_getwd_rsp); glusterd_friend_sm (); glusterd_op_sm (); @@ -3604,7 +3617,8 @@ glusterd_xfer_friend_remove_resp (rpcsvc_request_t *req, char *hostname, int por rsp.hostname = hostname; rsp.port = port; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_friend_rsp); + gd_xdr_serialize_mgmt_friend_rsp, + (xdrproc_t)xdr_gd1_mgmt_friend_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to %s (%d), ret: %d", hostname, port, ret); @@ -3635,7 +3649,8 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname, int port, rsp.port = port; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gd_xdr_serialize_mgmt_friend_rsp); + gd_xdr_serialize_mgmt_friend_rsp, + (xdrproc_t)xdr_gd1_mgmt_friend_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to %s (%d), ret: %d", hostname, port, ret); @@ -3659,7 +3674,8 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret, rsp.port = port; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_probe_rsp); + gf_xdr_serialize_cli_probe_rsp, + (xdrproc_t)xdr_gf1_cli_probe_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to CLI, ret: %d",ret); @@ -3680,7 +3696,8 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret, rsp.hostname = hostname; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_deprobe_rsp); + gf_xdr_serialize_cli_deprobe_rsp, + (xdrproc_t)xdr_gf1_cli_deprobe_rsp); gf_log ("glusterd", GF_LOG_INFO, "Responded to CLI, ret: %d",ret); @@ -3742,7 +3759,8 @@ out: rsp.op_ret = ret; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_peer_list_rsp); + gf_xdr_serialize_cli_peer_list_rsp, + (xdrproc_t)xdr_gf1_cli_peer_list_rsp); if (rsp.friends.friends_val) GF_FREE (rsp.friends.friends_val); @@ -3845,7 +3863,8 @@ out: rsp.op_ret = ret; ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_peer_list_rsp); + gf_xdr_serialize_cli_peer_list_rsp, + (xdrproc_t)xdr_gf1_cli_peer_list_rsp); if (volumes) dict_unref (volumes); diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index dda8a03bb..8a7424c0d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -191,7 +191,8 @@ fail: rsp.spec = ""; glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_serialize_getspec_rsp); + (gd_serialize_t)xdr_serialize_getspec_rsp, + (xdrproc_t)xdr_gf_getspec_rsp); if (args.key) free (args.key);//malloced by xdr if (rsp.spec && (strcmp (rsp.spec, ""))) @@ -421,7 +422,8 @@ glusterd_peer_handshake (xlator_t *this, struct rpc_clnt *rpc, ret = glusterd_submit_request (peerctx->peerinfo->rpc, &req, frame, &glusterd_dump_prog, GF_DUMP_DUMP, NULL, xdr_from_dump_req, this, - glusterd_peer_dump_version_cbk); + glusterd_peer_dump_version_cbk, + (xdrproc_t)xdr_gf_dump_req); out: return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index f1f49fc60..d1a4e9faf 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -335,7 +335,8 @@ gluster_pmap_portbybrick (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_port_by_brick_rsp); + (gd_serialize_t)xdr_from_pmap_port_by_brick_rsp, + (xdrproc_t)xdr_pmap_port_by_brick_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -362,7 +363,8 @@ gluster_pmap_brickbyport (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_brick_by_port_rsp); + (gd_serialize_t)xdr_from_pmap_brick_by_port_rsp, + (xdrproc_t)xdr_pmap_brick_by_port_rsp); return 0; } @@ -393,7 +395,8 @@ gluster_pmap_signup (rpcsvc_request_t *req) fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signup_rsp); + (gd_serialize_t)xdr_from_pmap_signup_rsp, + (xdrproc_t)xdr_pmap_signup_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -420,7 +423,8 @@ gluster_pmap_signin (rpcsvc_request_t *req) &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signin_rsp); + (gd_serialize_t)xdr_from_pmap_signin_rsp, + (xdrproc_t)xdr_pmap_signin_rsp); if (args.brick) free (args.brick);//malloced by xdr @@ -453,7 +457,8 @@ gluster_pmap_signout (rpcsvc_request_t *req) &brickinfo); fail: glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - (gd_serialize_t)xdr_from_pmap_signout_rsp); + (gd_serialize_t)xdr_from_pmap_signout_rsp, + (xdrproc_t)xdr_pmap_signout_rsp); if (args.brick) free (args.brick);//malloced by xdr diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 168f50444..f21222f88 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -615,7 +615,8 @@ glusterd_handle_defrag_volume_v2 (rpcsvc_request_t *req) out: ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_defrag_vol_rsp_v2); + gf_xdr_serialize_cli_defrag_vol_rsp_v2, + (xdrproc_t)xdr_gf2_cli_defrag_vol_rsp); if (cli_req.volname) free (cli_req.volname);//malloced by xdr @@ -685,7 +686,8 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req) out: ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, - gf_xdr_serialize_cli_defrag_vol_rsp); + gf_xdr_serialize_cli_defrag_vol_rsp, + (xdrproc_t)xdr_gf1_cli_defrag_vol_rsp); if (cli_req.volname) free (cli_req.volname);//malloced by xdr diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index b7d800ffc..29239b324 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -57,6 +57,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, dict_t *ctx = NULL; char *free_ptr = NULL; glusterd_conf_t *conf = NULL; + xdrproc_t xdrproc; GF_ASSERT (THIS); @@ -77,6 +78,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_create_vol_rsp; + xdrproc = (xdrproc_t)xdr_gf1_cli_create_vol_rsp; break; } @@ -92,6 +94,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_start_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_start_vol_rsp; break; } @@ -107,6 +110,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_stop_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_stop_vol_rsp; break; } @@ -122,6 +126,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_delete_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_delete_vol_rsp; break; } @@ -133,6 +138,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, //rsp.volname = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_defrag_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_defrag_vol_rsp; break; } @@ -148,6 +154,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_add_brick_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_add_brick_rsp; break; } @@ -163,6 +170,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.volname = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_remove_brick_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_remove_brick_rsp; break; } @@ -182,6 +190,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.volname = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_replace_brick_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_replace_brick_rsp; break; } @@ -207,6 +216,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_set_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_set_vol_rsp; break; } @@ -223,6 +233,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = "Error while resetting options"; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_reset_vol_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_reset_vol_rsp; break; } @@ -237,6 +248,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_log_filename_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_log_filename_rsp; break; } case GD_OP_LOG_ROTATE: @@ -250,6 +262,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_log_rotate_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_log_rotate_rsp; break; } case GD_OP_SYNC_VOLUME: @@ -263,6 +276,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = ""; cli_rsp = &rsp; sfunc = gf_xdr_from_cli_sync_volume_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_sync_volume_rsp; break; } case GD_OP_GSYNC_SET: @@ -297,6 +311,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, rsp.op_errstr = op_errstr; cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_gsync_set_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_gsync_set_rsp; break; } case GD_OP_RENAME_VOLUME: @@ -323,6 +338,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, free_ptr = rsp.stats_info.stats_info_val; cli_rsp = &rsp; sfunc = gf_xdr_from_cli_stats_volume_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_stats_volume_rsp; break; } @@ -371,6 +387,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, } cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_quota_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_quota_rsp; break; } @@ -386,6 +403,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, cli_rsp = &rsp; sfunc = gf_xdr_serialize_cli_log_level_rsp; + xdrproc = (xdrproc_t) xdr_gf1_cli_log_level_rsp; break; } @@ -398,7 +416,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, } ret = glusterd_submit_reply (req, cli_rsp, NULL, 0, NULL, - sfunc); + sfunc, xdrproc); if (free_ptr) GF_FREE (free_ptr); @@ -1374,7 +1392,8 @@ glusterd3_1_probe (call_frame_t *frame, xlator_t *this, ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, GD_MGMT_PROBE_QUERY, NULL, gd_xdr_from_mgmt_probe_req, - this, glusterd3_1_probe_cbk); + this, glusterd3_1_probe_cbk, + (xdrproc_t)xdr_gd1_mgmt_probe_req); out: if (req.hostname) @@ -1427,7 +1446,8 @@ glusterd3_1_friend_add (call_frame_t *frame, xlator_t *this, ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, GD_MGMT_FRIEND_ADD, NULL, gd_xdr_from_mgmt_friend_req, - this, glusterd3_1_friend_add_cbk); + this, glusterd3_1_friend_add_cbk, + (xdrproc_t)xdr_gd1_mgmt_friend_req); out: @@ -1469,7 +1489,8 @@ glusterd3_1_friend_remove (call_frame_t *frame, xlator_t *this, ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, GD_MGMT_FRIEND_REMOVE, NULL, gd_xdr_from_mgmt_friend_req, - this, glusterd3_1_friend_remove_cbk); + this, glusterd3_1_friend_remove_cbk, + (xdrproc_t)xdr_gd1_mgmt_friend_req); out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); @@ -1515,7 +1536,8 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_FRIEND_UPDATE, NULL, gd_xdr_from_mgmt_friend_update, - this, glusterd3_1_friend_update_cbk); + this, glusterd3_1_friend_update_cbk, + (xdrproc_t)xdr_gd1_mgmt_friend_update); out: if (req.friends.friends_val) @@ -1553,7 +1575,8 @@ glusterd3_1_cluster_lock (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_CLUSTER_LOCK, NULL, gd_xdr_from_mgmt_cluster_lock_req, - this, glusterd3_1_cluster_lock_cbk); + this, glusterd3_1_cluster_lock_cbk, + (xdrproc_t)xdr_gd1_mgmt_cluster_lock_req); out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1587,7 +1610,8 @@ glusterd3_1_cluster_unlock (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_CLUSTER_UNLOCK, NULL, gd_xdr_from_mgmt_cluster_unlock_req, - this, glusterd3_1_cluster_unlock_cbk); + this, glusterd3_1_cluster_unlock_cbk, + (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_req); out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1646,7 +1670,8 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_STAGE_OP, NULL, gd_xdr_from_mgmt_stage_op_req, - this, glusterd3_1_stage_op_cbk); + this, glusterd3_1_stage_op_cbk, + (xdrproc_t)xdr_gd1_mgmt_stage_op_req); out: if ((_gf_true == is_alloc) && req.buf.buf_val) @@ -1708,7 +1733,8 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this, peerinfo->mgmt, GD_MGMT_COMMIT_OP, NULL, gd_xdr_from_mgmt_commit_op_req, - this, glusterd3_1_commit_op_cbk); + this, glusterd3_1_commit_op_cbk, + (xdrproc_t)xdr_gd1_mgmt_commit_op_req); out: if ((_gf_true == is_alloc) && req.buf.buf_val) @@ -1937,7 +1963,8 @@ glusterd3_1_brick_op (call_frame_t *frame, xlator_t *this, &glusterd_glusterfs_3_1_mgmt_prog, req->op, NULL, gd_xdr_from_mgmt_brick_op_req, - this, glusterd3_1_brick_op_cbk); + this, glusterd3_1_brick_op_cbk, + (xdrproc_t)xdr_gd1_mgmt_brick_op_req); if (req) { if (req->input.input_val) GF_FREE (req->input.input_val); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 56e03e662..73c9ffb02 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -307,18 +307,20 @@ glusterd_submit_request (struct rpc_clnt *rpc, void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, gd_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn) + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc) { int ret = -1; struct iobuf *iobuf = NULL; int count = 0; char new_iobref = 0, start_ping = 0; struct iovec iov = {0, }; + ssize_t req_size = 0; GF_ASSERT (rpc); GF_ASSERT (this); - iobuf = iobuf_get (this->ctx->iobuf_pool); + req_size = xdr_sizeof (xdrproc, req); + iobuf = iobuf_get2 (this->ctx->iobuf_pool, req_size); if (!iobuf) { goto out; }; @@ -335,7 +337,7 @@ glusterd_submit_request (struct rpc_clnt *rpc, void *req, iobref_add (iobref, iobuf); iov.iov_base = iobuf->ptr; - iov.iov_len = 128 * GF_UNIT_KB; + iov.iov_len = iobuf_pagesize (iobuf); /* Create the xdr payload */ if (req && sfunc) { @@ -377,15 +379,18 @@ out: struct iobuf * glusterd_serialize_reply (rpcsvc_request_t *req, void *arg, - gd_serialize_t sfunc, struct iovec *outmsg) + gd_serialize_t sfunc, struct iovec *outmsg, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; ssize_t retlen = -1; + ssize_t rsp_size = 0; /* First, get the io buffer into which the reply in arg will * be serialized. */ - iob = iobuf_get (req->svc->ctx->iobuf_pool); + rsp_size = xdr_sizeof (xdrproc, arg); + iob = iobuf_get2 (req->svc->ctx->iobuf_pool, rsp_size); if (!iob) { gf_log ("", GF_LOG_ERROR, "Failed to get iobuf"); goto ret; @@ -417,7 +422,8 @@ ret: int glusterd_submit_reply (rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gd_serialize_t sfunc) + struct iobref *iobref, gd_serialize_t sfunc, + xdrproc_t xdrproc) { struct iobuf *iob = NULL; int ret = -1; @@ -440,7 +446,7 @@ glusterd_submit_reply (rpcsvc_request_t *req, void *arg, new_iobref = 1; } - iob = glusterd_serialize_reply (req, arg, sfunc, &rsp); + iob = glusterd_serialize_reply (req, arg, sfunc, &rsp, xdrproc); if (!iob) { gf_log ("", GF_LOG_ERROR, "Failed to serialize reply"); } else { diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 254557c27..760bb6b97 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -69,14 +69,15 @@ glusterd_get_uuid (uuid_t *uuid); int glusterd_submit_reply (rpcsvc_request_t *req, void *arg, struct iovec *payload, int payloadcount, - struct iobref *iobref, gd_serialize_t sfunc); + struct iobref *iobref, gd_serialize_t sfunc, + xdrproc_t xdrproc); int glusterd_submit_request (struct rpc_clnt *rpc, void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, gd_serialize_t sfunc, xlator_t *this, - fop_cbk_fn_t cbkfn); + fop_cbk_fn_t cbkfn, xdrproc_t xdrproc); int32_t glusterd_volinfo_new (glusterd_volinfo_t **volinfo); -- cgit