summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c144
1 files changed, 79 insertions, 65 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 185454f0b1c..8ba77471646 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -72,7 +72,7 @@
} \
} while (0)
-static struct list_head gd_op_sm_queue;
+static struct cds_list_head gd_op_sm_queue;
synclock_t gd_op_sm_lock;
glusterd_op_info_t opinfo = {{0},};
@@ -954,8 +954,11 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
ret = glusterd_validate_reconfopts (volinfo, val_dict, op_errstr);
else if (!all_vol) {
voliter = NULL;
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
- ret = glusterd_validate_globalopts (voliter, val_dict, op_errstr);
+ cds_list_for_each_entry (voliter, &priv->volumes,
+ vol_list) {
+ ret = glusterd_validate_globalopts (voliter,
+ val_dict,
+ op_errstr);
if (ret)
break;
}
@@ -1709,7 +1712,7 @@ glusterd_stop_bricks (glusterd_volinfo_t *volinfo)
{
glusterd_brickinfo_t *brickinfo = NULL;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
/*TODO: Need to change @del_brick in brick_stop to _gf_true
* once we enable synctask in peer rpc prog */
if (glusterd_brick_stop (volinfo, brickinfo, _gf_false))
@@ -1727,7 +1730,7 @@ glusterd_start_bricks (glusterd_volinfo_t *volinfo)
GF_ASSERT (volinfo);
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
ret = glusterd_brick_start (volinfo, brickinfo, _gf_false);
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR,
@@ -2006,12 +2009,14 @@ glusterd_op_set_volume (dict_t *dict)
quorum_action = _gf_true;
if (global_opt) {
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
- value = gf_strdup (value);
- ret = dict_set_dynstr (voliter->dict, key, value);
- if (ret)
- goto out;
- }
+ cds_list_for_each_entry (voliter, &priv->volumes,
+ vol_list) {
+ value = gf_strdup (value);
+ ret = dict_set_dynstr (voliter->dict, key,
+ value);
+ if (ret)
+ goto out;
+ }
} else {
ret = dict_set_dynstr (volinfo->dict, key, value);
if (ret)
@@ -2074,7 +2079,7 @@ glusterd_op_set_volume (dict_t *dict)
}
} else {
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
volinfo = voliter;
gd_update_volume_op_versions (volinfo);
@@ -2174,7 +2179,7 @@ glusterd_op_sync_volume (dict_t *dict, char **op_errstr,
1, "volume");
vol_count = 1;
} else {
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
ret = glusterd_add_volume_to_dict (volinfo, rsp_dict,
count, "volume");
if (ret)
@@ -2674,7 +2679,8 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
goto out;
} else {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
brick_index++;
if (uuid_compare (brickinfo->uuid, MY_UUID))
continue;
@@ -2824,7 +2830,8 @@ glusterd_op_ac_send_lock (glusterd_op_sm_event_t *event, void *ctx)
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (peerinfo, &priv->xaction_peers, op_peers_list) {
+ cds_list_for_each_entry (peerinfo, &priv->xaction_peers,
+ op_peers_list) {
GF_ASSERT (peerinfo);
if (!peerinfo->connected || !peerinfo->mgmt)
@@ -2913,7 +2920,8 @@ glusterd_op_ac_send_unlock (glusterd_op_sm_event_t *event, void *ctx)
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (peerinfo, &priv->xaction_peers, op_peers_list) {
+ cds_list_for_each_entry (peerinfo, &priv->xaction_peers,
+ op_peers_list) {
GF_ASSERT (peerinfo);
if (!peerinfo->connected || !peerinfo->mgmt ||
@@ -3458,7 +3466,8 @@ glusterd_op_ac_send_stage_op (glusterd_op_sm_event_t *event, void *ctx)
if (op == GD_OP_REPLACE_BRICK)
glusterd_rb_use_rsp_dict (NULL, rsp_dict);
- list_for_each_entry (peerinfo, &priv->xaction_peers, op_peers_list) {
+ cds_list_for_each_entry (peerinfo, &priv->xaction_peers,
+ op_peers_list) {
GF_ASSERT (peerinfo);
if (!peerinfo->connected || !peerinfo->mgmt)
@@ -4108,7 +4117,8 @@ glusterd_op_ac_send_commit_op (glusterd_op_sm_event_t *event, void *ctx)
}
- list_for_each_entry (peerinfo, &priv->xaction_peers, op_peers_list) {
+ cds_list_for_each_entry (peerinfo, &priv->xaction_peers,
+ op_peers_list) {
GF_ASSERT (peerinfo);
if (!peerinfo->connected || !peerinfo->mgmt)
@@ -4958,7 +4968,7 @@ glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr,
static int
glusterd_bricks_select_stop_volume (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct cds_list_head *selected)
{
int ret = 0;
int flags = 0;
@@ -4979,7 +4989,7 @@ glusterd_bricks_select_stop_volume (dict_t *dict, char **op_errstr,
goto out;
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (glusterd_is_brick_started (brickinfo)) {
pending_node = GF_CALLOC (1, sizeof (*pending_node),
gf_gld_mt_pending_node_t);
@@ -4989,7 +4999,8 @@ glusterd_bricks_select_stop_volume (dict_t *dict, char **op_errstr,
} else {
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list,
+ selected);
pending_node = NULL;
}
}
@@ -5001,7 +5012,7 @@ out:
static int
glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct cds_list_head *selected)
{
int ret = -1;
char *volname = NULL;
@@ -5064,7 +5075,8 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr,
} else {
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list,
+ selected);
pending_node = NULL;
}
}
@@ -5077,7 +5089,7 @@ out:
static int
glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct cds_list_head *selected)
{
int ret = -1;
char *volname = NULL;
@@ -5142,14 +5154,15 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr,
}
pending_node->node = &(priv->nfs_svc);
pending_node->type = GD_NODE_NFS;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
pending_node = NULL;
ret = 0;
goto out;
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
if (glusterd_is_brick_started (brickinfo)) {
pending_node = GF_CALLOC (1, sizeof (*pending_node),
gf_gld_mt_pending_node_t);
@@ -5159,8 +5172,8 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr,
} else {
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
- list_add_tail (&pending_node->list,
- selected);
+ cds_list_add_tail (&pending_node->list,
+ selected);
pending_node = NULL;
}
}
@@ -5184,7 +5197,7 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr,
}
pending_node->node = &(priv->nfs_svc);
pending_node->type = GD_NODE_NFS;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
pending_node = NULL;
ret = 0;
@@ -5209,14 +5222,15 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr,
} else {
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
- list_add_tail (&pending_node->list,
- selected);
+ cds_list_add_tail (&pending_node->list,
+ selected);
pending_node = NULL;
goto out;
}
}
ret = 0;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
if (glusterd_is_brick_started (brickinfo)) {
pending_node = GF_CALLOC (1, sizeof (*pending_node),
gf_gld_mt_pending_node_t);
@@ -5226,8 +5240,8 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr,
} else {
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
- list_add_tail (&pending_node->list,
- selected);
+ cds_list_add_tail (&pending_node->list,
+ selected);
pending_node = NULL;
}
}
@@ -5297,7 +5311,7 @@ get_replica_index_for_per_replica_cmd (glusterd_volinfo_t *volinfo,
replica_count = volinfo->replica_count;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
if (!strcmp (brickinfo->path, path) &&
@@ -5344,7 +5358,7 @@ _select_rxlators_with_local_bricks (xlator_t *this, glusterd_volinfo_t *volinfo,
index = 1;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
@@ -5395,7 +5409,7 @@ _select_rxlators_for_full_self_heal (xlator_t *this,
priv = this->private;
replica_count = volinfo->replica_count;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
@@ -5420,7 +5434,7 @@ _select_rxlators_for_full_self_heal (xlator_t *this,
static int
glusterd_bricks_select_snap (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct cds_list_head *selected)
{
int ret = -1;
glusterd_conf_t *priv = NULL;
@@ -5446,7 +5460,7 @@ glusterd_bricks_select_snap (dict_t *dict, char **op_errstr,
if (ret)
goto out;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
brick_index++;
if (uuid_compare (brickinfo->uuid, MY_UUID) ||
!glusterd_is_brick_started (brickinfo)) {
@@ -5461,8 +5475,7 @@ glusterd_bricks_select_snap (dict_t *dict, char **op_errstr,
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
pending_node->index = brick_index;
- list_add_tail (&pending_node->list,
- selected);
+ cds_list_add_tail (&pending_node->list, selected);
pending_node = NULL;
}
@@ -5500,7 +5513,7 @@ fill_shd_status_for_local_bricks (dict_t *dict, glusterd_volinfo_t *volinfo,
}
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
@@ -5544,7 +5557,7 @@ out:
static int
glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr,
- struct list_head *selected,
+ struct cds_list_head *selected,
dict_t *rsp_dict)
{
int ret = -1;
@@ -5670,7 +5683,7 @@ glusterd_bricks_select_heal_volume (dict_t *dict, char **op_errstr,
} else {
pending_node->node = &(priv->shd_svc);
pending_node->type = GD_NODE_SHD;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
pending_node = NULL;
}
@@ -5682,7 +5695,7 @@ out:
static int
glusterd_bricks_select_rebalance_volume (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct cds_list_head *selected)
{
int ret = -1;
char *volname = NULL;
@@ -5717,8 +5730,7 @@ glusterd_bricks_select_rebalance_volume (dict_t *dict, char **op_errstr,
} else {
pending_node->node = volinfo;
pending_node->type = GD_NODE_REBALANCE;
- list_add_tail (&pending_node->list,
- &opinfo.pending_bricks);
+ cds_list_add_tail (&pending_node->list, &opinfo.pending_bricks);
pending_node = NULL;
}
@@ -5728,7 +5740,7 @@ out:
static int
glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
- struct list_head *selected)
+ struct cds_list_head *selected)
{
int ret = -1;
int cmd = 0;
@@ -5808,7 +5820,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
pending_node->index = 0;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
ret = 0;
} else if ((cmd & GF_CLI_STATUS_NFS) != 0) {
@@ -5827,7 +5839,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
pending_node->node = &(priv->nfs_svc);
pending_node->type = GD_NODE_NFS;
pending_node->index = 0;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
ret = 0;
} else if ((cmd & GF_CLI_STATUS_SHD) != 0) {
@@ -5846,7 +5858,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
pending_node->node = &(priv->shd_svc);
pending_node->type = GD_NODE_SHD;
pending_node->index = 0;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
ret = 0;
} else if ((cmd & GF_CLI_STATUS_QUOTAD) != 0) {
@@ -5865,7 +5877,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
pending_node->node = &(priv->quotad_svc);
pending_node->type = GD_NODE_QUOTAD;
pending_node->index = 0;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
ret = 0;
} else if ((cmd & GF_CLI_STATUS_SNAPD) != 0) {
@@ -5887,11 +5899,12 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
pending_node->node = (void *)(&volinfo->snapd);
pending_node->type = GD_NODE_SNAPD;
pending_node->index = 0;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
ret = 0;
} else {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
brick_index++;
if (uuid_compare (brickinfo->uuid, MY_UUID) ||
!glusterd_is_brick_started (brickinfo)) {
@@ -5908,7 +5921,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
pending_node->index = brick_index;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
pending_node = NULL;
}
}
@@ -5921,7 +5934,7 @@ out:
* and are running
*/
static int
-glusterd_bricks_select_barrier (dict_t *dict, struct list_head *selected)
+glusterd_bricks_select_barrier (dict_t *dict, struct cds_list_head *selected)
{
int ret = -1;
char *volname = NULL;
@@ -5944,7 +5957,7 @@ glusterd_bricks_select_barrier (dict_t *dict, struct list_head *selected)
goto out;
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (uuid_compare (brickinfo->uuid, MY_UUID) ||
!glusterd_is_brick_started (brickinfo)) {
continue;
@@ -5957,7 +5970,7 @@ glusterd_bricks_select_barrier (dict_t *dict, struct list_head *selected)
}
pending_node->node = brickinfo;
pending_node->type = GD_NODE_BRICK;
- list_add_tail (&pending_node->list, selected);
+ cds_list_add_tail (&pending_node->list, selected);
pending_node = NULL;
}
@@ -6079,7 +6092,7 @@ out:
int32_t
glusterd_op_bricks_select (glusterd_op_t op, dict_t *dict, char **op_errstr,
- struct list_head *selected, dict_t *rsp_dict)
+ struct cds_list_head *selected, dict_t *rsp_dict)
{
int ret = 0;
@@ -6439,7 +6452,7 @@ glusterd_op_sm_new_event (glusterd_op_sm_event_type_t event_type,
*new_event = event;
event->event = event_type;
- INIT_LIST_HEAD (&event->list);
+ CDS_INIT_LIST_HEAD (&event->list);
return 0;
}
@@ -6466,7 +6479,7 @@ glusterd_op_sm_inject_event (glusterd_op_sm_event_type_t event_type,
gf_log (THIS->name, GF_LOG_DEBUG, "Enqueue event: '%s'",
glusterd_op_sm_event_name_get (event->event));
- list_add_tail (&event->list, &gd_op_sm_queue);
+ cds_list_add_tail (&event->list, &gd_op_sm_queue);
out:
return ret;
@@ -6537,11 +6550,12 @@ glusterd_op_sm ()
goto lock_failed;
}
- while (!list_empty (&gd_op_sm_queue)) {
+ while (!cds_list_empty (&gd_op_sm_queue)) {
- list_for_each_entry_safe (event, tmp, &gd_op_sm_queue, list) {
+ cds_list_for_each_entry_safe (event, tmp, &gd_op_sm_queue,
+ list) {
- list_del_init (&event->list);
+ cds_list_del_init (&event->list);
event_type = event->event;
gf_log (this->name, GF_LOG_DEBUG, "Dequeued event of "
"type: '%s'",
@@ -6714,7 +6728,7 @@ glusterd_op_get_ctx ()
int
glusterd_op_sm_init ()
{
- INIT_LIST_HEAD (&gd_op_sm_queue);
+ CDS_INIT_LIST_HEAD (&gd_op_sm_queue);
synclock_init (&gd_op_sm_lock);
return 0;
}