summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c90
1 files changed, 48 insertions, 42 deletions
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;