diff options
author | Avra Sengupta <asengupt@redhat.com> | 2013-02-08 17:31:11 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-16 20:41:11 -0800 |
commit | 86854a544e5bcc05bf6a57b7b622c48ddafc79b5 (patch) | |
tree | aacff5ffdc259aaf3c10b6ca3d7a1c7e1dc2e16b /xlators/mgmt/glusterd | |
parent | 99fe09f4fa805ea23848c1ec56088ec1435e9015 (diff) |
glusterd: Made volume-quota use synctask framework.
Change-Id: I4c275253144ed3ac11a701a56dd1116c002471ba
BUG: 852147
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4495
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 26 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 2 |
6 files changed, 16 insertions, 22 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 29c03d6961e..3c51879d921 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3834,7 +3834,7 @@ glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr, break; case GD_OP_QUOTA: - ret = glusterd_op_quota (dict, op_errstr); + ret = glusterd_op_quota (dict, op_errstr, rsp_dict); break; case GD_OP_STATUS_VOLUME: diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 09c4273df4a..e049982a2f1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -99,12 +99,9 @@ glusterd_handle_quota (rpcsvc_request_t *req) strncpy (operation, "remove", sizeof (operation)); break; } - ret = glusterd_op_begin (req, GD_OP_QUOTA, dict, msg, sizeof (msg)); + ret = glusterd_op_begin_synctask (req, GD_OP_QUOTA, dict); out: - glusterd_friend_sm (); - glusterd_op_sm (); - if (ret) { if (msg[0] == '\0') snprintf (msg, sizeof (msg), "Operation failed"); @@ -379,18 +376,17 @@ glusterd_quota_get_limit_usages (glusterd_conf_t *priv, glusterd_volinfo_t *volinfo, char *volname, dict_t *dict, - char **op_errstr) + char **op_errstr, + dict_t *rsp_dict) { int32_t i = 0; int32_t ret = 0; int32_t count = 0; char *path = NULL; - dict_t *ctx = NULL; char cmd_str [1024] = {0, }; char *ret_str = NULL; - ctx = glusterd_op_get_ctx (); - if (ctx == NULL) + if (rsp_dict == NULL) return 0; ret = dict_get_int32 (dict, "count", &count); @@ -414,7 +410,7 @@ glusterd_quota_get_limit_usages (glusterd_conf_t *priv, } if (ret_str) { - ret = dict_set_dynstr (ctx, "limit_list", ret_str); + ret = dict_set_dynstr (rsp_dict, "limit_list", ret_str); } out: return ret; @@ -669,12 +665,11 @@ out: int -glusterd_op_quota (dict_t *dict, char **op_errstr) +glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict) { glusterd_volinfo_t *volinfo = NULL; int32_t ret = -1; char *volname = NULL; - dict_t *ctx = NULL; int type = -1; gf_boolean_t start_crawl = _gf_false; glusterd_conf_t *priv = NULL; @@ -739,7 +734,7 @@ glusterd_op_quota (dict_t *dict, char **op_errstr) } ret = glusterd_quota_get_limit_usages (priv, volinfo, volname, - dict, op_errstr); + dict, op_errstr, rsp_dict); goto out; } @@ -762,12 +757,11 @@ create_vol: ret = 0; out: - ctx = glusterd_op_get_ctx (); - if (ctx && start_crawl == _gf_true) + if (rsp_dict && start_crawl == _gf_true) glusterd_quota_initiate_fs_crawl (priv, volname); - if (ctx && *op_errstr) { - ret = dict_set_dynstr (ctx, "errstr", *op_errstr); + if (rsp_dict && *op_errstr) { + ret = dict_set_dynstr (rsp_dict, "errstr", *op_errstr); if (ret) { GF_FREE (*op_errstr); gf_log ("", GF_LOG_DEBUG, diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 370f454df5c..7aa9ea9ff38 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -595,8 +595,9 @@ glusterd_syncop_aggr_rsp_dict (glusterd_op_t op, dict_t *aggr, dict_t *rsp, break; + case GD_OP_QUOTA: case GD_OP_CLEARLOCKS_VOLUME: - ret = glusterd_volume_clearlocks_use_rsp_dict (aggr, rsp); + ret = glusterd_use_rsp_dict (aggr, rsp); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 093c59ce87a..fa2e9a5314b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -6931,7 +6931,7 @@ out: } int -glusterd_volume_clearlocks_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) +glusterd_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) { int ret = 0; glusterd_op_t op = GD_OP_NONE; @@ -6939,7 +6939,6 @@ glusterd_volume_clearlocks_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) op = glusterd_op_get_op (); GF_ASSERT (aggr); GF_ASSERT (rsp_dict); - GF_ASSERT (GD_OP_CLEARLOCKS_VOLUME == op); if (!aggr) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index b5f005560c2..1f84634582b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -460,7 +460,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); int glusterd_volume_heal_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); int -glusterd_volume_clearlocks_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); +glusterd_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); int32_t glusterd_handle_node_rsp (dict_t *req_ctx, void *pending_entry, glusterd_op_t op, dict_t *rsp_dict, dict_t *op_ctx, diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 41b74a684dd..4af59ef2e44 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -670,7 +670,7 @@ int glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr); int glusterd_op_heal_volume (dict_t *dict, char **op_errstr); int glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr); int glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict); -int glusterd_op_quota (dict_t *dict, char **op_errstr); +int glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict); int glusterd_op_stage_quota (dict_t *dict, char **op_errstr); int glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, dict_t *rsp_dict); |