summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-02-17 12:32:18 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-21 02:48:57 -0800
commite311a30f845255b44f3abc56215f584a3c245136 (patch)
treedba503a01a4029277d88c76c92941c6f08ece25f
parent0ef7e763c85c045ef7937d0ca02d8c5f0333e6e8 (diff)
cli, glusterfsd: Fixes for "volume top {read,write}-perf"
Changed variables to use unsigned types, to support larger comninations of block_size * block_count Also increases cli time out for "volume top" ops to 600, to allow more time for glusterd to return the results to cli. Change-Id: I4b953799c78a5a184311f6f8c4a7a99dc9e87a07 BUG: 783980 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.com/2761 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--cli/src/cli-cmd-parser.c12
-rw-r--r--cli/src/cli.h2
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c28
-rw-r--r--glusterfsd/src/glusterfsd.h4
4 files changed, 23 insertions, 23 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 00c2f3618..24310cac5 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1692,8 +1692,8 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
int32_t list_cnt = -1;
int index = 0;
int perf = 0;
- int32_t blk_size = 0;
- int32_t count = 0;
+ uint32_t blk_size = 0;
+ uint32_t count = 0;
char *delimiter = NULL;
char *opwords[] = { "open", "read", "write", "opendir",
"readdir", "read-perf", "write-perf",
@@ -1759,7 +1759,7 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
}
if (!strcmp (key, "brick")) {
delimiter = strchr (value, ':');
- if (!delimiter || delimiter == value
+ if (!delimiter || delimiter == value
|| *(delimiter+1) != '/') {
cli_out ("wrong brick type: %s, use <HOSTNAME>:"
"<export-dir-abs-path>", value);
@@ -1794,7 +1794,7 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
ret = -1;
goto out;
}
- ret = dict_set_int32 (dict, "blk-size", blk_size);
+ ret = dict_set_uint32 (dict, "blk-size", blk_size);
} else if (perf && !strcmp (key, "count")) {
ret = gf_is_str_int (value);
if (!ret)
@@ -1802,14 +1802,14 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
if (ret || (count <= 0)) {
if (count < 0)
cli_out ("count is an invalid number");
- else
+ else
cli_out ("count should be an integer "
"greater than zero");
ret = -1;
goto out;
}
- ret = dict_set_int32 (dict, "blk-cnt", count);
+ ret = dict_set_uint32 (dict, "blk-cnt", count);
} else {
ret = -1;
goto out;
diff --git a/cli/src/cli.h b/cli/src/cli.h
index 1f78da1fb..8080e42d6 100644
--- a/cli/src/cli.h
+++ b/cli/src/cli.h
@@ -33,7 +33,7 @@
#define CLI_GLUSTERD_PORT 24007
#define CLI_DEFAULT_CONN_TIMEOUT 120
#define CLI_DEFAULT_CMD_TIMEOUT 120
-#define CLI_TOP_CMD_TIMEOUT 300 //Longer timeout for volume top
+#define CLI_TOP_CMD_TIMEOUT 600 //Longer timeout for volume top
#define DEFAULT_CLI_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
#define CLI_VOL_STATUS_BRICK_LEN 55
#define CLI_TAB_LENGTH 8
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index de6e2d60c..e41653faf 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -359,9 +359,9 @@ glusterfs_handle_translator_info_get (rpcsvc_request_t *req)
gd1_mgmt_brick_op_req xlator_req = {0,};
dict_t *dict = NULL;
xlator_t *this = NULL;
- gf1_cli_top_op top_op = 0;
- int32_t blk_size = 0;
- int32_t blk_count = 0;
+ gf1_cli_top_op top_op = 0;
+ uint32_t blk_size = 0;
+ uint32_t blk_count = 0;
gfd_vol_top_priv_t *priv = NULL;
pthread_t tid = -1;
@@ -398,10 +398,10 @@ glusterfs_handle_translator_info_get (rpcsvc_request_t *req)
ret = dict_get_int32 (dict, "top-op", (int32_t *)&top_op);
if ((!ret) && (GF_CLI_TOP_READ_PERF == top_op ||
GF_CLI_TOP_WRITE_PERF == top_op)) {
- ret = dict_get_int32 (dict, "blk-size", &blk_size);
+ ret = dict_get_uint32 (dict, "blk-size", &blk_size);
if (ret)
goto cont;
- ret = dict_get_int32 (dict, "blk-cnt", &blk_count);
+ ret = dict_get_uint32 (dict, "blk-cnt", &blk_count);
if (ret)
goto cont;
priv->blk_size = blk_size;
@@ -441,11 +441,11 @@ glusterfs_volume_top_write_perf (void *args)
int32_t input_fd = -1;
char export_path[PATH_MAX];
char *buf = NULL;
- int32_t blk_size = 0;
- int32_t blk_count = 0;
+ uint32_t blk_size = 0;
+ uint32_t blk_count = 0;
int32_t iter = 0;
int32_t ret = -1;
- int64_t total_blks = 0;
+ uint64_t total_blks = 0;
struct timeval begin, end = {0,};
double throughput = 0;
double time = 0;
@@ -495,7 +495,7 @@ glusterfs_volume_top_write_perf (void *args)
total_blks += ret;
}
ret = 0;
- if (total_blks != (blk_size * blk_count)) {
+ if (total_blks != ((uint64_t)blk_size * blk_count)) {
gf_log ("glusterd", GF_LOG_WARNING, "Error in write");
ret = -1;
goto out;
@@ -533,11 +533,11 @@ glusterfs_volume_top_read_perf (void *args)
int32_t output_fd = -1;
char export_path[PATH_MAX];
char *buf = NULL;
- int32_t blk_size = 0;
- int32_t blk_count = 0;
+ uint32_t blk_size = 0;
+ uint32_t blk_count = 0;
int32_t iter = 0;
int32_t ret = -1;
- int64_t total_blks = 0;
+ uint64_t total_blks = 0;
struct timeval begin, end = {0,};
double throughput = 0;
double time = 0;
@@ -619,9 +619,9 @@ glusterfs_volume_top_read_perf (void *args)
total_blks += ret;
}
ret = 0;
- if ((blk_size * blk_count) != total_blks) {
+ if (total_blks != ((uint64_t)blk_size * blk_count)) {
ret = -1;
- gf_log ("glusterd", GF_LOG_WARNING, "Error in write");
+ gf_log ("glusterd", GF_LOG_WARNING, "Error in read");
goto out;
}
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index 0e68f7f0e..3c38fbef0 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -85,8 +85,8 @@ enum argp_option_keys {
struct _gfd_vol_top_priv_t {
rpcsvc_request_t *req;
gd1_mgmt_brick_op_req xlator_req;
- int32_t blk_count;
- int32_t blk_size;
+ uint32_t blk_count;
+ uint32_t blk_size;
double throughput;
double time;
int32_t ret;