glusterd: Remove compilation warning

In glusterd_peerinfo_destroy, cast the passed 'strcut rcu_head *'
pointer to 'gd_rcu_head *' before use in caa_container_of() to prevent
the incompatible-pointer compilation warning.

Also, refactor peerinfo->head to peerinfo->rcu_head to reduce confusion
when reading code.

This change was developed on the git branch at [1]. This commit is a
combination of the following commits on the development branch.
  aa4a0bc Rename peerinfo->head to peerinfo->rcu_head
  c79144b Cast struct rcu_head * to gd_rcu_head * to prevent warning
  1d222c3 More head -> rcu_head renames

[1]: https://github.com/kshlm/glusterfs/tree/urcu

BUG: 1191030
Change-Id: I7ede02090413839563ce44fdf6289697b28777e7
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/9922
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
This commit is contained in:
Kaushal M 2015-03-17 12:06:25 +05:30
parent b5a01eb9b6
commit 1250003956
2 changed files with 6 additions and 8 deletions

View File

@ -21,10 +21,11 @@ glusterd_peerinfo_destroy (struct rcu_head *head)
glusterd_peer_hostname_t *tmp = NULL;
/* This works as rcu_head is the first member of gd_rcu_head */
peerinfo = caa_container_of (head, glusterd_peerinfo_t, head);
peerinfo = caa_container_of ((gd_rcu_head *)head, glusterd_peerinfo_t,
rcu_head);
/* Set THIS to the saved this. Needed by some functions below */
THIS = peerinfo->head.this;
THIS = peerinfo->rcu_head.this;
CDS_INIT_LIST_HEAD (&peerinfo->uuid_list);
@ -63,8 +64,6 @@ glusterd_peerinfo_cleanup (glusterd_peerinfo_t *peerinfo)
return 0;
}
uatomic_set (&peerinfo->deleting, _gf_true);
if (peerinfo->quorum_contrib != QUORUM_NONE)
quorum_action = _gf_true;
if (peerinfo->rpc) {
@ -74,8 +73,8 @@ glusterd_peerinfo_cleanup (glusterd_peerinfo_t *peerinfo)
cds_list_del_rcu (&peerinfo->uuid_list);
/* Saving THIS, as it is needed by the callback function */
peerinfo->head.this = THIS;
call_rcu (&peerinfo->head.head, glusterd_peerinfo_destroy);
peerinfo->rcu_head.this = THIS;
call_rcu (&peerinfo->rcu_head.head, glusterd_peerinfo_destroy);
if (quorum_action)
glusterd_do_quorum_action ();

View File

@ -102,9 +102,8 @@ struct glusterd_peerinfo_ {
gf_boolean_t locked;
gf_boolean_t detaching;
/* Members required for proper cleanup using RCU */
gd_rcu_head head;
gd_rcu_head rcu_head;
pthread_mutex_t delete_lock;
gf_boolean_t deleting;
};
typedef struct glusterd_peerinfo_ glusterd_peerinfo_t;