diff options
author | Kaushal M <kaushal@gluster.com> | 2011-09-06 17:18:20 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-19 22:00:25 -0700 |
commit | 8d4d8088c73f2ffc60b8e5c23a33e6b996fb5053 (patch) | |
tree | df5e6dc68206c72ad1cb3f8b664f50028d725a8b /cli/src/cli-cmd.c | |
parent | e0178776546f06646c11bcb1ea345f82436d73aa (diff) |
glusterd: run 'volume top read-perf/write-perf' in different thread
Runs the 'volume top read-perf/write-perf' operations in a different
thread without blocking glusterd. Prvents glusterd from being
unresponsive when large values of 'bs' and 'count' are given.
Also increase cli timeout for top/profile commands , from 120s to 300s
to allow large i/o top read-perf and write-perf to return result.
Change-Id: I4b7de1d735f33643d836772db7f25133f112b75a
BUG: 2720
Reviewed-on: http://review.gluster.com/375
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <shishirng@gluster.com>
Diffstat (limited to 'cli/src/cli-cmd.c')
-rw-r--r-- | cli/src/cli-cmd.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index 385e2ac2e1c..17869eb613d 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -31,6 +31,7 @@ #include "cli.h" #include "cli-cmd.h" #include "cli-mem-types.h" +#include "protocol-common.h" #include <fnmatch.h> @@ -281,14 +282,14 @@ seconds_from_now (unsigned secs, struct timespec *ts) } int -cli_cmd_await_response () +cli_cmd_await_response (unsigned time) { struct timespec ts = {0,}; int ret = 0; cli_op_ret = -1; - seconds_from_now (CLI_DEFAULT_CMD_TIMEOUT, &ts); + seconds_from_now (time, &ts); while (!cmd_done && !ret) { ret = pthread_cond_timedwait (&cond, &cond_mutex, &ts); @@ -366,7 +367,11 @@ cli_cmd_submit (void *req, call_frame_t *frame, int procnum, struct iobref *iobref, xlator_t *this, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc) { - int ret = -1; + int ret = -1; + unsigned timeout = 0; + + timeout = (GLUSTER_CLI_PROFILE_VOLUME == procnum) ? + CLI_TOP_CMD_TIMEOUT : CLI_DEFAULT_CMD_TIMEOUT; cli_cmd_lock (); cmd_sent = 0; @@ -375,7 +380,7 @@ cli_cmd_submit (void *req, call_frame_t *frame, if (!ret) { cmd_sent = 1; - ret = cli_cmd_await_response (); + ret = cli_cmd_await_response (timeout); } else cli_cmd_unlock (); |