diff options
author | Kaushal M <kaushal@redhat.com> | 2015-01-06 18:23:41 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-03-03 23:50:22 -0800 |
commit | 673ba2659cebe22ee30c43f9fb080f330150f55e (patch) | |
tree | f91e83be5cfae7a08febfda420b33e05ed0b964f /xlators/mgmt/glusterd/src/glusterd-syncop.c | |
parent | ef061b67f1b80c147c1959b896f7c9bdff01af96 (diff) |
glusterd: Replace libglusterfs lists with liburcu lists
This patch replaces usage of the libglusterfs lists data structures and
API in glusterd with the lists data structures and API from liburcu. The
liburcu data structes and APIs are a drop-in replacement for
libglusterfs lists.
All usages have been changed to keep the code consistent, and free from
confusion.
NOTE: glusterd_conf_t->xprt_list still uses the libglusterfs data
structures and API, as it holds rpc_transport_t objects, which is not a
part of glusterd and is not being changed in this patch.
This change was developed on the git branch at [1]. This commit is a
combination of the following commits on the development branch.
6dac576 Replace libglusterfs lists with liburcu lists
a51b5ab Fix compilation issues
d98a06f Fix merge issues
a5d918e Remove merge remnant
1cca113 More style cleanup
1917be3 Address review comments on 9624/1
8d10f13 Use cds_lists for glusterd_svc_t
524ad5d Add rculist header in glusterd-conn-helper.c
646f294 glusterd: add list_add_order API honouring rcu
[1]: https://github.com/kshlm/glusterfs/tree/urcu
Change-Id: Ic613c5b6e496a677b9d3de15fc042a0492109fb0
BUG: 1191030
Signed-off-by: Kaushal M <kaushal@redhat.com>
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/9624
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
Reviewed-by: Anand Nekkunti <anekkunt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-syncop.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 53 |
1 files changed, 28 insertions, 25 deletions
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) { |