summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c19
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-conn-helper.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c45
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c19
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-log-ops.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c144
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.c51
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c27
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.h14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapd-svc.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c90
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c185
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c62
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c53
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.h28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c202
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c18
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h38
35 files changed, 631 insertions, 540 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 7673fa83433..fd4618bb78c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -74,14 +74,14 @@ add_brick_at_right_order (glusterd_brickinfo_t *brickinfo,
insert_brick:
i = 0;
- list_for_each_entry (brick, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brick, &volinfo->bricks, brick_list) {
i++;
if (i < idx)
continue;
gf_log (THIS->name, GF_LOG_DEBUG, "brick:%s index=%d, count=%d",
brick->path, idx, count);
- list_add (&brickinfo->brick_list, &brick->brick_list);
+ cds_list_add (&brickinfo->brick_list, &brick->brick_list);
break;
}
@@ -581,7 +581,7 @@ subvol_matcher_update (int *subvols, glusterd_volinfo_t *volinfo,
int32_t sub_volume = 0;
int pos = 0;
- list_for_each_entry (tmp, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (tmp, &volinfo->bricks, brick_list) {
if (strcmp (tmp->hostname, brickinfo->hostname) ||
strcmp (tmp->path, brickinfo->path)) {
@@ -1085,7 +1085,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
add_brick_at_right_order (brickinfo, volinfo, (i - 1),
stripe_count, replica_count);
} else {
- list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
+ cds_list_add_tail (&brickinfo->brick_list,
+ &volinfo->bricks);
}
brick = strtok_r (NULL, " \n", &saveptr);
i++;
@@ -1707,7 +1708,8 @@ glusterd_remove_brick_migrate_cbk (glusterd_volinfo_t *volinfo,
break;
case GF_DEFRAG_STATUS_STOPPED:
/* Fall back to the old volume file */
- list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
if (!brickinfo->decommissioned)
continue;
brickinfo->decommissioned = 0;
@@ -1717,7 +1719,8 @@ glusterd_remove_brick_migrate_cbk (glusterd_volinfo_t *volinfo,
case GF_DEFRAG_STATUS_COMPLETE:
/* Done with the task, you can remove the brick from the
volume file */
- list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
if (!brickinfo->decommissioned)
continue;
gf_log (THIS->name, GF_LOG_INFO, "removing the brick %s",
@@ -1909,8 +1912,8 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
case GF_OP_CMD_STOP:
{
/* Fall back to the old volume file */
- list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
if (!brickinfo->decommissioned)
continue;
brickinfo->decommissioned = 0;
diff --git a/xlators/mgmt/glusterd/src/glusterd-conn-helper.c b/xlators/mgmt/glusterd/src/glusterd-conn-helper.c
index 43c95c3a386..bfa9d02aa1b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-conn-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-conn-helper.c
@@ -11,8 +11,11 @@
#include "glusterd-conn-mgmt.h"
#include "glusterd-svc-mgmt.h"
+#define _LGPL_SOURCE
+#include <urcu/rculist.h>
+
glusterd_svc_t *
glusterd_conn_get_svc_object (glusterd_conn_t *conn)
{
- return list_entry (conn, glusterd_svc_t, conn);
+ return cds_list_entry (conn, glusterd_svc_t, conn);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 797850743bb..5efd232554e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -3640,7 +3640,7 @@ fetch_data:
if (ret)
gsync_count = 0;
- 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))
continue;
@@ -4056,7 +4056,7 @@ glusterd_get_gsync_status_all (dict_t *rsp_dict, char *node)
GF_ASSERT (priv);
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
ret = glusterd_get_gsync_status_mst (volinfo, rsp_dict, node);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 8ba16b7a804..eaa05969656 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -465,7 +465,7 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo,
}
#endif
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
char brick[1024] = {0,};
char brick_uuid[64] = {0,};
snprintf (key, 256, "volume%d.brick%d", count, i);
@@ -609,7 +609,7 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx,
local_locking_done:
- INIT_LIST_HEAD (&priv->xaction_peers);
+ CDS_INIT_LIST_HEAD (&priv->xaction_peers);
npeers = gd_build_peers_list (&priv->peers, &priv->xaction_peers, op);
@@ -1162,8 +1162,8 @@ __glusterd_handle_cli_deprobe (rpcsvc_request_t *req)
* detached. It's not a problem if a volume contains none or all
* of its bricks on the peer being detached
*/
- list_for_each_entry_safe (volinfo, tmp, &priv->volumes,
- vol_list) {
+ cds_list_for_each_entry_safe (volinfo, tmp, &priv->volumes,
+ vol_list) {
ret = glusterd_friend_contains_vol_bricks (volinfo,
uuid);
if (ret == 1) {
@@ -1379,7 +1379,7 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
*/
ret = -1;
// Do not allow peer reset if there are any volumes in the cluster
- if (!list_empty (&priv->volumes)) {
+ if (!cds_list_empty (&priv->volumes)) {
snprintf (msg_str, sizeof (msg_str), "volumes are already "
"present in the cluster. Resetting uuid is not "
"allowed");
@@ -1388,7 +1388,7 @@ __glusterd_handle_cli_uuid_reset (rpcsvc_request_t *req)
}
// Do not allow peer reset if trusted storage pool is already formed
- if (!list_empty (&priv->peers)) {
+ if (!cds_list_empty (&priv->peers)) {
snprintf (msg_str, sizeof (msg_str),"trusted storage pool "
"has been already formed. Please detach this peer "
"from the pool and reset its uuid.");
@@ -1550,7 +1550,7 @@ __glusterd_handle_cli_list_volume (rpcsvc_request_t *req)
if (!dict)
goto out;
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "volume%d", count);
ret = dict_set_str (dict, key, volinfo->volname);
@@ -2550,7 +2550,7 @@ __glusterd_handle_probe_query (rpcsvc_request_t *req)
goto out;
}
peerinfo = glusterd_peerinfo_find (probe_req.uuid, remote_hostname);
- if ((peerinfo == NULL) && (!list_empty (&conf->peers))) {
+ if ((peerinfo == NULL) && (!cds_list_empty (&conf->peers))) {
rsp.op_ret = -1;
rsp.op_errno = GF_PROBE_ANOTHER_CLUSTER;
} else if (peerinfo == NULL) {
@@ -3079,7 +3079,7 @@ glusterd_friend_add (const char *hoststr, int port,
* invalid peer name). That would mean we're adding something that had
* just been free, and we're likely to crash later.
*/
- list_add_tail (&(*friend)->uuid_list, &conf->peers);
+ cds_list_add_tail (&(*friend)->uuid_list, &conf->peers);
//restore needs to first create the list of peers, then create rpcs
//to keep track of quorum in race-free manner. In restore for each peer
@@ -3132,7 +3132,7 @@ glusterd_friend_add_from_peerinfo (glusterd_peerinfo_t *friend,
* invalid peer name). That would mean we're adding something that had
* just been free, and we're likely to crash later.
*/
- list_add_tail (&friend->uuid_list, &conf->peers);
+ cds_list_add_tail (&friend->uuid_list, &conf->peers);
//restore needs to first create the list of peers, then create rpcs
//to keep track of quorum in race-free manner. In restore for each peer
@@ -3590,8 +3590,8 @@ glusterd_list_friends (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
gf_log ("", GF_LOG_WARNING, "Out of Memory");
goto out;
}
- if (!list_empty (&priv->peers)) {
- list_for_each_entry (entry, &priv->peers, uuid_list) {
+ if (!cds_list_empty (&priv->peers)) {
+ cds_list_for_each_entry (entry, &priv->peers, uuid_list) {
count++;
ret = gd_add_peer_detail_to_dict (entry,
friends, count);
@@ -3665,13 +3665,13 @@ glusterd_get_volumes (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
goto out;
}
- if (list_empty (&priv->volumes)) {
+ if (cds_list_empty (&priv->volumes)) {
ret = 0;
goto respond;
}
if (flags == GF_CLI_GET_VOLUME_ALL) {
- list_for_each_entry (entry, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (entry, &priv->volumes, vol_list) {
ret = glusterd_add_volume_detail_to_dict (entry,
volumes, count);
if (ret)
@@ -3686,17 +3686,17 @@ glusterd_get_volumes (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
if (ret) {
if (priv->volumes.next) {
- entry = list_entry (priv->volumes.next,
- typeof (*entry),
- vol_list);
+ entry = cds_list_entry (priv->volumes.next,
+ typeof (*entry),
+ vol_list);
}
} else {
ret = glusterd_volinfo_find (volname, &entry);
if (ret)
goto respond;
- entry = list_entry (entry->vol_list.next,
- typeof (*entry),
- vol_list);
+ entry = cds_list_entry (entry->vol_list.next,
+ typeof (*entry),
+ vol_list);
}
if (&entry->vol_list == &priv->volumes) {
@@ -4508,8 +4508,9 @@ __glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata,
!uuid_compare (peerinfo->uuid, uuid))
glusterd_unlock (peerinfo->uuid);
} else {
- list_for_each_entry (volinfo, &conf->volumes,
- vol_list) {
+ cds_list_for_each_entry (volinfo,
+ &conf->volumes,
+ vol_list) {
ret = glusterd_mgmt_v3_unlock
(volinfo->volname,
peerinfo->uuid,
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 4f19d00a3d7..611e9fbf545 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -446,7 +446,7 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
/* Find the snap_vol */
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
if (!strcmp (volinfo->volname,
snap_opinfo->snap_vol_id)) {
snap_vol = volinfo;
@@ -464,7 +464,7 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
/* Find the missed brick in the snap volume */
- list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
i++;
if (i == snap_opinfo->brick_num)
break;
@@ -589,16 +589,17 @@ glusterd_take_missing_brick_snapshots (char *brick_name)
my_node_uuid = uuid_utoa (MY_UUID);
- list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
- missed_snaps) {
+ cds_list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
+ missed_snaps) {
/* If the missed snap op is not for the local node
* then continue
*/
if (strcmp (my_node_uuid, missed_snapinfo->node_uuid))
continue;
- list_for_each_entry (snap_opinfo, &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry (snap_opinfo,
+ &missed_snapinfo->snap_ops,
+ snap_ops_list) {
/* Check if the missed snap's op is a create for
* the brick name in question
*/
@@ -936,7 +937,7 @@ gd_validate_cluster_op_version (xlator_t *this, int cluster_op_version,
* lead to inconsistencies in the cluster
*/
if ((cluster_op_version < conf->op_version) &&
- !list_empty (&conf->volumes)) {
+ !cds_list_empty (&conf->volumes)) {
gf_log (this->name, GF_LOG_ERROR,
"cannot reduce operating version to %d from current "
"version %d as volumes exist (as per peer request from "
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index f875c8d36d3..569f2743dda 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -213,8 +213,7 @@ glusterd_hooks_add_op_args (runner_t *runner, glusterd_op_t op,
int ret = -1;
priv = THIS->private;
- list_for_each_entry (voliter, &priv->volumes,
- vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (glusterd_is_volume_started (voliter))
vol_count++;
}
@@ -419,7 +418,7 @@ glusterd_hooks_post_stub_enqueue (char *scriptdir, glusterd_op_t op,
pthread_mutex_lock (&hooks_priv->mutex);
{
hooks_priv->waitcount++;
- list_add_tail (&stub->all_hooks, &hooks_priv->list);
+ cds_list_add_tail (&stub->all_hooks, &hooks_priv->list);
pthread_cond_signal (&hooks_priv->cond);
}
pthread_mutex_unlock (&hooks_priv->mutex);
@@ -445,7 +444,7 @@ glusterd_hooks_stub_init (glusterd_hooks_stub_t **stub, char *scriptdir,
if (!hooks_stub)
goto out;
- INIT_LIST_HEAD (&hooks_stub->all_hooks);
+ CDS_INIT_LIST_HEAD (&hooks_stub->all_hooks);
hooks_stub->op = op;
hooks_stub->scriptdir = gf_strdup (scriptdir);
if (!hooks_stub->scriptdir)
@@ -498,14 +497,14 @@ hooks_worker (void *args)
for (;;) {
pthread_mutex_lock (&hooks_priv->mutex);
{
- while (list_empty (&hooks_priv->list)) {
+ while (cds_list_empty (&hooks_priv->list)) {
pthread_cond_wait (&hooks_priv->cond,
&hooks_priv->mutex);
}
- stub = list_entry (hooks_priv->list.next,
- glusterd_hooks_stub_t,
- all_hooks);
- list_del_init (&stub->all_hooks);
+ stub = cds_list_entry (hooks_priv->list.next,
+ glusterd_hooks_stub_t,
+ all_hooks);
+ cds_list_del_init (&stub->all_hooks);
hooks_priv->waitcount--;
}
@@ -535,7 +534,7 @@ glusterd_hooks_priv_init (glusterd_hooks_private_t **new)
pthread_mutex_init (&hooks_priv->mutex, NULL);
pthread_cond_init (&hooks_priv->cond, NULL);
- INIT_LIST_HEAD (&hooks_priv->list);
+ CDS_INIT_LIST_HEAD (&hooks_priv->list);
hooks_priv->waitcount = 0;
*new = hooks_priv;
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.h b/xlators/mgmt/glusterd/src/glusterd-hooks.h
index c597ddd2a7d..1e99f3472fb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.h
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.h
@@ -33,7 +33,7 @@ typedef enum glusterd_commit_hook_type {
} glusterd_commit_hook_type_t;
typedef struct hooks_private {
- struct list_head list;
+ struct cds_list_head list;
int waitcount; //debug purposes
pthread_mutex_t mutex;
pthread_cond_t cond;
@@ -41,7 +41,7 @@ typedef struct hooks_private {
} glusterd_hooks_private_t;
typedef struct hooks_stub {
- struct list_head all_hooks;
+ struct cds_list_head all_hooks;
char *scriptdir;
glusterd_op_t op;
dict_t *op_ctx;
diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
index 33bd95c031a..de685543f2b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
@@ -211,7 +211,7 @@ cont:
goto out;
ret = -1;
- 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))
continue;
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 8d344aa7b9a..1c46e0e334b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -385,7 +385,7 @@ int
glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict,
char **op_errstr, int npeers,
gf_boolean_t *is_acquired,
- struct list_head *peers)
+ struct cds_list_head *peers)
{
char *volname = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
@@ -634,7 +634,7 @@ out:
int
glusterd_mgmt_v3_pre_validate (glusterd_op_t op, dict_t *req_dict,
char **op_errstr, int npeers,
- struct list_head *peers)
+ struct cds_list_head *peers)
{
int32_t ret = -1;
int32_t peer_cnt = 0;
@@ -867,7 +867,7 @@ out:
int
glusterd_mgmt_v3_brick_op (glusterd_op_t op, dict_t *req_dict,
char **op_errstr, int npeers,
- struct list_head *peers)
+ struct cds_list_head *peers)
{
int32_t ret = -1;
int32_t peer_cnt = 0;
@@ -1086,7 +1086,7 @@ out:
int
glusterd_mgmt_v3_commit (glusterd_op_t op, dict_t *op_ctx,
dict_t *req_dict, char **op_errstr,
- int npeers, struct list_head *peers)
+ int npeers, struct cds_list_head *peers)
{
int32_t ret = -1;
int32_t peer_cnt = 0;
@@ -1283,7 +1283,7 @@ out:
int
glusterd_mgmt_v3_post_validate (glusterd_op_t op, int32_t op_ret, dict_t *dict,
dict_t *req_dict, char **op_errstr, int npeers,
- struct list_head *peers)
+ struct cds_list_head *peers)
{
int32_t ret = -1;
int32_t peer_cnt = 0;
@@ -1472,7 +1472,7 @@ glusterd_mgmt_v3_release_peer_locks (glusterd_op_t op,
dict_t *dict, int32_t op_ret,
char **op_errstr, int npeers,
gf_boolean_t is_acquired,
- struct list_head *peers)
+ struct cds_list_head *peers)
{
int32_t ret = -1;
int32_t peer_cnt = 0;
@@ -1538,7 +1538,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
xlator_t *this = NULL;
gf_boolean_t is_acquired = _gf_false;
uuid_t *originator_uuid = NULL;
- struct list_head xaction_peers = {0,};
+ struct cds_list_head xaction_peers = {0,};
this = THIS;
GF_ASSERT (this);
@@ -1547,7 +1547,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op,
conf = this->private;
GF_ASSERT (conf);
- INIT_LIST_HEAD (&xaction_peers);
+ CDS_INIT_LIST_HEAD (&xaction_peers);
npeers = gd_build_local_xaction_peers_list (&conf->peers,
&xaction_peers, op);
if (npeers == -1) {
@@ -1758,7 +1758,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
uuid_t *originator_uuid = NULL;
gf_boolean_t success = _gf_false;
char *cli_errstr = NULL;
- struct list_head xaction_peers = {0,};
+ struct cds_list_head xaction_peers = {0,};
this = THIS;
GF_ASSERT (this);
@@ -1767,7 +1767,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op,
conf = this->private;
GF_ASSERT (conf);
- INIT_LIST_HEAD (&xaction_peers);
+ CDS_INIT_LIST_HEAD (&xaction_peers);
npeers = gd_build_local_xaction_peers_list (&conf->peers,
&xaction_peers, op);
if (npeers == -1) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
index 30c8d8150c0..3d26b8745cc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
@@ -545,8 +545,8 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno)
}
/* look up spec for label */
- list_for_each_entry (mspec, &priv->mount_specs,
- speclist) {
+ cds_list_for_each_entry (mspec, &priv->mount_specs,
+ speclist) {
if (strcmp (mspec->label, label) != 0)
continue;
uid = evaluate_mount_request (mspec, argdict);
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.h b/xlators/mgmt/glusterd/src/glusterd-mountbroker.h
index 426252ebed8..83267c203ca 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.h
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.h
@@ -24,7 +24,7 @@ struct gf_mount_pattern {
typedef struct gf_mount_pattern gf_mount_pattern_t;
struct gf_mount_spec {
- struct list_head speclist;
+ struct cds_list_head speclist;
char *label;
gf_mount_pattern_t *patterns;
size_t len;
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;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index e306ccc6bde..0ca1b5bb1dc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -70,7 +70,7 @@ typedef enum glusterd_op_sm_event_type_ {
struct glusterd_op_sm_event_ {
- struct list_head list;
+ struct cds_list_head list;
void *ctx;
glusterd_op_sm_event_type_t event;
uuid_t txn_id;
@@ -96,13 +96,13 @@ struct glusterd_op_info_ {
int32_t brick_pending_count;
int32_t op_count;
glusterd_op_t op;
- struct list_head op_peers;
+ struct cds_list_head op_peers;
void *op_ctx;
rpcsvc_request_t *req;
int32_t op_ret;
int32_t op_errno;
char *op_errstr;
- struct list_head pending_bricks;
+ struct cds_list_head pending_bricks;
};
typedef struct glusterd_op_info_ glusterd_op_info_t;
@@ -239,7 +239,7 @@ char*
glusterd_op_sm_event_name_get (int event);
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
glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickinfo,
gd1_mgmt_brick_op_req **req, dict_t *dict);
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
index be8ae76c77a..3a145264b79 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
@@ -49,7 +49,7 @@ glusterd_peerinfo_destroy (glusterd_peerinfo_t *peerinfo)
if (!peerinfo)
goto out;
- list_del_init (&peerinfo->uuid_list);
+ cds_list_del_init (&peerinfo->uuid_list);
ret = glusterd_store_delete_peerinfo (peerinfo);
if (ret) {
@@ -59,8 +59,8 @@ glusterd_peerinfo_destroy (glusterd_peerinfo_t *peerinfo)
GF_FREE (peerinfo->hostname);
peerinfo->hostname = NULL;
- list_for_each_entry_safe (hostname, tmp, &peerinfo->hostnames,
- hostname_list) {
+ cds_list_for_each_entry_safe (hostname, tmp, &peerinfo->hostnames,
+ hostname_list) {
glusterd_peer_hostname_free (hostname);
}
@@ -178,7 +178,7 @@ glusterd_peerinfo_find_by_uuid (uuid_t uuid)
if (uuid_is_null (uuid))
return NULL;
- list_for_each_entry (entry, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (entry, &priv->peers, uuid_list) {
if (!uuid_compare (entry->uuid, uuid)) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -252,11 +252,11 @@ glusterd_peerinfo_new (glusterd_friend_sm_state_t state, uuid_t *uuid,
if (!new_peer)
goto out;
- INIT_LIST_HEAD (&new_peer->uuid_list);
+ CDS_INIT_LIST_HEAD (&new_peer->uuid_list);
new_peer->state.state = state;
- INIT_LIST_HEAD (&new_peer->hostnames);
+ CDS_INIT_LIST_HEAD (&new_peer->hostnames);
if (hostname) {
ret = gd_add_address_to_peer (new_peer, hostname);
if (ret)
@@ -303,7 +303,7 @@ glusterd_chk_peers_connected_befriended (uuid_t skip_uuid)
priv= THIS->private;
GF_ASSERT (priv);
- list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
if (!uuid_is_null (skip_uuid) && !uuid_compare (skip_uuid,
peerinfo->uuid))
@@ -336,8 +336,8 @@ glusterd_uuid_to_hostname (uuid_t uuid)
if (!uuid_compare (MY_UUID, uuid)) {
hostname = gf_strdup ("localhost");
}
- if (!list_empty (&priv->peers)) {
- list_for_each_entry (entry, &priv->peers, uuid_list) {
+ if (!cds_list_empty (&priv->peers)) {
+ cds_list_for_each_entry (entry, &priv->peers, uuid_list) {
if (!uuid_compare (entry->uuid, uuid)) {
hostname = gf_strdup (entry->hostname);
break;
@@ -362,18 +362,18 @@ gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo)
gf_boolean_t
glusterd_are_vol_all_peers_up (glusterd_volinfo_t *volinfo,
- struct list_head *peers,
+ struct cds_list_head *peers,
char **down_peerstr)
{
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
gf_boolean_t ret = _gf_false;
- 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))
continue;
- list_for_each_entry (peerinfo, peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, peers, uuid_list) {
if (uuid_compare (peerinfo->uuid, brickinfo->uuid))
continue;
@@ -413,7 +413,7 @@ glusterd_peer_hostname_new (const char *hostname,
goto out;
peer_hostname->hostname = gf_strdup (hostname);
- INIT_LIST_HEAD (&peer_hostname->hostname_list);
+ CDS_INIT_LIST_HEAD (&peer_hostname->hostname_list);
*name = peer_hostname;
ret = 0;
@@ -429,7 +429,7 @@ glusterd_peer_hostname_free (glusterd_peer_hostname_t *name)
if (!name)
return;
- list_del_init (&name->hostname_list);
+ cds_list_del_init (&name->hostname_list);
GF_FREE (name->hostname);
name->hostname = NULL;
@@ -448,7 +448,8 @@ gd_peer_has_address (glusterd_peerinfo_t *peerinfo, const char *address)
GF_VALIDATE_OR_GOTO ("glusterd", (peerinfo != NULL), out);
GF_VALIDATE_OR_GOTO ("glusterd", (address != NULL), out);
- list_for_each_entry (hostname, &peerinfo->hostnames, hostname_list) {
+ cds_list_for_each_entry (hostname, &peerinfo->hostnames,
+ hostname_list) {
if (strcmp (hostname->hostname, address) == 0) {
ret = _gf_true;
break;
@@ -478,7 +479,7 @@ gd_add_address_to_peer (glusterd_peerinfo_t *peerinfo, const char *address)
if (ret)
goto out;
- list_add_tail (&hostname->hostname_list, &peerinfo->hostnames);
+ cds_list_add_tail (&hostname->hostname_list, &peerinfo->hostnames);
ret = 0;
out:
@@ -525,8 +526,8 @@ gd_add_friend_to_dict (glusterd_peerinfo_t *friend, dict_t *dict,
*/
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname", prefix);
- address = list_entry (&friend->hostnames, glusterd_peer_hostname_t,
- hostname_list);
+ address = cds_list_entry (&friend->hostnames, glusterd_peer_hostname_t,
+ hostname_list);
if (!address) {
ret = -1;
gf_log (this->name, GF_LOG_ERROR, "Could not retrieve first "
@@ -547,7 +548,7 @@ gd_add_friend_to_dict (glusterd_peerinfo_t *friend, dict_t *dict,
address = NULL;
count = 0;
- list_for_each_entry (address, &friend->hostnames, hostname_list) {
+ cds_list_for_each_entry (address, &friend->hostnames, hostname_list) {
GF_VALIDATE_OR_GOTO (this->name, (address != NULL), out);
memset (key, 0, sizeof (key));
@@ -592,8 +593,9 @@ gd_peerinfo_find_from_hostname (const char *hoststr)
GF_VALIDATE_OR_GOTO (this->name, (hoststr != NULL), out);
- list_for_each_entry (peer, &priv->peers, uuid_list) {
- list_for_each_entry (tmphost, &peer->hostnames,hostname_list) {
+ cds_list_for_each_entry (peer, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (tmphost, &peer->hostnames,
+ hostname_list) {
if (!strncasecmp (tmphost->hostname, hoststr, 1024)) {
gf_log (this->name, GF_LOG_DEBUG,
"Friend %s found.. state: %d",
@@ -634,8 +636,9 @@ gd_peerinfo_find_from_addrinfo (const struct addrinfo *addr)
GF_VALIDATE_OR_GOTO (this->name, (addr != NULL), out);
- list_for_each_entry (peer, &conf->peers, uuid_list) {
- list_for_each_entry (address, &peer->hostnames, hostname_list) {
+ cds_list_for_each_entry (peer, &conf->peers, uuid_list) {
+ cds_list_for_each_entry (address, &peer->hostnames,
+ hostname_list) {
/* TODO: Cache the resolved addrinfos to improve
* performance
*/
@@ -827,7 +830,7 @@ gd_add_peer_hostnames_to_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict,
GF_VALIDATE_OR_GOTO (this->name, (dict != NULL), out);
GF_VALIDATE_OR_GOTO (this->name, (prefix != NULL), out);
- list_for_each_entry (addr, &peerinfo->hostnames, hostname_list) {
+ cds_list_for_each_entry (addr, &peerinfo->hostnames, hostname_list) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname%d", prefix, count);
ret = dict_set_dynstr_with_alloc (dict, key, addr->hostname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
index 9877d861af7..f4039620b28 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
@@ -47,7 +47,8 @@ gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo);
gf_boolean_t
glusterd_are_vol_all_peers_up (glusterd_volinfo_t *volinfo,
- struct list_head *peers, char **down_peerstr);
+ struct cds_list_head *peers,
+ char **down_peerstr);
int32_t
glusterd_peer_hostname_new (const char *hostname,
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index 48dc4b7b39e..462064819ac 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -1222,7 +1222,7 @@ glusterd_get_gfid_from_brick (dict_t *dict, glusterd_volinfo_t *volinfo,
goto out;
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
ret = glusterd_resolve_brick (brickinfo);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, FMTSTR_RESOLVE_BRICK,
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index c986fc12e7b..ba67df436ff 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -759,8 +759,8 @@ glusterd_op_rebalance (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
volinfo->rebal.op = GD_OP_NONE;
/* Fall back to the old volume file in case of decommission*/
- list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
if (!brickinfo->decommissioned)
continue;
brickinfo->decommissioned = 0;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 0c0f171303f..a6e48ca14b8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -1556,8 +1556,8 @@ glusterd_op_perform_replace_brick (glusterd_volinfo_t *volinfo,
sizeof(new_brickinfo->mount_dir));
}
- list_add_tail (&new_brickinfo->brick_list,
- &old_brickinfo->brick_list);
+ cds_list_add_tail (&new_brickinfo->brick_list,
+ &old_brickinfo->brick_list);
volinfo->brick_count++;
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 8f29d26ed24..8dd65168bb6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -2009,7 +2009,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
req_ctx = data;
GF_ASSERT (req_ctx);
- INIT_LIST_HEAD (&opinfo.pending_bricks);
+ CDS_INIT_LIST_HEAD (&opinfo.pending_bricks);
ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id);
gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s",
@@ -2026,7 +2026,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this,
goto out;
}
- list_for_each_entry (pending_node, &opinfo.pending_bricks, list) {
+ cds_list_for_each_entry (pending_node, &opinfo.pending_bricks, list) {
dummy_frame = create_frame (this, this->ctx->pool);
if (!dummy_frame)
continue;
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index d3640c0aaa9..9d0c49f04c2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -37,7 +37,7 @@
#include "glusterd-store.h"
#include "glusterd-snapshot-utils.h"
-static struct list_head gd_friend_sm_queue;
+static struct cds_list_head gd_friend_sm_queue;
static char *glusterd_friend_sm_state_names[] = {
"Establishing Connection",
@@ -156,7 +156,7 @@ glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid)
if (ret)
goto out;
- list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
if (!peerinfo->connected || !peerinfo->peer)
continue;
@@ -479,7 +479,7 @@ glusterd_ac_send_friend_update (glusterd_friend_sm_event_t *event, void *ctx)
if (ret)
goto out;
- list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
if (!glusterd_should_update_peer (peerinfo, cur_peerinfo))
continue;
@@ -496,7 +496,7 @@ glusterd_ac_send_friend_update (glusterd_friend_sm_event_t *event, void *ctx)
if (ret)
goto out;
- list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
if (!peerinfo->connected || !peerinfo->peer)
continue;
@@ -536,8 +536,8 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
GF_ASSERT (priv);
- list_for_each_entry_safe (volinfo,tmp_volinfo,
- &priv->volumes, vol_list) {
+ cds_list_for_each_entry_safe (volinfo, tmp_volinfo, &priv->volumes,
+ vol_list) {
/* The peer detach checks make sure that, at this point in the
* detach process, there are only volumes contained completely
* within or completely outside the detached peer.
@@ -583,7 +583,7 @@ glusterd_ac_handle_friend_remove_req (glusterd_friend_sm_event_t *event,
ret = glusterd_xfer_friend_remove_resp (ev_ctx->req, ev_ctx->hostname,
ev_ctx->port);
- list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_REMOVE_FRIEND,
&new_event);
@@ -963,7 +963,7 @@ glusterd_friend_sm_new_event (glusterd_friend_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;
}
@@ -974,7 +974,7 @@ glusterd_friend_sm_inject_event (glusterd_friend_sm_event_t *event)
GF_ASSERT (event);
gf_log ("glusterd", GF_LOG_DEBUG, "Enqueue event: '%s'",
glusterd_friend_sm_event_name_get (event->event));
- list_add_tail (&event->list, &gd_friend_sm_queue);
+ cds_list_add_tail (&event->list, &gd_friend_sm_queue);
return 0;
}
@@ -1043,10 +1043,11 @@ glusterd_friend_sm ()
priv = this->private;
GF_ASSERT (priv);
- while (!list_empty (&gd_friend_sm_queue)) {
- list_for_each_entry_safe (event, tmp, &gd_friend_sm_queue, list) {
+ while (!cds_list_empty (&gd_friend_sm_queue)) {
+ cds_list_for_each_entry_safe (event, tmp, &gd_friend_sm_queue,
+ list) {
- list_del_init (&event->list);
+ cds_list_del_init (&event->list);
event_type = event->event;
peerinfo = event->peerinfo;
if (!peerinfo) {
@@ -1152,6 +1153,6 @@ out:
int
glusterd_friend_sm_init ()
{
- INIT_LIST_HEAD (&gd_friend_sm_queue);
+ CDS_INIT_LIST_HEAD (&gd_friend_sm_queue);
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h
index fb873f75601..8dc6146baf2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.h
@@ -29,6 +29,8 @@
#include "rpcsvc.h"
#include "store.h"
+#include <urcu/rculist.h>
+
typedef enum gd_quorum_contribution_ {
QUORUM_NONE,
QUORUM_WAITING,
@@ -58,7 +60,7 @@ typedef struct glusterd_peer_state_info_ {
typedef struct glusterd_peer_hostname_ {
char *hostname;
- struct list_head hostname_list;
+ struct cds_list_head hostname_list;
} glusterd_peer_hostname_t;
typedef struct glusterd_sm_transition_ {
@@ -84,10 +86,10 @@ struct glusterd_peerinfo_ {
*/
glusterd_peer_state_info_t state;
char *hostname;
- struct list_head hostnames;
+ struct cds_list_head hostnames;
int port;
- struct list_head uuid_list;
- struct list_head op_peers_list;
+ struct cds_list_head uuid_list;
+ struct cds_list_head op_peers_list;
struct rpc_clnt *rpc;
rpc_clnt_prog_t *mgmt;
rpc_clnt_prog_t *peer;
@@ -105,7 +107,7 @@ typedef struct glusterd_peerinfo_ glusterd_peerinfo_t;
typedef struct glusterd_local_peers_ {
glusterd_peerinfo_t *peerinfo;
- struct list_head op_peers_list;
+ struct cds_list_head op_peers_list;
} glusterd_local_peers_t;
typedef enum glusterd_ev_gen_mode_ {
@@ -151,7 +153,7 @@ typedef enum glusterd_friend_update_op_ {
struct glusterd_friend_sm_event_ {
- struct list_head list;
+ struct cds_list_head list;
glusterd_peerinfo_t *peerinfo;
void *ctx;
glusterd_friend_sm_event_type_t event;
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
index 7d265d1ac35..d1a7da7e0ae 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
@@ -210,7 +210,7 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
}
/* Get volinfo->snapd from svc object */
- snapd = list_entry (svc, glusterd_snapdsvc_t, svc);
+ snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc);
if (!snapd) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get snapd object "
"from snapd service");
@@ -218,7 +218,7 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
}
/* Get volinfo from snapd */
- volinfo = list_entry (snapd, glusterd_volinfo_t, snapd);
+ volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd);
if (!volinfo) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get volinfo from "
"from snapd");
@@ -318,7 +318,7 @@ glusterd_snapdsvc_restart ()
conf = this->private;
GF_ASSERT (conf);
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
/* Init per volume snapd svc */
ret = glusterd_snapdsvc_init (volinfo);
if (ret) {
@@ -359,7 +359,7 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event)
this = THIS;
GF_ASSERT (this);
- svc = list_entry (conn, glusterd_svc_t, conn);
+ svc = cds_list_entry (conn, glusterd_svc_t, conn);
if (!svc) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get the service");
return -1;
@@ -382,14 +382,14 @@ glusterd_snapdsvc_rpc_notify (glusterd_conn_t *conn, rpc_clnt_event_t event)
break;
case RPC_CLNT_DESTROY:
- snapd = list_entry (svc, glusterd_snapdsvc_t, svc);
+ snapd = cds_list_entry (svc, glusterd_snapdsvc_t, svc);
if (!snapd) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get the "
"snapd object");
return -1;
}
- volinfo = list_entry (snapd, glusterd_volinfo_t, snapd);
+ volinfo = cds_list_entry (snapd, glusterd_volinfo_t, snapd);
if (!volinfo) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get the "
"volinfo object");
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index aa9010f20b2..077d48852a1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -121,7 +121,7 @@ glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict,
GF_VALIDATE_OR_GOTO (this->name, snap_volinfo, out);
brick_count = 0;
- list_for_each_entry (brickinfo, &snap_volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &snap_volinfo->bricks, brick_list) {
brick_count++;
ret = glusterd_brickinfo_new (&new_brickinfo);
if (ret) {
@@ -218,8 +218,8 @@ glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict,
}
}
- list_add_tail (&new_brickinfo->brick_list,
- &new_volinfo->bricks);
+ cds_list_add_tail (&new_brickinfo->brick_list,
+ &new_volinfo->bricks);
/* ownership of new_brickinfo is passed to new_volinfo */
new_brickinfo = NULL;
}
@@ -268,8 +268,8 @@ glusterd_snap_volinfo_find_by_volume_id (uuid_t volume_id,
goto out;
}
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
- list_for_each_entry (voliter, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (voliter, &snap->volumes, vol_list) {
if (uuid_compare (volume_id, voliter->volume_id))
continue;
*volinfo = voliter;
@@ -299,7 +299,7 @@ glusterd_snap_volinfo_find (char *snap_volname, glusterd_snap_t *snap,
GF_ASSERT (snap);
GF_ASSERT (snap_volname);
- list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
if (!strcmp (snap_vol->volname, snap_volname)) {
ret = 0;
*volinfo = snap_vol;
@@ -330,7 +330,7 @@ glusterd_snap_volinfo_find_from_parent_volname (char *origin_volname,
GF_ASSERT (snap);
GF_ASSERT (origin_volname);
- list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
if (!strcmp (snap_vol->parent_volname, origin_volname)) {
ret = 0;
*volinfo = snap_vol;
@@ -514,11 +514,11 @@ glusterd_add_missed_snaps_to_export_dict (dict_t *peer_data)
GF_ASSERT (priv);
/* Add the missed_entries in the dict */
- list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
- missed_snaps) {
- list_for_each_entry (snap_opinfo,
- &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
+ missed_snaps) {
+ cds_list_for_each_entry (snap_opinfo,
+ &missed_snapinfo->snap_ops,
+ snap_ops_list) {
snprintf (name_buf, sizeof(name_buf),
"missed_snaps_%d", missed_snap_count);
snprintf (value, sizeof(value), "%s:%s=%s:%d:%s:%d:%d",
@@ -575,7 +575,7 @@ glusterd_add_snap_to_dict (glusterd_snap_t *snap, dict_t *peer_data,
snprintf (prefix, sizeof(prefix), "snap%d", snap_count);
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
volcount++;
ret = glusterd_add_volume_to_dict (volinfo, peer_data,
volcount, prefix);
@@ -603,7 +603,8 @@ glusterd_add_snap_to_dict (glusterd_snap_t *snap, dict_t *peer_data,
}
}
- 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)) {
host_bricks = _gf_true;
break;
@@ -706,7 +707,7 @@ glusterd_add_snapshots_to_export_dict (dict_t *peer_data)
GF_ASSERT (priv);
GF_ASSERT (peer_data);
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
snap_count++;
ret = glusterd_add_snap_to_dict (snap, peer_data, snap_count);
if (ret) {
@@ -905,8 +906,8 @@ glusterd_perform_missed_op (glusterd_snap_t *snap, int32_t op)
break;
case GF_SNAP_OPTION_TYPE_RESTORE:
- list_for_each_entry_safe (snap_volinfo, tmp,
- &snap->volumes, vol_list) {
+ cds_list_for_each_entry_safe (snap_volinfo, tmp, &snap->volumes,
+ vol_list) {
parent_volname = gf_strdup
(snap_volinfo->parent_volname);
if (!parent_volname)
@@ -956,7 +957,7 @@ glusterd_perform_missed_op (glusterd_snap_t *snap, int32_t op)
/* Detach the volinfo from priv->volumes, so that no new
* command can ref it any more and then unref it.
*/
- list_del_init (&volinfo->vol_list);
+ cds_list_del_init (&volinfo->vol_list);
glusterd_volinfo_unref (volinfo);
ret = glusterd_snapshot_restore_cleanup (dict,
@@ -1014,8 +1015,8 @@ glusterd_perform_missed_snap_ops ()
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
- missed_snaps) {
+ cds_list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
+ missed_snaps) {
/* If the pending snap_op is not for this node then continue */
if (strcmp (missed_snapinfo->node_uuid, uuid_utoa (MY_UUID)))
continue;
@@ -1034,8 +1035,9 @@ glusterd_perform_missed_snap_ops ()
}
op_status = GD_MISSED_SNAP_PENDING;
- list_for_each_entry (snap_opinfo, &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry (snap_opinfo,
+ &missed_snapinfo->snap_ops,
+ snap_ops_list) {
/* If the snap_op is create or its status is
* GD_MISSED_SNAP_DONE then continue
*/
@@ -1195,8 +1197,9 @@ glusterd_are_snap_bricks_local (glusterd_snap_t *snap)
GF_ASSERT (this);
GF_ASSERT (snap);
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
if (!uuid_compare (brickinfo->uuid, MY_UUID)) {
is_local = _gf_true;
goto out;
@@ -1232,8 +1235,8 @@ glusterd_peer_has_missed_snap_delete (glusterd_peerinfo_t *peerinfo,
peer_uuid = uuid_utoa (peerinfo->uuid);
- list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
- missed_snaps) {
+ cds_list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
+ missed_snaps) {
/* Look for missed snap for the same peer, and
* the same snap_id
*/
@@ -1242,9 +1245,9 @@ glusterd_peer_has_missed_snap_delete (glusterd_peerinfo_t *peerinfo,
/* Check if the missed snap's op is delete and the
* status is pending
*/
- list_for_each_entry (snap_opinfo,
- &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry (snap_opinfo,
+ &missed_snapinfo->snap_ops,
+ snap_ops_list) {
if (((snap_opinfo->op ==
GF_SNAP_OPTION_TYPE_DELETE) ||
(snap_opinfo->op ==
@@ -1434,8 +1437,9 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
goto out;
}
- list_add_order (&snap->snap_list, &priv->snapshots,
- glusterd_compare_snap_time);
+ glusterd_list_add_order (&snap->snap_list, &priv->snapshots,
+ glusterd_compare_snap_time);
+
for (i = 1; i <= volcount; i++) {
ret = glusterd_import_volinfo (peer_data, i,
@@ -2199,7 +2203,8 @@ out:
}
int
-glusterd_compare_snap_time(struct list_head *list1, struct list_head *list2)
+glusterd_compare_snap_time (struct cds_list_head *list1,
+ struct cds_list_head *list2)
{
glusterd_snap_t *snap1 = NULL;
glusterd_snap_t *snap2 = NULL;
@@ -2208,15 +2213,16 @@ glusterd_compare_snap_time(struct list_head *list1, struct list_head *list2)
GF_ASSERT (list1);
GF_ASSERT (list2);
- snap1 = list_entry(list1, glusterd_snap_t, snap_list);
- snap2 = list_entry(list2, glusterd_snap_t, snap_list);
+ snap1 = cds_list_entry (list1, glusterd_snap_t, snap_list);
+ snap2 = cds_list_entry (list2, glusterd_snap_t, snap_list);
diff_time = difftime(snap1->time_stamp, snap2->time_stamp);
return (int)diff_time;
}
int
-glusterd_compare_snap_vol_time(struct list_head *list1, struct list_head *list2)
+glusterd_compare_snap_vol_time (struct cds_list_head *list1,
+ struct cds_list_head *list2)
{
glusterd_volinfo_t *snapvol1 = NULL;
glusterd_volinfo_t *snapvol2 = NULL;
@@ -2225,8 +2231,8 @@ glusterd_compare_snap_vol_time(struct list_head *list1, struct list_head *list2)
GF_ASSERT (list1);
GF_ASSERT (list2);
- snapvol1 = list_entry(list1, glusterd_volinfo_t, snapvol_list);
- snapvol2 = list_entry(list2, glusterd_volinfo_t, snapvol_list);
+ snapvol1 = cds_list_entry (list1, glusterd_volinfo_t, snapvol_list);
+ snapvol2 = cds_list_entry (list2, glusterd_volinfo_t, snapvol_list);
diff_time = difftime(snapvol1->snapshot->time_stamp,
snapvol2->snapshot->time_stamp);
@@ -2250,8 +2256,8 @@ glusterd_missed_snapinfo_new (glusterd_missed_snap_info **missed_snapinfo)
if (!new_missed_snapinfo)
goto out;
- INIT_LIST_HEAD (&new_missed_snapinfo->missed_snaps);
- INIT_LIST_HEAD (&new_missed_snapinfo->snap_ops);
+ CDS_INIT_LIST_HEAD (&new_missed_snapinfo->missed_snaps);
+ CDS_INIT_LIST_HEAD (&new_missed_snapinfo->snap_ops);
*missed_snapinfo = new_missed_snapinfo;
@@ -2282,7 +2288,7 @@ glusterd_missed_snap_op_new (glusterd_snap_op_t **snap_op)
new_snap_op->brick_num = -1;
new_snap_op->op = -1;
new_snap_op->status = -1;
- INIT_LIST_HEAD (&new_snap_op->snap_ops_list);
+ CDS_INIT_LIST_HEAD (&new_snap_op->snap_ops_list);
*snap_op = new_snap_op;
@@ -2556,7 +2562,7 @@ out:
int32_t
glusterd_snap_quorum_check_for_create (dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr,
- struct list_head *peers_list)
+ struct cds_list_head *peers_list)
{
int8_t snap_force = 0;
int32_t force = 0;
@@ -2745,7 +2751,7 @@ out:
int32_t
glusterd_snap_quorum_check (dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr,
- struct list_head *peers_list)
+ struct cds_list_head *peers_list)
{
int32_t ret = -1;
xlator_t *this = NULL;
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h
index 41f316625d0..3f50a061b18 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h
@@ -28,10 +28,10 @@ glusterd_add_snapd_to_dict (glusterd_volinfo_t *volinfo,
dict_t *dict, int32_t count);
int
-glusterd_compare_snap_time(struct list_head *, struct list_head *);
+glusterd_compare_snap_time (struct cds_list_head *, struct cds_list_head *);
int
-glusterd_compare_snap_vol_time(struct list_head *, struct list_head *);
+glusterd_compare_snap_vol_time (struct cds_list_head *, struct cds_list_head *);
int32_t
glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict,
@@ -120,12 +120,12 @@ gd_import_volume_snap_details (dict_t *dict, glusterd_volinfo_t *volinfo,
int32_t
glusterd_snap_quorum_check (dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr,
- struct list_head *peers_list);
+ struct cds_list_head *peers_list);
int32_t
glusterd_snap_quorum_check_for_create (dict_t *dict, gf_boolean_t snap_volume,
char **op_errstr,
- struct list_head *peers_list);
+ struct cds_list_head *peers_list);
int32_t
glusterd_snap_brick_create (glusterd_volinfo_t *snap_volinfo,
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 171d071efc3..2ce81da200f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -147,7 +147,7 @@ out:
/* Look for disconnected peers, for missed snap creates or deletes */
static int32_t
glusterd_find_missed_snap (dict_t *rsp_dict, glusterd_volinfo_t *vol,
- struct list_head *peers, int32_t op)
+ struct cds_list_head *peers, int32_t op)
{
int32_t brick_count = -1;
int32_t ret = -1;
@@ -162,14 +162,14 @@ glusterd_find_missed_snap (dict_t *rsp_dict, glusterd_volinfo_t *vol,
GF_ASSERT (vol);
brick_count = 0;
- list_for_each_entry (brickinfo, &vol->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &vol->bricks, brick_list) {
if (!uuid_compare (brickinfo->uuid, MY_UUID)) {
/* If the brick belongs to the same node */
brick_count++;
continue;
}
- list_for_each_entry (peerinfo, peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, peers, uuid_list) {
if (uuid_compare (peerinfo->uuid, brickinfo->uuid)) {
/* If the brick doesnt belong to this peer */
continue;
@@ -244,7 +244,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
if (!volname) {
/* For system limit */
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
if (volinfo->is_snap_volume == _gf_true)
continue;
@@ -764,7 +764,8 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
}
volcount = 0;
- list_for_each_entry_safe (snap_volinfo, tmp, &snap->volumes, vol_list) {
+ cds_list_for_each_entry_safe (snap_volinfo, tmp, &snap->volumes,
+ vol_list) {
volcount++;
ret = glusterd_volinfo_find (snap_volinfo->parent_volname,
&parent_volinfo);
@@ -854,7 +855,7 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
/* Detach the volinfo from priv->volumes, so that no new
* command can ref it any more and then unref it.
*/
- list_del_init (&parent_volinfo->vol_list);
+ cds_list_del_init (&parent_volinfo->vol_list);
glusterd_volinfo_unref (parent_volinfo);
}
@@ -985,10 +986,11 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
/* Get brickinfo for snap_volumes */
volcount = 0;
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
volcount++;
brick_count = 0;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
brick_count++;
if (uuid_compare (brickinfo->uuid, MY_UUID))
continue;
@@ -1984,7 +1986,8 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
brick_count = 0;
brick_order = 0;
/* Adding snap bricks mount paths to the dict */
- 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)) {
brick_order++;
continue;
@@ -2167,8 +2170,8 @@ glusterd_new_snap_object()
return NULL;
}
- INIT_LIST_HEAD (&snap->snap_list);
- INIT_LIST_HEAD (&snap->volumes);
+ CDS_INIT_LIST_HEAD (&snap->snap_list);
+ CDS_INIT_LIST_HEAD (&snap->volumes);
snap->snapname[0] = 0;
snap->snap_status = GD_SNAP_STATUS_INIT;
}
@@ -2192,12 +2195,13 @@ glusterd_list_add_snapvol (glusterd_volinfo_t *origin_vol,
snap = snap_vol->snapshot;
GF_ASSERT (snap);
- list_add_tail (&snap_vol->vol_list, &snap->volumes);
+ cds_list_add_tail (&snap_vol->vol_list, &snap->volumes);
LOCK (&origin_vol->lock);
{
- list_add_order (&snap_vol->snapvol_list,
- &origin_vol->snap_volumes,
- glusterd_compare_snap_vol_time);
+ glusterd_list_add_order (&snap_vol->snapvol_list,
+ &origin_vol->snap_volumes,
+ glusterd_compare_snap_vol_time);
+
origin_vol->snap_count++;
}
UNLOCK (&origin_vol->lock);
@@ -2219,7 +2223,7 @@ glusterd_find_snap_by_name (char *snapname)
GF_ASSERT (priv);
GF_ASSERT (snapname);
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
if (!strcmp (snap->snapname, snapname)) {
gf_log (THIS->name, GF_LOG_DEBUG, "Found "
"snap %s (%s)", snap->snapname,
@@ -2244,7 +2248,7 @@ glusterd_find_snap_by_id (uuid_t snap_id)
if (uuid_is_null(snap_id))
goto out;
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
if (!uuid_compare (snap->snap_id, snap_id)) {
gf_log (THIS->name, GF_LOG_DEBUG, "Found "
"snap %s (%s)", snap->snapname,
@@ -2391,7 +2395,7 @@ glusterd_lvm_snapshot_remove (dict_t *rsp_dict, glusterd_volinfo_t *snap_vol)
}
brick_count = -1;
- list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
brick_count++;
if (uuid_compare (brickinfo->uuid, MY_UUID)) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -2568,7 +2572,7 @@ glusterd_snap_volume_remove (dict_t *rsp_dict,
goto out;
}
- list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
if (uuid_compare (brickinfo->uuid, MY_UUID))
continue;
@@ -2606,7 +2610,7 @@ glusterd_snap_volume_remove (dict_t *rsp_dict,
goto out;
}
- if (!list_empty(&snap_vol->snapvol_list)) {
+ if (!cds_list_empty (&snap_vol->snapvol_list)) {
ret = glusterd_volinfo_find (snap_vol->parent_volname,
&origin_vol);
if (ret) {
@@ -2644,8 +2648,8 @@ glusterd_snapobject_delete (glusterd_snap_t *snap)
return -1;
}
- list_del_init (&snap->snap_list);
- list_del_init (&snap->volumes);
+ cds_list_del_init (&snap->snap_list);
+ cds_list_del_init (&snap->volumes);
if (LOCK_DESTROY(&snap->lock))
gf_log (THIS->name, GF_LOG_WARNING, "Failed destroying lock"
"of snap %s", snap->snapname);
@@ -2679,7 +2683,7 @@ glusterd_snap_remove (dict_t *rsp_dict,
goto out;
}
- list_for_each_entry_safe (snap_vol, tmp, &snap->volumes, vol_list) {
+ cds_list_for_each_entry_safe (snap_vol, tmp, &snap->volumes, vol_list) {
ret = glusterd_snap_volume_remove (rsp_dict, snap_vol,
remove_lvm, force);
if (ret && !force) {
@@ -2992,7 +2996,8 @@ glusterd_snapshot_get_snap_detail (dict_t *dict, glusterd_snap_t *snap,
goto done;
}
- list_for_each_entry_safe (snap_vol, tmp_vol, &snap->volumes, vol_list) {
+ cds_list_for_each_entry_safe (snap_vol, tmp_vol, &snap->volumes,
+ vol_list) {
volcount++;
snprintf (key, sizeof (key), "%s.vol%d", keyprefix, volcount);
ret = glusterd_snapshot_get_snapvol_detail (dict,
@@ -3040,7 +3045,8 @@ glusterd_snapshot_get_all_snap_info (dict_t *dict)
/* General parameter validation */
GF_ASSERT (dict);
- list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots,
+ snap_list) {
snapcount++;
snprintf (key, sizeof (key), "snap%d", snapcount);
ret = glusterd_snapshot_get_snap_detail (dict, snap, key, NULL);
@@ -3142,8 +3148,8 @@ glusterd_snapshot_get_info_by_volume (dict_t *dict, char *volname,
}
value = NULL;
- list_for_each_entry_safe (snap_vol, tmp_vol, &volinfo->snap_volumes,
- snapvol_list) {
+ cds_list_for_each_entry_safe (snap_vol, tmp_vol, &volinfo->snap_volumes,
+ snapvol_list) {
snapcount++;
snprintf (key, sizeof (key), "snap%d", snapcount);
ret = glusterd_snapshot_get_snap_detail (dict,
@@ -3316,7 +3322,8 @@ glusterd_snapshot_get_all_snapnames (dict_t *dict)
GF_ASSERT (priv);
GF_ASSERT (dict);
- list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots,
+ snap_list) {
snapcount++;
snapname = gf_strdup (snap->snapname);
if (!snapname) {
@@ -3363,7 +3370,7 @@ glusterd_snapshot_get_vol_snapnames (dict_t *dict, glusterd_volinfo_t *volinfo)
GF_ASSERT (dict);
GF_ASSERT (volinfo);
- list_for_each_entry_safe (snap_vol, tmp_vol,
+ cds_list_for_each_entry_safe (snap_vol, tmp_vol,
&volinfo->snap_volumes, snapvol_list) {
snapcount++;
snprintf (key, sizeof (key), "snapname%d", snapcount);
@@ -3695,7 +3702,7 @@ glusterd_handle_snapshot_restore (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
- list_for_each_entry (snap_volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap_volinfo, &snap->volumes, vol_list) {
i++;
snprintf (key, sizeof (key), "volname%d", i);
buf = gf_strdup (snap_volinfo->parent_volname);
@@ -3780,7 +3787,7 @@ glusterd_create_snap_object (dict_t *dict, dict_t *rsp_dict)
goto out;
}
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
if (!strcmp (snap->snapname, snapname) ||
!uuid_compare (snap->snap_id, *snap_id)) {
gf_log (THIS->name, GF_LOG_ERROR,
@@ -3828,8 +3835,8 @@ glusterd_create_snap_object (dict_t *dict, dict_t *rsp_dict)
goto out;
}
- list_add_order (&snap->snap_list, &priv->snapshots,
- glusterd_compare_snap_time);
+ glusterd_list_add_order (&snap->snap_list, &priv->snapshots,
+ glusterd_compare_snap_time);
gf_log (this->name, GF_LOG_TRACE, "Snapshot %s added to the list",
snap->snapname);
@@ -4221,7 +4228,7 @@ glusterd_add_brick_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
/* AFR changelog names are based on brick_id and hence the snap
* volume's bricks must retain the same ID */
strcpy (snap_brickinfo->brick_id, original_brickinfo->brick_id);
- list_add_tail (&snap_brickinfo->brick_list, &snap_vol->bricks);
+ cds_list_add_tail (&snap_brickinfo->brick_list, &snap_vol->bricks);
out:
if (ret && snap_brickinfo)
@@ -4464,7 +4471,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
/* Adding snap brickinfos to the snap volinfo */
brick_count = 0;
- list_for_each_entry (brickinfo, &origin_vol->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &origin_vol->bricks, brick_list) {
ret = glusterd_add_brick_to_snap_volume (dict, rsp_dict,
snap_vol, brickinfo,
volcount, brick_count);
@@ -4602,8 +4609,8 @@ glusterd_snapshot_activate_deactivate_prevalidate (dict_t *dict,
/* TODO : As of now there is only volume in snapshot.
* Change this when multiple volume snapshot is introduced
*/
- snap_volinfo = list_entry (snap->volumes.next, glusterd_volinfo_t,
- vol_list);
+ snap_volinfo = cds_list_entry (snap->volumes.next, glusterd_volinfo_t,
+ vol_list);
if (!snap_volinfo) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to fetch snap_volinfo");
@@ -4710,7 +4717,8 @@ glusterd_handle_snapshot_delete_all (dict_t *dict)
GF_ASSERT (dict);
- list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots,
+ snap_list) {
/* indexing from 1 to n, to keep it uniform with other code
* paths
*/
@@ -4780,7 +4788,7 @@ glusterd_handle_snapshot_delete_type_snap (rpcsvc_request_t *req,
}
/* Set volnames in the dict to get mgmt_v3 lock */
- list_for_each_entry_safe (snap_vol, tmp, &snap->volumes, vol_list) {
+ cds_list_for_each_entry_safe (snap_vol, tmp, &snap->volumes, vol_list) {
volcount++;
volname = gf_strdup (snap_vol->parent_volname);
if (!volname) {
@@ -5086,8 +5094,8 @@ glusterd_snapshot_activate_commit (dict_t *dict, char **op_errstr,
/* TODO : As of now there is only volume in snapshot.
* Change this when multiple volume snapshot is introduced
*/
- snap_volinfo = list_entry (snap->volumes.next, glusterd_volinfo_t,
- vol_list);
+ snap_volinfo = cds_list_entry (snap->volumes.next, glusterd_volinfo_t,
+ vol_list);
if (!snap_volinfo) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to fetch snap_volinfo");
@@ -5157,8 +5165,8 @@ glusterd_snapshot_deactivate_commit (dict_t *dict, char **op_errstr,
/* TODO : As of now there is only volume in snapshot.
* Change this when multiple volume snapshot is introduced
*/
- snap_volinfo = list_entry (snap->volumes.next, glusterd_volinfo_t,
- vol_list);
+ snap_volinfo = cds_list_entry (snap->volumes.next, glusterd_volinfo_t,
+ vol_list);
if (!snap_volinfo) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to fetch snap_volinfo");
@@ -5254,9 +5262,9 @@ glusterd_snapshot_remove_commit (dict_t *dict, char **op_errstr,
/* TODO : As of now there is only volume in snapshot.
* Change this when multiple volume snapshot is introduced
*/
- snap_volinfo = list_entry (snap->volumes.next,
- glusterd_volinfo_t,
- vol_list);
+ snap_volinfo = cds_list_entry (snap->volumes.next,
+ glusterd_volinfo_t,
+ vol_list);
if (!snap_volinfo) {
gf_log (this->name, GF_LOG_ERROR,
"Unable to fetch snap_volinfo");
@@ -5482,11 +5490,12 @@ glusterd_schedule_brick_snapshot (dict_t *dict, dict_t *rsp_dict,
GF_ASSERT(snap);
synctask_barrier_init ((&args));
- list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
volcount++;
brickcount = 0;
brickorder = 0;
- list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &snap_vol->bricks,
+ brick_list) {
snprintf (key, sizeof(key) - 1,
"snap-vol%d.brick%d.order", volcount,
brickcount);
@@ -5698,7 +5707,7 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
GLUSTERD_STORE_KEY_SNAP_ACTIVATE,
_gf_false);
if (!snap_activate) {
- list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
snap_vol->status = GLUSTERD_STATUS_STOPPED;
ret = glusterd_store_volinfo (snap_vol,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
@@ -5713,8 +5722,9 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
goto out;
}
- list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
- list_for_each_entry (brickinfo, &snap_vol->bricks, brick_list) {
+ cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (brickinfo, &snap_vol->bricks,
+ brick_list) {
ret = glusterd_brick_start (snap_vol, brickinfo,
_gf_false);
if (ret) {
@@ -6287,15 +6297,15 @@ glusterd_get_single_snap_status (char **op_errstr, dict_t *rsp_dict,
GF_ASSERT (keyprefix);
GF_ASSERT (snap);
- list_for_each_entry_safe (snap_volinfo, tmp_volinfo, &snap->volumes,
- vol_list) {
+ cds_list_for_each_entry_safe (snap_volinfo, tmp_volinfo, &snap->volumes,
+ vol_list) {
ret = snprintf (key, sizeof (key), "%s.vol%d", keyprefix,
volcount);
if (ret < 0) {
goto out;
}
- list_for_each_entry (brickinfo, &snap_volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry (brickinfo, &snap_volinfo->bricks,
+ brick_list) {
if (!glusterd_is_local_brick (this, snap_volinfo,
brickinfo)) {
brickcount++;
@@ -6457,8 +6467,8 @@ glusterd_get_snap_status_of_volume (char **op_errstr, dict_t *rsp_dict,
goto out;
}
- list_for_each_entry_safe (snap_volinfo, temp_volinfo,
- &volinfo->snap_volumes, snapvol_list) {
+ cds_list_for_each_entry_safe (snap_volinfo, temp_volinfo,
+ &volinfo->snap_volumes, snapvol_list) {
ret = snprintf (key, sizeof (key),
"status.snap%d.snapname", i);
if (ret < 0) {
@@ -6506,8 +6516,8 @@ glusterd_get_all_snapshot_status (dict_t *dict, char **op_errstr,
GF_ASSERT (dict);
GF_ASSERT (op_errstr);
- list_for_each_entry_safe (snap, tmp_snap,
- &priv->snapshots, snap_list) {
+ cds_list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots,
+ snap_list) {
ret = snprintf (key, sizeof (key),
"status.snap%d.snapname", i);
if (ret < 0) {
@@ -6717,8 +6727,8 @@ glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict)
if (count <= 0)
goto out;
- tmp_volinfo = list_entry (volinfo->snap_volumes.next,
- glusterd_volinfo_t, snapvol_list);
+ tmp_volinfo = cds_list_entry (volinfo->snap_volumes.next,
+ glusterd_volinfo_t, snapvol_list);
snap = tmp_volinfo->snapshot;
GF_ASSERT (snap);
@@ -7280,10 +7290,10 @@ glusterd_snapshot_revert_partial_restored_vol (glusterd_volinfo_t *volinfo)
/* Retrieve the snap_volumes list from the older volinfo */
reverted_vol->snap_count = volinfo->snap_count;
- list_for_each_entry_safe (snap_vol, tmp_vol, &volinfo->snap_volumes,
- snapvol_list) {
- list_add_tail (&snap_vol->snapvol_list,
- &reverted_vol->snap_volumes);
+ cds_list_for_each_entry_safe (snap_vol, tmp_vol, &volinfo->snap_volumes,
+ snapvol_list) {
+ cds_list_add_tail (&snap_vol->snapvol_list,
+ &reverted_vol->snap_volumes);
}
/* Since we retrieved the volinfo from store now we don't
@@ -7323,8 +7333,8 @@ glusterd_snapshot_revert_restore_from_snap (glusterd_snap_t *snap)
/* TODO : As of now there is only one volume in snapshot.
* Change this when multiple volume snapshot is introduced
*/
- snap_volinfo = list_entry (snap->volumes.next, glusterd_volinfo_t,
- vol_list);
+ snap_volinfo = cds_list_entry (snap->volumes.next, glusterd_volinfo_t,
+ vol_list);
strcpy (volname, snap_volinfo->parent_volname);
@@ -7798,9 +7808,9 @@ glusterd_free_missed_snapinfo (glusterd_missed_snap_info *missed_snapinfo)
glusterd_snap_op_t *tmp = NULL;
if (missed_snapinfo) {
- list_for_each_entry_safe (snap_opinfo, tmp,
- &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry_safe (snap_opinfo, tmp,
+ &missed_snapinfo->snap_ops,
+ snap_ops_list) {
glusterd_free_snap_op (snap_opinfo);
snap_opinfo = NULL;
}
@@ -7830,8 +7840,8 @@ glusterd_update_missed_snap_entry (glusterd_missed_snap_info *missed_snapinfo,
GF_ASSERT(missed_snapinfo);
GF_ASSERT(missed_snap_op);
- list_for_each_entry (snap_opinfo, &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry (snap_opinfo, &missed_snapinfo->snap_ops,
+ snap_ops_list) {
/* If the entry is not for the same snap_vol_id
* then continue
*/
@@ -7894,8 +7904,8 @@ glusterd_update_missed_snap_entry (glusterd_missed_snap_info *missed_snapinfo,
"Duplicate entry. Not updating");
glusterd_free_snap_op (missed_snap_op);
} else {
- list_add_tail (&missed_snap_op->snap_ops_list,
- &missed_snapinfo->snap_ops);
+ cds_list_add_tail (&missed_snap_op->snap_ops_list,
+ &missed_snapinfo->snap_ops);
}
ret = 0;
@@ -7955,8 +7965,8 @@ glusterd_add_new_entry_to_list (char *missed_info, char *snap_vol_id,
missed_snap_op->status = snap_status;
/* Look for other entries for the same node and same snap */
- list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
- missed_snaps) {
+ cds_list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
+ missed_snaps) {
snprintf (node_snap_info, sizeof(node_snap_info),
"%s:%s", missed_snapinfo->node_uuid,
missed_snapinfo->snap_uuid);
@@ -7999,10 +8009,10 @@ glusterd_add_new_entry_to_list (char *missed_info, char *snap_vol_id,
goto out;
}
- list_add_tail (&missed_snap_op->snap_ops_list,
- &missed_snapinfo->snap_ops);
- list_add_tail (&missed_snapinfo->missed_snaps,
- &priv->missed_snaps_list);
+ cds_list_add_tail (&missed_snap_op->snap_ops_list,
+ &missed_snapinfo->snap_ops);
+ cds_list_add_tail (&missed_snapinfo->missed_snaps,
+ &priv->missed_snaps_list);
ret = 0;
goto out;
@@ -8253,7 +8263,7 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
* set the status to the original volume's status. */
glusterd_set_volume_status (new_volinfo, orig_vol->status);
- list_add_tail (&new_volinfo->vol_list, &conf->volumes);
+ cds_list_add_tail (&new_volinfo->vol_list, &conf->volumes);
ret = glusterd_store_volinfo (new_volinfo,
GLUSTERD_VOLINFO_VER_AC_INCREMENT);
@@ -8272,10 +8282,11 @@ out:
if (new_volinfo)
(void)glusterd_volinfo_delete (new_volinfo);
} else {
- list_for_each_entry_safe (voliter, temp_volinfo,
- &orig_vol->snap_volumes, snapvol_list) {
- list_add_tail (&voliter->snapvol_list,
- &new_volinfo->snap_volumes);
+ cds_list_for_each_entry_safe (voliter, temp_volinfo,
+ &orig_vol->snap_volumes,
+ snapvol_list) {
+ cds_list_add_tail (&voliter->snapvol_list,
+ &new_volinfo->snap_volumes);
}
}
@@ -8317,8 +8328,8 @@ glusterd_snapshot_get_volnames_uuids (dict_t *dict,
goto out;
}
- list_for_each_entry_safe (snap_vol, tmp_vol, &volinfo->snap_volumes,
- snapvol_list) {
+ cds_list_for_each_entry_safe (snap_vol, tmp_vol, &volinfo->snap_volumes,
+ snapvol_list) {
if (GLUSTERD_STATUS_STARTED != snap_vol->status)
continue;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 70e3536af85..047ff942cec 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -622,7 +622,7 @@ glusterd_store_remove_bricks (glusterd_volinfo_t *volinfo, char *delete_path)
GF_ASSERT (volinfo);
- list_for_each_entry (tmp, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (tmp, &volinfo->bricks, brick_list) {
ret = glusterd_store_delete_brick (tmp, delete_path);
if (ret)
goto out;
@@ -1238,7 +1238,7 @@ glusterd_store_brickinfos (glusterd_volinfo_t *volinfo, int vol_fd)
GF_ASSERT (volinfo);
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
ret = glusterd_store_brickinfo (volinfo, brickinfo,
brick_count, vol_fd);
if (ret)
@@ -1476,7 +1476,7 @@ glusterd_store_bricks_cleanup_tmp (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) {
gf_store_unlink_tmppath (brickinfo->shandle);
}
}
@@ -1505,7 +1505,7 @@ glusterd_store_brickinfos_atomic_update (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 = gf_store_rename_tmppath (brickinfo->shandle);
if (ret)
goto out;
@@ -2373,7 +2373,7 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
brickid++);
}
- list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
+ cds_list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
brick_count++;
}
@@ -2901,8 +2901,9 @@ glusterd_store_retrieve_volume (char *volname, glusterd_snap_t *snap)
if (!snap) {
- list_add_order (&volinfo->vol_list, &priv->volumes,
- glusterd_compare_volume_name);
+ glusterd_list_add_order (&volinfo->vol_list, &priv->volumes,
+ glusterd_compare_volume_name);
+
} else {
ret = glusterd_volinfo_find (volinfo->parent_volname,
&origin_volinfo);
@@ -3231,7 +3232,7 @@ glusterd_recreate_vol_brick_mounts (xlator_t *this,
GF_ASSERT (volinfo);
brick_count = 0;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
brick_count++;
/* If the brick is not of this node, or its
* snapshot is pending, or the brick is not
@@ -3309,8 +3310,9 @@ glusterd_resolve_snap_bricks (xlator_t *this, glusterd_snap_t *snap)
GF_ASSERT (this);
GF_VALIDATE_OR_GOTO (this->name, snap, out);
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
ret = glusterd_resolve_brick (brickinfo);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -3453,8 +3455,8 @@ glusterd_store_retrieve_snap (char *snapname)
/* TODO: list_add_order can do 'N-square' comparisions and
is not efficient. Find a better solution to store the snap
in order */
- list_add_order (&snap->snap_list, &priv->snapshots,
- glusterd_compare_snap_time);
+ glusterd_list_add_order (&snap->snap_list, &priv->snapshots,
+ glusterd_compare_snap_time);
out:
gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
@@ -3635,11 +3637,11 @@ glusterd_store_write_missed_snapinfo (int32_t fd)
GF_ASSERT (priv);
/* Write the missed_snap_entry */
- list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
- missed_snaps) {
- list_for_each_entry (snap_opinfo,
- &missed_snapinfo->snap_ops,
- snap_ops_list) {
+ cds_list_for_each_entry (missed_snapinfo, &priv->missed_snaps_list,
+ missed_snaps) {
+ cds_list_for_each_entry (snap_opinfo,
+ &missed_snapinfo->snap_ops,
+ snap_ops_list) {
snprintf (key, sizeof(key), "%s:%s",
missed_snapinfo->node_uuid,
missed_snapinfo->snap_uuid);
@@ -3911,7 +3913,8 @@ glusterd_store_peer_write (int fd, glusterd_peerinfo_t *peerinfo)
if (ret)
goto out;
- list_for_each_entry (hostname, &peerinfo->hostnames, hostname_list) {
+ cds_list_for_each_entry (hostname, &peerinfo->hostnames,
+ hostname_list) {
ret = gf_asprintf (&key, GLUSTERD_STORE_KEY_PEER_HOSTNAME"%d",
i);
if (ret < 0)
@@ -4074,8 +4077,9 @@ glusterd_store_retrieve_peers (xlator_t *this)
/* Set first hostname from peerinfo->hostnames to
* peerinfo->hostname
*/
- address = list_entry (peerinfo->hostnames.next,
- glusterd_peer_hostname_t, hostname_list);
+ address = cds_list_entry (peerinfo->hostnames.next,
+ glusterd_peer_hostname_t,
+ hostname_list);
if (!address) {
ret = -1;
goto out;
@@ -4092,7 +4096,7 @@ glusterd_store_retrieve_peers (xlator_t *this)
}
args.mode = GD_MODE_ON;
- list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &priv->peers, uuid_list) {
ret = glusterd_friend_rpc_create (this, peerinfo, &args);
if (ret)
goto out;
@@ -4128,7 +4132,7 @@ glusterd_recreate_all_snap_brick_mounts (xlator_t *this)
GF_ASSERT (priv);
/* Recreate bricks of volumes restored from snaps */
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
/* If the volume is not a restored volume then continue */
if (uuid_is_null (volinfo->restored_from_snap))
continue;
@@ -4143,8 +4147,8 @@ glusterd_recreate_all_snap_brick_mounts (xlator_t *this)
}
/* Recreate bricks of snapshot volumes */
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
ret = glusterd_recreate_vol_brick_mounts (this,
volinfo);
if (ret) {
@@ -4195,7 +4199,8 @@ glusterd_snap_cleanup (xlator_t *this)
goto out;
}
- list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry_safe (snap, tmp_snap, &priv->snapshots,
+ snap_list) {
if (snap->snap_status == GD_SNAP_STATUS_RESTORED) {
ret = glusterd_snapshot_revert_restore_from_snap (snap);
if (ret) {
@@ -4238,8 +4243,9 @@ glusterd_resolve_all_bricks (xlator_t *this)
GF_ASSERT (priv);
/* Resolve bricks of volumes */
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
ret = glusterd_resolve_brick (brickinfo);
if (ret) {
gf_log ("glusterd", GF_LOG_ERROR,
@@ -4250,7 +4256,7 @@ glusterd_resolve_all_bricks (xlator_t *this)
}
/* Resolve bricks of snapshot volumes */
- list_for_each_entry (snap, &priv->snapshots, snap_list) {
+ cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
ret = glusterd_resolve_snap_bricks (this, snap);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
index 83eeda30c81..af4272231d2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
@@ -307,7 +307,7 @@ glusterd_svc_common_rpc_notify (glusterd_conn_t *conn,
GF_ASSERT (this);
/* Get the parent onject i.e. svc using list_entry macro */
- svc = list_entry (conn, glusterd_svc_t, conn);
+ svc = cds_list_entry (conn, glusterd_svc_t, conn);
if (!svc) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get the service");
return -1;
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index f37aa483a00..15b713d2296 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -1067,8 +1067,8 @@ out:
int
-gd_build_peers_list (struct list_head *peers, struct list_head *xact_peers,
- glusterd_op_t op)
+gd_build_peers_list (struct cds_list_head *peers,
+ struct cds_list_head *xact_peers, glusterd_op_t op)
{
glusterd_peerinfo_t *peerinfo = NULL;
int npeers = 0;
@@ -1076,22 +1076,22 @@ gd_build_peers_list (struct list_head *peers, struct list_head *xact_peers,
GF_ASSERT (peers);
GF_ASSERT (xact_peers);
- list_for_each_entry (peerinfo, peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, peers, uuid_list) {
if (!peerinfo->connected)
continue;
if (op != GD_OP_SYNC_VOLUME &&
peerinfo->state.state != GD_FRIEND_STATE_BEFRIENDED)
continue;
- list_add_tail (&peerinfo->op_peers_list, xact_peers);
+ cds_list_add_tail (&peerinfo->op_peers_list, xact_peers);
npeers++;
}
return npeers;
}
int
-gd_build_local_xaction_peers_list (struct list_head *peers,
- struct list_head *xact_peers,
+gd_build_local_xaction_peers_list (struct cds_list_head *peers,
+ struct cds_list_head *xact_peers,
glusterd_op_t op)
{
glusterd_peerinfo_t *peerinfo = NULL;
@@ -1101,7 +1101,7 @@ gd_build_local_xaction_peers_list (struct list_head *peers,
GF_ASSERT (peers);
GF_ASSERT (xact_peers);
- list_for_each_entry (peerinfo, peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, peers, uuid_list) {
if (!peerinfo->connected)
continue;
if (op != GD_OP_SYNC_VOLUME &&
@@ -1113,26 +1113,27 @@ gd_build_local_xaction_peers_list (struct list_head *peers,
if (!local_peers) {
return -1;
}
- INIT_LIST_HEAD (&local_peers->op_peers_list);
+ CDS_INIT_LIST_HEAD (&local_peers->op_peers_list);
local_peers->peerinfo = peerinfo;
- list_add_tail (&local_peers->op_peers_list, xact_peers);
+ cds_list_add_tail (&local_peers->op_peers_list, xact_peers);
npeers++;
}
return npeers;
}
void
-gd_cleanup_local_xaction_peers_list (struct list_head *xact_peers)
+gd_cleanup_local_xaction_peers_list (struct cds_list_head *xact_peers)
{
glusterd_local_peers_t *local_peers = NULL;
glusterd_local_peers_t *tmp = NULL;
GF_ASSERT (xact_peers);
- if (list_empty (xact_peers))
+ if (cds_list_empty (xact_peers))
return;
- list_for_each_entry_safe (local_peers, tmp, xact_peers, op_peers_list) {
+ cds_list_for_each_entry_safe (local_peers, tmp, xact_peers,
+ op_peers_list) {
GF_FREE (local_peers);
/* local_peers->peerinfo need not be freed because it does not
* ownership of peerinfo, but merely refer it */
@@ -1142,7 +1143,7 @@ gd_cleanup_local_xaction_peers_list (struct list_head *xact_peers)
int
gd_lock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, dict_t *op_ctx,
char **op_errstr, int npeers, uuid_t txn_id,
- struct list_head *peers)
+ struct cds_list_head *peers)
{
int ret = -1;
int peer_cnt = 0;
@@ -1197,8 +1198,9 @@ out:
}
int
-gd_stage_op_phase (struct list_head *peers, glusterd_op_t op, dict_t *op_ctx,
- dict_t *req_dict, char **op_errstr, int npeers)
+gd_stage_op_phase (struct cds_list_head *peers, glusterd_op_t op,
+ dict_t *op_ctx, dict_t *req_dict, char **op_errstr,
+ int npeers)
{
int ret = -1;
int peer_cnt = 0;
@@ -1304,8 +1306,9 @@ out:
}
int
-gd_commit_op_phase (struct list_head *peers, glusterd_op_t op, dict_t *op_ctx,
- dict_t *req_dict, char **op_errstr, int npeers)
+gd_commit_op_phase (struct cds_list_head *peers, glusterd_op_t op,
+ dict_t *op_ctx, dict_t *req_dict, char **op_errstr,
+ int npeers)
{
dict_t *rsp_dict = NULL;
int peer_cnt = -1;
@@ -1407,7 +1410,7 @@ int
gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int *op_ret,
rpcsvc_request_t *req, dict_t *op_ctx, char *op_errstr,
int npeers, char *volname, gf_boolean_t is_acquired,
- uuid_t txn_id, struct list_head *peers)
+ uuid_t txn_id, struct cds_list_head *peers)
{
glusterd_peerinfo_t *peerinfo = NULL;
uuid_t tmp_uuid = {0};
@@ -1505,11 +1508,11 @@ out:
}
int
-gd_get_brick_count (struct list_head *bricks)
+gd_get_brick_count (struct cds_list_head *bricks)
{
glusterd_pending_node_t *pending_node = NULL;
int npeers = 0;
- list_for_each_entry (pending_node, bricks, list) {
+ cds_list_for_each_entry (pending_node, bricks, list) {
npeers++;
}
return npeers;
@@ -1520,7 +1523,7 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
char **op_errstr)
{
glusterd_pending_node_t *pending_node = NULL;
- struct list_head selected = {0,};
+ struct cds_list_head selected = {0,};
xlator_t *this = NULL;
int brick_count = 0;
int ret = -1;
@@ -1536,7 +1539,7 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
goto out;
}
- INIT_LIST_HEAD (&selected);
+ CDS_INIT_LIST_HEAD (&selected);
ret = glusterd_op_bricks_select (op, req_dict, op_errstr, &selected,
rsp_dict);
if (ret) {
@@ -1555,7 +1558,7 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
rsp_dict = NULL;
brick_count = 0;
- list_for_each_entry (pending_node, &selected, list) {
+ cds_list_for_each_entry (pending_node, &selected, list) {
rpc = glusterd_pending_node_get_rpc (pending_node);
if (!rpc) {
if (pending_node->type == GD_NODE_REBALANCE) {
@@ -1603,7 +1606,7 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
xlator_t *this = NULL;
gf_boolean_t is_acquired = _gf_false;
uuid_t *txn_id = NULL;
- struct list_head xaction_peers = {0,};
+ struct cds_list_head xaction_peers = {0,};
glusterd_op_info_t txn_opinfo;
this = THIS;
@@ -1611,7 +1614,7 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req)
conf = this->private;
GF_ASSERT (conf);
- INIT_LIST_HEAD (&xaction_peers);
+ CDS_INIT_LIST_HEAD (&xaction_peers);
ret = dict_get_int32 (op_ctx, GD_SYNC_OPCODE_KEY, &tmp_op);
if (ret) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.h b/xlators/mgmt/glusterd/src/glusterd-syncop.h
index e0733dc8006..18bb1a1ecd8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.h
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.h
@@ -37,15 +37,15 @@
} while (0)
-#define list_for_each_local_xaction_peers(xact_peer, xact_peers_head) \
- glusterd_local_peers_t *pos = NULL; \
- for (pos = list_entry((xact_peers_head)->next, glusterd_local_peers_t,\
- op_peers_list), \
- xact_peer = pos->peerinfo; \
- &pos->op_peers_list != (xact_peers_head); \
- pos = list_entry(pos->op_peers_list.next, glusterd_local_peers_t,\
- op_peers_list), \
- xact_peer = pos->peerinfo)
+#define list_for_each_local_xaction_peers(xact_peer, xact_peers_head) \
+ glusterd_local_peers_t *pos = NULL; \
+ for (pos = cds_list_entry ((xact_peers_head)->next, \
+ glusterd_local_peers_t, op_peers_list), \
+ xact_peer = pos->peerinfo; \
+ &pos->op_peers_list != (xact_peers_head); \
+ pos = cds_list_entry(pos->op_peers_list.next, \
+ glusterd_local_peers_t, op_peers_list), \
+ xact_peer = pos->peerinfo)
int gd_syncop_submit_request (struct rpc_clnt *rpc, void *req, void *local,
void *cookie, rpc_clnt_prog_t *prog, int procnum,
@@ -70,16 +70,16 @@ void
gd_synctask_barrier_wait (struct syncargs *args, int count);
int
-gd_build_peers_list (struct list_head *peers, struct list_head *xact_peers,
- glusterd_op_t op);
+gd_build_peers_list (struct cds_list_head *peers,
+ struct cds_list_head *xact_peers, glusterd_op_t op);
int
-gd_build_local_xaction_peers_list (struct list_head *peers,
- struct list_head *xact_peers,
+gd_build_local_xaction_peers_list (struct cds_list_head *peers,
+ struct cds_list_head *xact_peers,
glusterd_op_t op);
void
-gd_cleanup_local_xaction_peers_list (struct list_head *peers);
+gd_cleanup_local_xaction_peers_list (struct cds_list_head *peers);
int
gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 04fa67c6df1..84cdfca3049 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -477,10 +477,10 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo)
goto out;
LOCK_INIT (&new_volinfo->lock);
- INIT_LIST_HEAD (&new_volinfo->vol_list);
- INIT_LIST_HEAD (&new_volinfo->snapvol_list);
- INIT_LIST_HEAD (&new_volinfo->bricks);
- INIT_LIST_HEAD (&new_volinfo->snap_volumes);
+ CDS_INIT_LIST_HEAD (&new_volinfo->vol_list);
+ CDS_INIT_LIST_HEAD (&new_volinfo->snapvol_list);
+ CDS_INIT_LIST_HEAD (&new_volinfo->bricks);
+ CDS_INIT_LIST_HEAD (&new_volinfo->snap_volumes);
new_volinfo->dict = dict_new ();
if (!new_volinfo->dict) {
@@ -709,7 +709,7 @@ glusterd_brickinfo_delete (glusterd_brickinfo_t *brickinfo)
GF_ASSERT (brickinfo);
- list_del_init (&brickinfo->brick_list);
+ cds_list_del_init (&brickinfo->brick_list);
GF_FREE (brickinfo->logfile);
GF_FREE (brickinfo);
@@ -728,8 +728,8 @@ glusterd_volume_brickinfos_delete (glusterd_volinfo_t *volinfo)
GF_ASSERT (volinfo);
- list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
ret = glusterd_brickinfo_delete (brickinfo);
if (ret)
goto out;
@@ -743,7 +743,7 @@ out:
int
glusterd_volinfo_remove (glusterd_volinfo_t *volinfo)
{
- list_del_init (&volinfo->vol_list);
+ cds_list_del_init (&volinfo->vol_list);
glusterd_volinfo_unref (volinfo);
return 0;
}
@@ -755,8 +755,8 @@ glusterd_volinfo_delete (glusterd_volinfo_t *volinfo)
GF_ASSERT (volinfo);
- list_del_init (&volinfo->vol_list);
- list_del_init (&volinfo->snapvol_list);
+ cds_list_del_init (&volinfo->vol_list);
+ cds_list_del_init (&volinfo->snapvol_list);
ret = glusterd_volume_brickinfos_delete (volinfo);
if (ret)
@@ -798,7 +798,7 @@ glusterd_brickinfo_new (glusterd_brickinfo_t **brickinfo)
if (!new_brickinfo)
goto out;
- INIT_LIST_HEAD (&new_brickinfo->brick_list);
+ CDS_INIT_LIST_HEAD (&new_brickinfo->brick_list);
*brickinfo = new_brickinfo;
@@ -818,7 +818,7 @@ glusterd_get_next_available_brickid (glusterd_volinfo_t *volinfo)
int max_brickid = -1;
int ret = -1;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
token = strrchr (brickinfo->brick_id, '-');
ret = gf_string2int32 (++token, &brickid);
if (ret < 0) {
@@ -1025,8 +1025,9 @@ glusterd_is_brickpath_available (uuid_t uuid, char *path)
strncpy(tmp_path,path,PATH_MAX);
}
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
if (uuid_compare (uuid, brickinfo->uuid))
continue;
@@ -1331,7 +1332,7 @@ glusterd_volume_brickinfo_get (uuid_t uuid, char *hostname, char *path,
goto out;
}
ret = -1;
- list_for_each_entry (brickiter, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickiter, &volinfo->bricks, brick_list) {
if ((uuid_is_null (brickiter->uuid)) &&
(glusterd_resolve_brick (brickiter) != 0))
@@ -1410,7 +1411,7 @@ glusterd_volinfo_find_by_volume_id (uuid_t volume_id, glusterd_volinfo_t **volin
this = THIS;
priv = this->private;
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (uuid_compare (volume_id, voliter->volume_id))
continue;
*volinfo = voliter;
@@ -1437,7 +1438,7 @@ glusterd_volinfo_find (char *volname, glusterd_volinfo_t **volinfo)
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) {
if (!strcmp (tmp_volinfo->volname, volname)) {
gf_log (this->name, GF_LOG_DEBUG, "Volume %s found",
volname);
@@ -1845,7 +1846,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
priv = this->private;
if (del_brick)
- list_del_init (&brickinfo->brick_list);
+ cds_list_del_init (&brickinfo->brick_list);
if (GLUSTERD_STATUS_STARTED == volinfo->status) {
(void) glusterd_brick_disconnect (brickinfo);
@@ -2145,7 +2146,7 @@ glusterd_add_bricks_hname_path_to_dict (dict_t *dict,
int index = 0;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
snprintf (key, sizeof (key), "%d-hostname", index);
ret = dict_set_str (dict, key, brickinfo->hostname);
if (ret)
@@ -2420,7 +2421,7 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s%d.brick%d.hostname",
prefix, count, i);
@@ -2598,7 +2599,7 @@ glusterd_add_volumes_to_export_dict (dict_t **peer_data)
if (!dict)
goto out;
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
count++;
ret = glusterd_add_volume_to_dict (volinfo, dict, count,
"volume");
@@ -2898,7 +2899,7 @@ _does_quorum_meet (int active_count, int quorum_count)
int
glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
int *quorum_count,
- struct list_head *peer_list,
+ struct cds_list_head *peer_list,
gf_boolean_t _local_xaction_peers)
{
glusterd_peerinfo_t *peerinfo = NULL;
@@ -2918,7 +2919,7 @@ glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
*active_count = 1;
if (!peer_list) {
- list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
glusterd_quorum_count(peerinfo, inquorum_count,
active_count, out);
}
@@ -2930,8 +2931,8 @@ glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
active_count, out);
}
} else {
- list_for_each_entry (peerinfo, peer_list,
- op_peers_list) {
+ cds_list_for_each_entry (peerinfo, peer_list,
+ op_peers_list) {
glusterd_quorum_count(peerinfo, inquorum_count,
active_count, out);
}
@@ -2981,7 +2982,7 @@ glusterd_is_any_volume_in_server_quorum (xlator_t *this)
glusterd_volinfo_t *volinfo = NULL;
conf = this->private;
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
if (glusterd_is_volume_in_server_quorum (volinfo)) {
return _gf_true;
}
@@ -2990,7 +2991,7 @@ glusterd_is_any_volume_in_server_quorum (xlator_t *this)
}
gf_boolean_t
-does_gd_meet_server_quorum (xlator_t *this, struct list_head *peers_list,
+does_gd_meet_server_quorum (xlator_t *this, struct cds_list_head *peers_list,
gf_boolean_t _local_xaction_peers)
{
int quorum_count = 0;
@@ -3085,7 +3086,7 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
"bricks.", volinfo->volname);
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (!glusterd_is_local_brick (this, volinfo, brickinfo))
continue;
if (quorum_status == DOESNT_MEET_QUORUM)
@@ -3126,7 +3127,7 @@ glusterd_do_quorum_action ()
if (_does_quorum_meet (active_count, quorum_count))
meets = _gf_true;
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
glusterd_do_volume_quorum_action (this, volinfo, meets);
}
}
@@ -3309,7 +3310,8 @@ glusterd_import_bricks (dict_t *peer_data, int32_t vol_count,
GLUSTERD_ASSIGN_BRICKID_TO_BRICKINFO (new_brickinfo,
new_volinfo,
brickid++);
- list_add_tail (&new_brickinfo->brick_list, &new_volinfo->bricks);
+ cds_list_add_tail (&new_brickinfo->brick_list,
+ &new_volinfo->bricks);
brick_count++;
}
ret = 0;
@@ -3821,7 +3823,7 @@ glusterd_volume_disconnect_all_bricks (glusterd_volinfo_t *volinfo)
glusterd_brickinfo_t *brickinfo = NULL;
GF_ASSERT (volinfo);
- 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)) {
ret = glusterd_brick_disconnect (brickinfo);
if (ret) {
@@ -3857,11 +3859,13 @@ glusterd_volinfo_copy_brick_portinfo (glusterd_volinfo_t *new_volinfo,
if (_gf_false == glusterd_is_volume_started (new_volinfo))
goto out;
- list_for_each_entry (new_brickinfo, &new_volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (new_brickinfo, &new_volinfo->bricks,
+ brick_list) {
ret = glusterd_volume_brickinfo_get (new_brickinfo->uuid,
new_brickinfo->hostname,
new_brickinfo->path,
- old_volinfo, &old_brickinfo);
+ old_volinfo,
+ &old_brickinfo);
if (ret == 0) {
GLUSTERD_GET_BRICK_PIDFILE (pidfile, old_volinfo,
old_brickinfo, priv);
@@ -3887,11 +3891,13 @@ glusterd_volinfo_stop_stale_bricks (glusterd_volinfo_t *new_volinfo,
GF_ASSERT (old_volinfo);
if (_gf_false == glusterd_is_volume_started (old_volinfo))
goto out;
- list_for_each_entry (old_brickinfo, &old_volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (old_brickinfo, &old_volinfo->bricks,
+ brick_list) {
ret = glusterd_volume_brickinfo_get (old_brickinfo->uuid,
old_brickinfo->hostname,
old_brickinfo->path,
- new_volinfo, &new_brickinfo);
+ new_volinfo,
+ &new_brickinfo);
/* If the brick is stale, i.e it's not a part of the new volume
* or if it's part of the new volume and is pending a snap,
* then stop the brick process
@@ -3932,10 +3938,11 @@ glusterd_delete_stale_volume (glusterd_volinfo_t *stale_volinfo,
/* Copy snap_volumes list from stale_volinfo to valid_volinfo */
valid_volinfo->snap_count = 0;
- list_for_each_entry_safe (voliter, temp_volinfo,
- &stale_volinfo->snap_volumes, snapvol_list) {
- list_add_tail (&voliter->snapvol_list,
- &valid_volinfo->snap_volumes);
+ cds_list_for_each_entry_safe (voliter, temp_volinfo,
+ &stale_volinfo->snap_volumes,
+ snapvol_list) {
+ cds_list_add_tail (&voliter->snapvol_list,
+ &valid_volinfo->snap_volumes);
valid_volinfo->snap_count++;
}
@@ -4110,8 +4117,9 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
if (ret)
goto out;
- list_add_order (&new_volinfo->vol_list, &priv->volumes,
- glusterd_compare_volume_name);
+ glusterd_list_add_order (&new_volinfo->vol_list, &priv->volumes,
+ glusterd_compare_volume_name);
+
out:
gf_log ("", GF_LOG_DEBUG, "Returning with ret: %d", ret);
return ret;
@@ -4534,7 +4542,7 @@ glusterd_are_all_volumes_stopped ()
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (voliter->status == GLUSTERD_STATUS_STARTED)
return _gf_false;
}
@@ -4555,7 +4563,7 @@ glusterd_all_shd_compatible_volumes_stopped ()
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (!glusterd_is_shd_compatible_volume (voliter))
continue;
if (voliter->status == GLUSTERD_STATUS_STARTED)
@@ -4577,7 +4585,7 @@ glusterd_all_volumes_with_quota_stopped ()
priv = this->private;
GF_ASSERT (priv);
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (!glusterd_is_volume_quota_enabled (voliter))
continue;
if (voliter->status == GLUSTERD_STATUS_STARTED)
@@ -4600,7 +4608,7 @@ glusterd_volume_count_get (void)
priv = this->private;
- list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (tmp_volinfo, &priv->volumes, vol_list) {
ret++;
}
@@ -4626,7 +4634,7 @@ glusterd_brickinfo_get (uuid_t uuid, char *hostname, char *path,
priv = this->private;
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
ret = glusterd_volume_brickinfo_get (uuid, hostname, path,
volinfo, brickinfo);
@@ -4690,26 +4698,27 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
this = THIS;
GF_ASSERT (this);
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
if (volinfo->status != GLUSTERD_STATUS_STARTED)
continue;
start_svcs = _gf_true;
gf_log (this->name, GF_LOG_DEBUG, "starting the volume %s",
volinfo->volname);
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
glusterd_brick_start (volinfo, brickinfo, _gf_false);
}
}
- list_for_each_entry (snap, &conf->snapshots, snap_list) {
- list_for_each_entry (volinfo, &snap->volumes, vol_list) {
+ cds_list_for_each_entry (snap, &conf->snapshots, snap_list) {
+ cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
if (volinfo->status != GLUSTERD_STATUS_STARTED)
continue;
start_svcs = _gf_true;
gf_log (this->name, GF_LOG_DEBUG, "starting the snap "
"volume %s", volinfo->volname);
- list_for_each_entry (brickinfo, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
glusterd_brick_start (volinfo, brickinfo,
_gf_false);
}
@@ -4911,7 +4920,7 @@ glusterd_restart_gsyncds (glusterd_conf_t *conf)
glusterd_volinfo_t *volinfo = NULL;
int ret = 0;
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
glusterd_volume_restart_gsyncds (volinfo);
}
return ret;
@@ -4942,9 +4951,9 @@ glusterd_get_brickinfo (xlator_t *this, const char *brickname, int port,
GF_ASSERT (this);
priv = this->private;
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
- list_for_each_entry (tmpbrkinfo, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (tmpbrkinfo, &volinfo->bricks,
+ brick_list) {
if (localhost && !gf_is_local_addr (tmpbrkinfo->hostname))
continue;
if (!strcmp(tmpbrkinfo->path, brickname) &&
@@ -4962,8 +4971,7 @@ glusterd_get_brickinfo_by_position (glusterd_volinfo_t *volinfo, uint32_t pos)
{
glusterd_brickinfo_t *tmpbrkinfo = NULL;
- list_for_each_entry (tmpbrkinfo, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry (tmpbrkinfo, &volinfo->bricks, brick_list) {
if (pos == 0)
return tmpbrkinfo;
pos--;
@@ -5540,7 +5548,7 @@ glusterd_get_all_volnames (dict_t *dict)
priv = THIS->private;
GF_ASSERT (priv);
- list_for_each_entry (entry, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (entry, &priv->volumes, vol_list) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "vol%d", vol_count);
ret = dict_set_str (dict, key, entry->volname);
@@ -5572,9 +5580,9 @@ glusterd_all_volume_cond_check (glusterd_condition_func func, int status,
this = THIS;
priv = this->private;
- list_for_each_entry (volinfo, &priv->volumes, vol_list) {
- list_for_each_entry (brickinfo, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
ret = func (volinfo, brickinfo, ctx);
if (ret != status) {
ret = -1;
@@ -6135,15 +6143,15 @@ out:
}
int
-glusterd_remove_pending_entry (struct list_head *list, void *elem)
+glusterd_remove_pending_entry (struct cds_list_head *list, void *elem)
{
glusterd_pending_node_t *pending_node = NULL;
glusterd_pending_node_t *tmp = NULL;
int ret = 0;
- list_for_each_entry_safe (pending_node, tmp, list, list) {
+ cds_list_for_each_entry_safe (pending_node, tmp, list, list) {
if (elem == pending_node->node) {
- list_del_init (&pending_node->list);
+ cds_list_del_init (&pending_node->list);
GF_FREE (pending_node);
ret = 0;
goto out;
@@ -6156,13 +6164,13 @@ out:
}
int
-glusterd_clear_pending_nodes (struct list_head *list)
+glusterd_clear_pending_nodes (struct cds_list_head *list)
{
glusterd_pending_node_t *pending_node = NULL;
glusterd_pending_node_t *tmp = NULL;
- list_for_each_entry_safe (pending_node, tmp, list, list) {
- list_del_init (&pending_node->list);
+ cds_list_for_each_entry_safe (pending_node, tmp, list, list) {
+ cds_list_del_init (&pending_node->list);
GF_FREE (pending_node);
}
@@ -6214,7 +6222,8 @@ glusterd_delete_all_bricks (glusterd_volinfo_t* volinfo)
GF_ASSERT (volinfo);
- list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks,
+ brick_list) {
ret = glusterd_delete_brick (volinfo, brickinfo);
}
return ret;
@@ -6244,7 +6253,7 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
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))
continue;
@@ -6400,7 +6409,7 @@ glusterd_recreate_volfiles (glusterd_conf_t *conf)
int op_ret = 0;
GF_ASSERT (conf);
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
ret = generate_brick_volfiles (volinfo);
if (ret) {
gf_log ("glusterd", GF_LOG_ERROR, "Failed to "
@@ -6800,7 +6809,7 @@ glusterd_friend_contains_vol_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) {
if (!uuid_compare (brickinfo->uuid, friend_uuid)) {
count++;
}
@@ -6831,8 +6840,8 @@ glusterd_friend_remove_cleanup_vols (uuid_t uuid)
priv = THIS->private;
GF_ASSERT (priv);
- list_for_each_entry_safe (volinfo, tmp_volinfo,
- &priv->volumes, vol_list) {
+ cds_list_for_each_entry_safe (volinfo, tmp_volinfo, &priv->volumes,
+ vol_list) {
if (glusterd_friend_contains_vol_bricks (volinfo, uuid) == 2) {
gf_log (THIS->name, GF_LOG_INFO,
"Deleting stale volume %s", volinfo->volname);
@@ -6965,7 +6974,7 @@ glusterd_restart_rebalance (glusterd_conf_t *conf)
int ret = 0;
char op_errstr[256];
- list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
if (!volinfo->rebal.defrag_cmd)
continue;
if (!gd_should_i_start_rebalance (volinfo))
@@ -8067,7 +8076,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
node_uuid_str = gf_strdup (node_uuid);
/* Finding the index of the node-uuid in the peer-list */
- list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
+ cds_list_for_each_entry (peerinfo, &conf->peers, uuid_list) {
peer_uuid_str = gd_peer_uuid_str (peerinfo);
if (strcmp (peer_uuid_str, node_uuid_str) == 0)
break;
@@ -9093,7 +9102,7 @@ gd_should_i_start_rebalance (glusterd_volinfo_t *volinfo) {
switch (volinfo->rebal.op) {
case GD_OP_REBALANCE:
- list_for_each_entry (brick, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brick, &volinfo->bricks, brick_list) {
if (uuid_compare (MY_UUID, brick->uuid) == 0) {
retval = _gf_true;
break;
@@ -9393,13 +9402,14 @@ glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc)
}
int32_t
-glusterd_compare_volume_name(struct list_head *list1, struct list_head *list2)
+glusterd_compare_volume_name(struct cds_list_head *list1,
+ struct cds_list_head *list2)
{
glusterd_volinfo_t *volinfo1 = NULL;
glusterd_volinfo_t *volinfo2 = NULL;
- volinfo1 = list_entry(list1, glusterd_volinfo_t, vol_list);
- volinfo2 = list_entry(list2, glusterd_volinfo_t, vol_list);
+ volinfo1 = cds_list_entry (list1, glusterd_volinfo_t, vol_list);
+ volinfo2 = cds_list_entry (list2, glusterd_volinfo_t, vol_list);
return strcmp(volinfo1->volname, volinfo2->volname);
}
@@ -9557,7 +9567,7 @@ glusterd_get_value_for_vme_entry (struct volopt_map_entry *vme, char **def_val)
this = THIS;
GF_ASSERT (this);
- INIT_LIST_HEAD (&vol_opt_handle.list);
+ CDS_INIT_LIST_HEAD (&vol_opt_handle.list);
if (_get_xlator_opt_key_from_vme (vme, &key)) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get %s key from "
@@ -9715,7 +9725,7 @@ glusterd_get_volopt_content (dict_t * ctx, gf_boolean_t xml_out)
}
#endif
- INIT_LIST_HEAD (&vol_opt_handle.list);
+ CDS_INIT_LIST_HEAD (&vol_opt_handle.list);
for (vme = &glusterd_volopt_map[0]; vme->key; vme++) {
@@ -9863,7 +9873,7 @@ glusterd_have_peers ()
conf = this->private;
GF_ASSERT (conf);
- return !list_empty (&conf->peers);
+ return !cds_list_empty (&conf->peers);
}
void
@@ -9880,10 +9890,10 @@ glusterd_op_clear_xaction_peers ()
GF_ASSERT (this);
GF_ASSERT (priv);
- list_for_each_entry_safe (peerinfo, tmp, &priv->xaction_peers,
- op_peers_list) {
+ cds_list_for_each_entry_safe (peerinfo, tmp, &priv->xaction_peers,
+ op_peers_list) {
GF_ASSERT (peerinfo);
- list_del_init (&peerinfo->op_peers_list);
+ cds_list_del_init (&peerinfo->op_peers_list);
}
}
@@ -9895,3 +9905,23 @@ glusterd_is_volume_started (glusterd_volinfo_t *volinfo)
return (volinfo->status == GLUSTERD_STATUS_STARTED);
}
+/* This function will insert the element to the list in a order.
+ Order will be based on the compare function provided as a input.
+ If element to be inserted in ascending order compare should return:
+ 0: if both the arguments are equal
+ >0: if first argument is greater than second argument
+ <0: if first argument is less than second argument */
+void
+glusterd_list_add_order (struct cds_list_head *new, struct cds_list_head *head,
+ int (*compare)(struct cds_list_head *,
+ struct cds_list_head *))
+{
+ struct cds_list_head *pos = NULL;
+
+ cds_list_for_each_rcu (pos, head) {
+ if (compare (new, pos) >= 0)
+ break;
+ }
+
+ cds_list_add_rcu (new, pos);
+}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 62e2da03ad3..4cfb51a9904 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -295,9 +295,9 @@ int
glusterd_sm_tr_log_add_to_dict (dict_t *dict,
glusterd_sm_tr_log_t *circular_log);
int
-glusterd_remove_pending_entry (struct list_head *list, void *elem);
+glusterd_remove_pending_entry (struct cds_list_head *list, void *elem);
int
-glusterd_clear_pending_nodes (struct list_head *list);
+glusterd_clear_pending_nodes (struct cds_list_head *list);
int32_t
glusterd_brick_connect (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo, char *socketpath);
@@ -476,7 +476,7 @@ glusterd_do_quorum_action ();
int
glusterd_get_quorum_cluster_counts (xlator_t *this, int *active_count,
int *quorum_count,
- struct list_head *peer_list,
+ struct cds_list_head *peer_list,
gf_boolean_t _local__xaction_peers);
int
@@ -488,8 +488,7 @@ glusterd_is_volume_in_server_quorum (glusterd_volinfo_t *volinfo);
gf_boolean_t
glusterd_is_any_volume_in_server_quorum (xlator_t *this);
gf_boolean_t
-does_gd_meet_server_quorum (xlator_t *this,
- struct list_head *peers_list,
+does_gd_meet_server_quorum (xlator_t *this, struct cds_list_head *peers_list,
gf_boolean_t _local__xaction_peers);
int
@@ -581,7 +580,7 @@ rpc_clnt_t *
glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc);
int32_t
-glusterd_compare_volume_name(struct list_head *, struct list_head *);
+glusterd_compare_volume_name(struct cds_list_head *, struct cds_list_head *);
char*
glusterd_get_brick_mount_device (char *brick_path);
@@ -689,4 +688,9 @@ glusterd_nfs_pmap_deregister ();
gf_boolean_t
glusterd_is_volume_started (glusterd_volinfo_t *volinfo);
+void
+glusterd_list_add_order (struct cds_list_head *new, struct cds_list_head *head,
+ int (*compare)(struct cds_list_head *,
+ struct cds_list_head *));
+
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index d63416192d7..bdee0bf591b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -80,7 +80,7 @@ xlator_instantiate_va (const char *type, const char *format, va_list arg)
if (!xl->options)
goto error;
xl->name = volname;
- INIT_LIST_HEAD (&xl->volume_options);
+ CDS_INIT_LIST_HEAD (&xl->volume_options);
xl->ctx = THIS->ctx;
@@ -2555,7 +2555,7 @@ volgen_graph_build_clients (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
strcpy (transt, "tcp");
i = 0;
- list_for_each_entry (brick, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brick, &volinfo->bricks, brick_list) {
xl = volgen_graph_build_client (graph, volinfo,
brick->hostname, brick->path,
brick->brick_id,
@@ -3721,7 +3721,7 @@ build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict)
goto out;
}
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
ret = build_shd_volume_graph (this, graph, voliter, mod_dict,
set_dict, graph_check,
&valid_config);
@@ -3782,7 +3782,7 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
if (ret)
goto out;
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (voliter->status != GLUSTERD_STATUS_STARTED)
continue;
@@ -3880,7 +3880,7 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
goto out;
}
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (mod_dict) {
ret = volgen_graph_set_options_generic (graph, mod_dict, voliter,
@@ -4016,7 +4016,7 @@ build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict)
goto out;
}
- list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ cds_list_for_each_entry (voliter, &priv->volumes, vol_list) {
if (voliter->status != GLUSTERD_STATUS_STARTED)
continue;
@@ -4175,7 +4175,7 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
}
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
gf_log (this->name, GF_LOG_DEBUG,
"Found a brick - %s:%s", brickinfo->hostname,
brickinfo->path);
@@ -4659,7 +4659,7 @@ glusterd_validate_brickreconf (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo = NULL;
int ret = -1;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
gf_log ("", GF_LOG_DEBUG,
"Validating %s", brickinfo->hostname);
@@ -4864,7 +4864,7 @@ _gd_get_option_type (char *key)
vmep = _gd_get_vmep (key);
if (vmep) {
- INIT_LIST_HEAD (&vol_opt_list.list);
+ CDS_INIT_LIST_HEAD (&vol_opt_list.list);
ret = xlator_volopt_dynload (vmep->voltype, &dl_handle,
&vol_opt_list);
if (ret)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 99c658a7d48..6ca3e55a122 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -113,7 +113,7 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
ai_list = malloc (sizeof (addrinfo_list_t));
ai_list->info = NULL;
- INIT_LIST_HEAD (&ai_list->list);
+ CDS_INIT_LIST_HEAD (&ai_list->list);
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
@@ -189,19 +189,20 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
goto out;
}
ai_list_tmp1->info = ai_info;
- list_add_tail (&ai_list_tmp1->list, &ai_list->list);
+ cds_list_add_tail (&ai_list_tmp1->list, &ai_list->list);
ai_list_tmp1 = NULL;
}
i = 0;
- ai_list_tmp1 = list_entry (ai_list->list.next, addrinfo_list_t, list);
+ ai_list_tmp1 = cds_list_entry (ai_list->list.next,
+ addrinfo_list_t, list);
/* Check for bad brick order */
while (i < brick_count) {
++i;
ai_info = ai_list_tmp1->info;
- ai_list_tmp1 = list_entry (ai_list_tmp1->list.next,
- addrinfo_list_t, list);
+ ai_list_tmp1 = cds_list_entry (ai_list_tmp1->list.next,
+ addrinfo_list_t, list);
if (0 == i % sub_count) {
j = 0;
continue;
@@ -216,8 +217,8 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
goto check_failed;
if (GF_AI_COMPARE_MATCH == ret)
goto found_bad_brick_order;
- ai_list_tmp2 = list_entry (ai_list_tmp2->list.next,
- addrinfo_list_t, list);
+ ai_list_tmp2 = cds_list_entry (ai_list_tmp2->list.next,
+ addrinfo_list_t, list);
}
++j;
}
@@ -238,7 +239,7 @@ found_bad_brick_order:
out:
ai_list_tmp2 = NULL;
GF_FREE (brick_list_ptr);
- list_for_each_entry (ai_list_tmp1, &ai_list->list, list) {
+ cds_list_for_each_entry (ai_list_tmp1, &ai_list->list, list) {
if (ai_list_tmp1->info)
freeaddrinfo (ai_list_tmp1->info);
free (ai_list_tmp2);
@@ -1328,7 +1329,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr,
}
}
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
brick_count++;
ret = glusterd_resolve_brick (brickinfo);
if (ret) {
@@ -1585,7 +1586,8 @@ glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr)
goto out;
}
- if (volinfo->snap_count > 0 || !list_empty(&volinfo->snap_volumes)) {
+ if (volinfo->snap_count > 0 ||
+ !cds_list_empty (&volinfo->snap_volumes)) {
snprintf (msg, sizeof (msg), "Cannot delete Volume %s ,"
"as it has %"PRIu64" snapshots. "
"To delete the volume, "
@@ -2122,7 +2124,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
#endif
- list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
+ cds_list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
brick = strtok_r (NULL, " \n", &saveptr);
i++;
}
@@ -2159,8 +2161,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
}
volinfo->rebal.defrag_status = 0;
- list_add_order (&volinfo->vol_list, &priv->volumes,
- glusterd_compare_volume_name);
+ glusterd_list_add_order (&volinfo->vol_list, &priv->volumes,
+ glusterd_compare_volume_name);
vol_added = _gf_true;
out:
@@ -2184,7 +2186,7 @@ glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags,
GF_ASSERT (this);
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, wait);
/* If 'force' try to start all bricks regardless of success or
* failure
@@ -2252,7 +2254,8 @@ glusterd_op_start_volume (dict_t *dict, char **op_errstr)
* introduced in gluster-3.6.0
*/
if (conf->op_version >= GD_OP_VERSION_3_6_0) {
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
brick_count++;
/* Don't check bricks that are not owned by you
*/
@@ -2308,7 +2311,7 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo)
GF_VALIDATE_OR_GOTO (this->name, volinfo, out);
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
ret = glusterd_brick_stop (volinfo, brickinfo, _gf_false);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to stop "
@@ -2471,8 +2474,8 @@ glusterd_op_statedump_volume (dict_t *dict, char **op_errstr)
if (ret)
goto out;
} else {
- list_for_each_entry (brickinfo, &volinfo->bricks,
- brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
ret = glusterd_brick_statedump (volinfo, brickinfo,
options, option_cnt,
op_errstr);
@@ -2663,7 +2666,7 @@ glusterd_clearlocks_get_local_client_ports (glusterd_volinfo_t *volinfo,
priv = THIS->private;
index = -1;
- list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
index++;
if (uuid_compare (brickinfo->uuid, MY_UUID))
continue;
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index c977dc1c1c4..979ae7ab328 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -969,7 +969,7 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
} else if (parse_mount_pattern_desc (mspec, pdesc) != 0)
goto err;
- list_add_tail (&mspec->speclist, &priv->mount_specs);
+ cds_list_add_tail (&mspec->speclist, &priv->mount_specs);
return 0;
err:
@@ -1507,11 +1507,11 @@ init (xlator_t *this)
gf_gld_mt_glusterd_conf_t);
GF_VALIDATE_OR_GOTO(this->name, conf, out);
- INIT_LIST_HEAD (&conf->peers);
- INIT_LIST_HEAD (&conf->xaction_peers);
- INIT_LIST_HEAD (&conf->volumes);
- INIT_LIST_HEAD (&conf->snapshots);
- INIT_LIST_HEAD (&conf->missed_snaps_list);
+ CDS_INIT_LIST_HEAD (&conf->peers);
+ CDS_INIT_LIST_HEAD (&conf->xaction_peers);
+ CDS_INIT_LIST_HEAD (&conf->volumes);
+ CDS_INIT_LIST_HEAD (&conf->snapshots);
+ CDS_INIT_LIST_HEAD (&conf->missed_snaps_list);
pthread_mutex_init (&conf->mutex, NULL);
conf->rpc = rpc;
@@ -1567,7 +1567,7 @@ init (xlator_t *this)
}
}
- INIT_LIST_HEAD (&conf->mount_specs);
+ CDS_INIT_LIST_HEAD (&conf->mount_specs);
ret = dict_foreach (this->options, _install_mount_spec, NULL);
if (ret)
@@ -1613,7 +1613,7 @@ init (xlator_t *this)
* spawn process/bricks that may need (re)starting since last
* time (this) glusterd was up.*/
- if (list_empty (&conf->peers)) {
+ if (cds_list_empty (&conf->peers)) {
glusterd_launch_synctask (glusterd_spawn_daemons, NULL);
}
ret = glusterd_options_init (this);
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 941a587d175..5e80bb636aa 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -127,8 +127,8 @@ struct glusterd_volgen {
typedef struct {
struct _volfile_ctx *volfile;
pthread_mutex_t mutex;
- struct list_head peers;
- struct list_head xaction_peers;
+ struct cds_list_head peers;
+ struct cds_list_head xaction_peers;
gf_boolean_t verify_volfile_checksum;
gf_boolean_t trace;
uuid_t uuid;
@@ -138,8 +138,8 @@ typedef struct {
glusterd_svc_t nfs_svc;
glusterd_svc_t quotad_svc;
struct pmap_registry *pmap;
- struct list_head volumes;
- struct list_head snapshots; /*List of snap volumes */
+ struct cds_list_head volumes;
+ struct cds_list_head snapshots; /*List of snap volumes */
pthread_mutex_t xprt_lock;
struct list_head xprt_list;
gf_store_handle_t *handle;
@@ -155,7 +155,7 @@ typedef struct {
* cluster with no
* transaction ids */
- struct list_head mount_specs;
+ struct cds_list_head mount_specs;
gf_boolean_t valgrind;
pthread_t brick_thread;
void *hooks_priv;
@@ -171,7 +171,7 @@ typedef struct {
uint32_t base_port;
char *snap_bricks_directory;
gf_store_handle_t *missed_snaps_list_shandle;
- struct list_head missed_snaps_list;
+ struct cds_list_head missed_snaps_list;
int ping_timeout;
} glusterd_conf_t;
@@ -189,7 +189,7 @@ struct glusterd_brickinfo {
char brick_id[1024];/*Client xlator name, AFR changelog name*/
char fstype [NAME_MAX]; /* Brick file-system type */
char mnt_opts [1024]; /* Brick mount options */
- struct list_head brick_list;
+ struct cds_list_head brick_list;
uuid_t uuid;
int port;
int rdma_port;
@@ -313,17 +313,17 @@ struct glusterd_volinfo_ {
int brick_count;
uint64_t snap_count;
uint64_t snap_max_hard_limit;
- struct list_head vol_list;
+ struct cds_list_head vol_list;
/* In case of a snap volume
i.e (is_snap_volume == TRUE) this
is linked to glusterd_snap_t->volumes.
In case of a non-snap volume, this is
linked to glusterd_conf_t->volumes */
- struct list_head snapvol_list;
+ struct cds_list_head snapvol_list;
/* This is a current pointer for
glusterd_volinfo_t->snap_volumes */
- struct list_head bricks;
- struct list_head snap_volumes;
+ struct cds_list_head bricks;
+ struct cds_list_head snap_volumes;
/* TODO : Need to remove this, as this
* is already part of snapshot object.
*/
@@ -390,8 +390,8 @@ typedef enum gd_snap_status_ {
struct glusterd_snap_ {
gf_lock_t lock;
- struct list_head volumes;
- struct list_head snap_list;
+ struct cds_list_head volumes;
+ struct cds_list_head snap_list;
char snapname[GLUSTERD_MAX_SNAP_NAME];
uuid_t snap_id;
char *description;
@@ -407,14 +407,14 @@ typedef struct glusterd_snap_op_ {
char *brick_path;
int32_t op;
int32_t status;
- struct list_head snap_ops_list;
+ struct cds_list_head snap_ops_list;
} glusterd_snap_op_t;
typedef struct glusterd_missed_snap_ {
char *node_uuid;
char *snap_uuid;
- struct list_head missed_snaps;
- struct list_head snap_ops;
+ struct cds_list_head missed_snaps;
+ struct cds_list_head snap_ops;
} glusterd_missed_snap_info;
typedef enum gd_node_type_ {
@@ -434,7 +434,7 @@ typedef enum missed_snap_stat {
} missed_snap_stat;
typedef struct glusterd_pending_node_ {
- struct list_head list;
+ struct cds_list_head list;
void *node;
gd_node_type type;
int32_t index;
@@ -459,7 +459,7 @@ enum glusterd_vol_comp_status_ {
};
typedef struct addrinfo_list {
- struct list_head list;
+ struct cds_list_head list;
struct addrinfo *info;
} addrinfo_list_t;
@@ -629,7 +629,7 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args);
snprintf (key, sizeof (key), \
"glusterd.xaction_peer"); \
\
- list_for_each_entry (_peerinfo, head, member) { \
+ cds_list_for_each_entry (_peerinfo, head, member) { \
glusterd_dump_peer (_peerinfo, key, index, xpeers); \
if (!xpeers) \
glusterd_dump_peer_rpcstat (_peerinfo, key, \