summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-07-29 16:36:27 +0530
committerAnand Avati <avati@gluster.com>2011-07-31 23:15:32 -0700
commitdf0a72d9c118c2a1146f2787eee6d5f0a58853f0 (patch)
treefc6eb998d3e3965610aef473a1f6b3e46cf2fb7c /cli/src
parent76acac485b9f06f36d145b4c31fa6f4da3c70f52 (diff)
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 <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd.c4
-rw-r--r--cli/src/cli-cmd.h2
-rw-r--r--cli/src/cli-rpc-ops.c87
-rw-r--r--cli/src/cli.c8
-rw-r--r--cli/src/cli.h2
5 files changed, 65 insertions, 38 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index 1d98ecc7a36..2b5b8f20dc7 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -365,7 +365,7 @@ cli_cmd_submit (void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog,
int procnum, struct iobref *iobref,
cli_serialize_t sfunc, xlator_t *this,
- fop_cbk_fn_t cbkfn)
+ fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
{
int ret = -1;
@@ -373,7 +373,7 @@ cli_cmd_submit (void *req, call_frame_t *frame,
cmd_sent = 0;
ret = cli_submit_request (req, frame, prog,
procnum, NULL, sfunc,
- this, cbkfn);
+ this, cbkfn, xdrproc);
if (!ret) {
cmd_sent = 1;
diff --git a/cli/src/cli-cmd.h b/cli/src/cli-cmd.h
index acb40017a5b..cc6c11c4747 100644
--- a/cli/src/cli-cmd.h
+++ b/cli/src/cli-cmd.h
@@ -84,7 +84,7 @@ cli_cmd_submit (void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog,
int procnum, struct iobref *iobref,
cli_serialize_t sfunc, xlator_t *this,
- fop_cbk_fn_t cbkfn);
+ fop_cbk_fn_t cbkfn, xdrproc_t xdrproc);
gf_answer_t
cli_cmd_get_confirmation (struct cli_state *state, const char *question);
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 1782b9bac8f..cec85dad748 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1601,7 +1601,8 @@ gf_cli3_1_probe (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_PROBE, NULL, gf_xdr_from_cli_probe_req,
- this, gf_cli3_1_probe_cbk);
+ this, gf_cli3_1_probe_cbk,
+ (xdrproc_t)xdr_gf1_cli_probe_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1638,7 +1639,8 @@ gf_cli3_1_deprobe (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_DEPROBE, NULL,
gf_xdr_from_cli_deprobe_req,
- this, gf_cli3_1_deprobe_cbk);
+ this, gf_cli3_1_deprobe_cbk,
+ (xdrproc_t)xdr_gf1_cli_deprobe_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1662,7 +1664,8 @@ gf_cli3_1_list_friends (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_LIST_FRIENDS, NULL,
gf_xdr_from_cli_peer_list_req,
- this, gf_cli3_1_list_friends_cbk);
+ this, gf_cli3_1_list_friends_cbk,
+ (xdrproc_t) xdr_gf1_cli_peer_list_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1741,7 +1744,8 @@ gf_cli3_1_get_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_GET_VOLUME, NULL,
gf_xdr_from_cli_get_vol_req,
- this, gf_cli3_1_get_volume_cbk);
+ this, gf_cli3_1_get_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_get_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1798,7 +1802,8 @@ gf_cli3_1_create_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_CREATE_VOLUME, NULL,
gf_xdr_from_cli_create_vol_req,
- this, gf_cli3_1_create_volume_cbk);
+ this, gf_cli3_1_create_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_create_vol_req);
@@ -1840,7 +1845,8 @@ gf_cli3_1_delete_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_DELETE_VOLUME, NULL,
gf_xdr_from_cli_delete_vol_req,
- this, gf_cli3_1_delete_volume_cbk);
+ this, gf_cli3_1_delete_volume_cbk,
+ (xdrproc_t)xdr_gf1_cli_delete_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1873,7 +1879,8 @@ gf_cli3_1_start_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (req, frame, cli_rpc_prog,
GLUSTER_CLI_START_VOLUME, NULL,
gf_xdr_from_cli_start_vol_req,
- this, gf_cli3_1_start_volume_cbk);
+ this, gf_cli3_1_start_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_start_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1906,7 +1913,8 @@ gf_cli3_1_stop_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_STOP_VOLUME, NULL,
gf_xdr_from_cli_stop_vol_req,
- this, gf_cli3_1_stop_volume_cbk);
+ this, gf_cli3_1_stop_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_stop_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1980,7 +1988,8 @@ done:
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_DEFRAG_VOLUME, NULL,
gf_xdr_from_cli_defrag_vol_req,
- this, gf_cli3_1_defrag_volume_cbk);
+ this, gf_cli3_1_defrag_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_defrag_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2016,7 +2025,8 @@ gf_cli3_1_rename_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_RENAME_VOLUME, NULL,
gf_xdr_from_cli_rename_vol_req,
- this, gf_cli3_1_rename_volume_cbk);
+ this, gf_cli3_1_rename_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_rename_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2053,11 +2063,11 @@ gf_cli3_1_reset_volume (call_frame_t *frame, xlator_t *this,
goto out;
}
-
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_RESET_VOLUME, NULL,
gf_xdr_from_cli_reset_vol_req,
- this, gf_cli3_1_reset_volume_cbk);
+ this, gf_cli3_1_reset_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_reset_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2094,11 +2104,11 @@ gf_cli3_1_set_volume (call_frame_t *frame, xlator_t *this,
goto out;
}
-
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_SET_VOLUME, NULL,
gf_xdr_from_cli_set_vol_req,
- this, gf_cli3_1_set_volume_cbk);
+ this, gf_cli3_1_set_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_set_vol_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2143,7 +2153,8 @@ gf_cli3_1_add_brick (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_ADD_BRICK, NULL,
gf_xdr_from_cli_add_brick_req,
- this, gf_cli3_1_add_brick_cbk);
+ this, gf_cli3_1_add_brick_cbk,
+ (xdrproc_t) xdr_gf1_cli_add_brick_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2192,7 +2203,8 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_REMOVE_BRICK, NULL,
gf_xdr_from_cli_remove_brick_req,
- this, gf_cli3_1_remove_brick_cbk);
+ this, gf_cli3_1_remove_brick_cbk,
+ (xdrproc_t) xdr_gf1_cli_remove_brick_req);
out:
@@ -2287,7 +2299,8 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_REPLACE_BRICK, NULL,
gf_xdr_from_cli_replace_brick_req,
- this, gf_cli3_1_replace_brick_cbk);
+ this, gf_cli3_1_replace_brick_cbk,
+ (xdrproc_t) xdr_gf1_cli_replace_brick_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2329,7 +2342,8 @@ gf_cli3_1_log_filename (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_LOG_FILENAME, NULL,
gf_xdr_from_cli_log_filename_req,
- this, gf_cli3_1_log_filename_cbk);
+ this, gf_cli3_1_log_filename_cbk,
+ (xdrproc_t) xdr_gf1_cli_log_filename_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2398,7 +2412,8 @@ gf_cli3_1_log_level (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_LOG_LEVEL, NULL,
gf_xdr_from_cli_log_level_req,
- this, gf_cli3_1_log_level_cbk);
+ this, gf_cli3_1_log_level_cbk,
+ (xdrproc_t) xdr_gf1_cli_log_level_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning: %d", ret);
@@ -2432,7 +2447,8 @@ gf_cli3_1_log_locate (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_LOG_LOCATE, NULL,
gf_xdr_from_cli_log_locate_req,
- this, gf_cli3_1_log_locate_cbk);
+ this, gf_cli3_1_log_locate_cbk,
+ (xdrproc_t) xdr_gf1_cli_log_locate_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2466,7 +2482,8 @@ gf_cli3_1_log_rotate (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_LOG_ROTATE, NULL,
gf_xdr_from_cli_log_rotate_req,
- this, gf_cli3_1_log_rotate_cbk);
+ this, gf_cli3_1_log_rotate_cbk,
+ (xdrproc_t) xdr_gf1_cli_log_rotate_req);
out:
@@ -2489,7 +2506,8 @@ gf_cli3_1_sync_volume (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit ((gf1_cli_sync_volume_req*)data, frame,
cli_rpc_prog, GLUSTER_CLI_SYNC_VOLUME,
NULL, gf_xdr_from_cli_sync_volume_req,
- this, gf_cli3_1_sync_volume_cbk);
+ this, gf_cli3_1_sync_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_sync_volume_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2519,7 +2537,8 @@ gf_cli3_1_getspec (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, &cli_handshake_prog,
GF_HNDSK_GETSPEC, NULL,
xdr_from_getspec_req,
- this, gf_cli3_1_getspec_cbk);
+ this, gf_cli3_1_getspec_cbk,
+ (xdrproc_t) xdr_gf_getspec_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2556,11 +2575,11 @@ gf_cli3_1_quota (call_frame_t *frame, xlator_t *this,
goto out;
}
-
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_QUOTA, NULL,
gf_xdr_from_cli_quota_req,
- this, gf_cli3_1_quota_cbk);
+ this, gf_cli3_1_quota_cbk,
+ (xdrproc_t) xdr_gf1_cli_quota_req);
GF_FREE (req.dict.dict_val);
out:
@@ -2588,7 +2607,8 @@ gf_cli3_1_pmap_b2p (call_frame_t *frame, xlator_t *this, void *data)
ret = cli_cmd_submit (&req, frame, &cli_pmap_prog,
GF_PMAP_PORTBYBRICK, NULL,
xdr_from_pmap_port_by_brick_req,
- this, gf_cli3_1_pmap_b2p_cbk);
+ this, gf_cli3_1_pmap_b2p_cbk,
+ (xdrproc_t) xdr_pmap_port_by_brick_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2702,7 +2722,8 @@ gf_cli3_1_fsm_log (call_frame_t *frame, xlator_t *this, void *data)
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_FSM_LOG, NULL,
gf_xdr_from_cli_fsm_log_req,
- this, gf_cli3_1_fsm_log_cbk);
+ this, gf_cli3_1_fsm_log_cbk,
+ (xdrproc_t) xdr_gf1_cli_fsm_log_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -2917,7 +2938,8 @@ gf_cli3_1_gsync_set (call_frame_t *frame, xlator_t *this,
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_GSYNC_SET, NULL,
gf_xdr_from_cli_gsync_set_req,
- this, gf_cli3_1_gsync_set_cbk);
+ this, gf_cli3_1_gsync_set_cbk,
+ (xdrproc_t) xdr_gf1_cli_gsync_set_req);
out:
return ret;
@@ -3263,7 +3285,8 @@ gf_cli3_1_profile_volume (call_frame_t *frame, xlator_t *this, void *data)
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_PROFILE_VOLUME, NULL,
gf_xdr_from_cli_stats_volume_req,
- this, gf_cli3_1_profile_volume_cbk);
+ this, gf_cli3_1_profile_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_stats_volume_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -3478,7 +3501,8 @@ gf_cli3_1_top_volume (call_frame_t *frame, xlator_t *this, void *data)
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_PROFILE_VOLUME, NULL,
gf_xdr_from_cli_stats_volume_req,
- this, gf_cli3_1_top_volume_cbk);
+ this, gf_cli3_1_top_volume_cbk,
+ (xdrproc_t) xdr_gf1_cli_stats_volume_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
@@ -3529,7 +3553,8 @@ gf_cli3_1_getwd (call_frame_t *frame, xlator_t *this, void *data)
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_GETWD, NULL,
gf_xdr_from_cli_getwd_req,
- this, gf_cli3_1_getwd_cbk);
+ this, gf_cli3_1_getwd_cbk,
+ (xdrproc_t) xdr_gf1_cli_getwd_req);
out:
gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret);
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 8a06c8abd76..0e904a15e45 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -266,7 +266,7 @@ cli_submit_request (void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog,
int procnum, struct iobref *iobref,
cli_serialize_t sfunc, xlator_t *this,
- fop_cbk_fn_t cbkfn)
+ fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
{
int ret = -1;
int count = 0;
@@ -274,10 +274,12 @@ cli_submit_request (void *req, call_frame_t *frame,
struct iovec iov = {0, };
struct iobuf *iobuf = NULL;
char new_iobref = 0;
+ ssize_t xdr_size = 0;
GF_ASSERT (this);
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+ xdr_size = xdr_sizeof (xdrproc, req);
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size);
if (!iobuf) {
goto out;
};
@@ -294,7 +296,7 @@ cli_submit_request (void *req, call_frame_t *frame,
iobref_add (iobref, iobuf);
iov.iov_base = iobuf->ptr;
- iov.iov_len = 128 * GF_UNIT_KB;
+ iov.iov_len = iobuf_size (iobuf);
/* Create the xdr payload */
diff --git a/cli/src/cli.h b/cli/src/cli.h
index ae4ebe7d99a..8919390b1da 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -182,7 +182,7 @@ cli_submit_request (void *req, call_frame_t *frame,
rpc_clnt_prog_t *prog,
int procnum, struct iobref *iobref,
cli_serialize_t sfunc, xlator_t *this,
- fop_cbk_fn_t cbkfn);
+ fop_cbk_fn_t cbkfn, xdrproc_t xdrproc);
int32_t
cli_cmd_volume_create_parse (const char **words, int wordcount,