Commit e00f978e authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: selftest: convert lstcon_ndlink_t to proper struct

Turn typedef lstcon_ndlink_t to proper structure
Signed-off-by: default avatarJames Simmons <uja.ornl@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f1e34162
...@@ -719,7 +719,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, ...@@ -719,7 +719,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
int dist, int span, int nkiov, lnet_kiov_t *kiov) int dist, int span, int nkiov, lnet_kiov_t *kiov)
{ {
lnet_process_id_packed_t *pid; lnet_process_id_packed_t *pid;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
struct lstcon_node *nd; struct lstcon_node *nd;
int start; int start;
int end; int end;
...@@ -1086,7 +1086,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, ...@@ -1086,7 +1086,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
struct lstcon_rpc_trans **transpp) struct lstcon_rpc_trans **transpp)
{ {
struct lstcon_rpc_trans *trans; struct lstcon_rpc_trans *trans;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
struct lstcon_node *nd; struct lstcon_node *nd;
struct lstcon_rpc *rpc; struct lstcon_rpc *rpc;
unsigned feats; unsigned feats;
...@@ -1172,7 +1172,7 @@ lstcon_rpc_pinger(void *arg) ...@@ -1172,7 +1172,7 @@ lstcon_rpc_pinger(void *arg)
struct lstcon_rpc *crpc; struct lstcon_rpc *crpc;
srpc_msg_t *rep; srpc_msg_t *rep;
srpc_debug_reqst_t *drq; srpc_debug_reqst_t *drq;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
struct lstcon_node *nd; struct lstcon_node *nd;
int intv; int intv;
int count = 0; int count = 0;
......
...@@ -71,7 +71,7 @@ lstcon_node_get(struct lstcon_node *nd) ...@@ -71,7 +71,7 @@ lstcon_node_get(struct lstcon_node *nd)
static int static int
lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE; unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE;
LASSERT(id.nid != LNET_NID_ANY); LASSERT(id.nid != LNET_NID_ANY);
...@@ -90,11 +90,11 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) ...@@ -90,11 +90,11 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create)
if (!create) if (!create)
return -ENOENT; return -ENOENT;
LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t)); LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + sizeof(struct lstcon_ndlink));
if (!*ndpp) if (!*ndpp)
return -ENOMEM; return -ENOMEM;
ndl = (lstcon_ndlink_t *)(*ndpp + 1); ndl = (struct lstcon_ndlink *)(*ndpp + 1);
ndl->ndl_node = *ndpp; ndl->ndl_node = *ndpp;
...@@ -119,14 +119,14 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) ...@@ -119,14 +119,14 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create)
static void static void
lstcon_node_put(struct lstcon_node *nd) lstcon_node_put(struct lstcon_node *nd)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
LASSERT(nd->nd_ref > 0); LASSERT(nd->nd_ref > 0);
if (--nd->nd_ref > 0) if (--nd->nd_ref > 0)
return; return;
ndl = (lstcon_ndlink_t *)(nd + 1); ndl = (struct lstcon_ndlink *)(nd + 1);
LASSERT(!list_empty(&ndl->ndl_link)); LASSERT(!list_empty(&ndl->ndl_link));
LASSERT(!list_empty(&ndl->ndl_hlink)); LASSERT(!list_empty(&ndl->ndl_hlink));
...@@ -135,15 +135,15 @@ lstcon_node_put(struct lstcon_node *nd) ...@@ -135,15 +135,15 @@ lstcon_node_put(struct lstcon_node *nd)
list_del(&ndl->ndl_link); list_del(&ndl->ndl_link);
list_del(&ndl->ndl_hlink); list_del(&ndl->ndl_hlink);
LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t)); LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(struct lstcon_ndlink));
} }
static int static int
lstcon_ndlink_find(struct list_head *hash, lstcon_ndlink_find(struct list_head *hash,
lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create) lnet_process_id_t id, struct lstcon_ndlink **ndlpp, int create)
{ {
unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE; unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
struct lstcon_node *nd; struct lstcon_node *nd;
int rc; int rc;
...@@ -168,7 +168,7 @@ lstcon_ndlink_find(struct list_head *hash, ...@@ -168,7 +168,7 @@ lstcon_ndlink_find(struct list_head *hash,
if (rc) if (rc)
return rc; return rc;
LIBCFS_ALLOC(ndl, sizeof(lstcon_ndlink_t)); LIBCFS_ALLOC(ndl, sizeof(struct lstcon_ndlink));
if (!ndl) { if (!ndl) {
lstcon_node_put(nd); lstcon_node_put(nd);
return -ENOMEM; return -ENOMEM;
...@@ -184,7 +184,7 @@ lstcon_ndlink_find(struct list_head *hash, ...@@ -184,7 +184,7 @@ lstcon_ndlink_find(struct list_head *hash,
} }
static void static void
lstcon_ndlink_release(lstcon_ndlink_t *ndl) lstcon_ndlink_release(struct lstcon_ndlink *ndl)
{ {
LASSERT(list_empty(&ndl->ndl_link)); LASSERT(list_empty(&ndl->ndl_link));
LASSERT(!list_empty(&ndl->ndl_hlink)); LASSERT(!list_empty(&ndl->ndl_hlink));
...@@ -234,13 +234,13 @@ lstcon_group_addref(lstcon_group_t *grp) ...@@ -234,13 +234,13 @@ lstcon_group_addref(lstcon_group_t *grp)
grp->grp_ref++; grp->grp_ref++;
} }
static void lstcon_group_ndlink_release(lstcon_group_t *, lstcon_ndlink_t *); static void lstcon_group_ndlink_release(lstcon_group_t *, struct lstcon_ndlink *);
static void static void
lstcon_group_drain(lstcon_group_t *grp, int keep) lstcon_group_drain(lstcon_group_t *grp, int keep)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
lstcon_ndlink_t *tmp; struct lstcon_ndlink *tmp;
list_for_each_entry_safe(ndl, tmp, &grp->grp_ndl_list, ndl_link) { list_for_each_entry_safe(ndl, tmp, &grp->grp_ndl_list, ndl_link) {
if (!(ndl->ndl_node->nd_state & keep)) if (!(ndl->ndl_node->nd_state & keep))
...@@ -287,7 +287,7 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp) ...@@ -287,7 +287,7 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp)
static int static int
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create) struct lstcon_ndlink **ndlpp, int create)
{ {
int rc; int rc;
...@@ -305,7 +305,7 @@ lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, ...@@ -305,7 +305,7 @@ lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
} }
static void static void
lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) lstcon_group_ndlink_release(lstcon_group_t *grp, struct lstcon_ndlink *ndl)
{ {
list_del_init(&ndl->ndl_link); list_del_init(&ndl->ndl_link);
lstcon_ndlink_release(ndl); lstcon_ndlink_release(ndl);
...@@ -314,7 +314,7 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) ...@@ -314,7 +314,7 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl)
static void static void
lstcon_group_ndlink_move(lstcon_group_t *old, lstcon_group_ndlink_move(lstcon_group_t *old,
lstcon_group_t *new, lstcon_ndlink_t *ndl) lstcon_group_t *new, struct lstcon_ndlink *ndl)
{ {
unsigned int idx = LNET_NIDADDR(ndl->ndl_node->nd_id.nid) % unsigned int idx = LNET_NIDADDR(ndl->ndl_node->nd_id.nid) %
LST_NODE_HASHSIZE; LST_NODE_HASHSIZE;
...@@ -331,11 +331,11 @@ lstcon_group_ndlink_move(lstcon_group_t *old, ...@@ -331,11 +331,11 @@ lstcon_group_ndlink_move(lstcon_group_t *old,
static void static void
lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new) lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
while (!list_empty(&old->grp_ndl_list)) { while (!list_empty(&old->grp_ndl_list)) {
ndl = list_entry(old->grp_ndl_list.next, ndl = list_entry(old->grp_ndl_list.next,
lstcon_ndlink_t, ndl_link); struct lstcon_ndlink, ndl_link);
lstcon_group_ndlink_move(old, new, ndl); lstcon_group_ndlink_move(old, new, ndl);
} }
} }
...@@ -404,7 +404,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, ...@@ -404,7 +404,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp,
unsigned *featp, struct list_head __user *result_up) unsigned *featp, struct list_head __user *result_up)
{ {
struct lstcon_rpc_trans *trans; struct lstcon_rpc_trans *trans;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
lstcon_group_t *tmp; lstcon_group_t *tmp;
lnet_process_id_t id; lnet_process_id_t id;
int i; int i;
...@@ -471,7 +471,7 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, ...@@ -471,7 +471,7 @@ lstcon_group_nodes_remove(lstcon_group_t *grp,
struct list_head __user *result_up) struct list_head __user *result_up)
{ {
struct lstcon_rpc_trans *trans; struct lstcon_rpc_trans *trans;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
lstcon_group_t *tmp; lstcon_group_t *tmp;
lnet_process_id_t id; lnet_process_id_t id;
int rc; int rc;
...@@ -744,7 +744,7 @@ static int ...@@ -744,7 +744,7 @@ static int
lstcon_nodes_getent(struct list_head *head, int *index_p, lstcon_nodes_getent(struct list_head *head, int *index_p,
int *count_p, lstcon_node_ent_t __user *dents_up) int *count_p, lstcon_node_ent_t __user *dents_up)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
struct lstcon_node *nd; struct lstcon_node *nd;
int count = 0; int count = 0;
int index = 0; int index = 0;
...@@ -787,7 +787,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, ...@@ -787,7 +787,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p,
{ {
lstcon_ndlist_ent_t *gentp; lstcon_ndlist_ent_t *gentp;
lstcon_group_t *grp; lstcon_group_t *grp;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
int rc; int rc;
rc = lstcon_group_find(name, &grp); rc = lstcon_group_find(name, &grp);
...@@ -936,7 +936,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, ...@@ -936,7 +936,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up,
struct list_head *srvlst; struct list_head *srvlst;
lstcon_test_t *test = NULL; lstcon_test_t *test = NULL;
lstcon_batch_t *bat; lstcon_batch_t *bat;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
int rc; int rc;
rc = lstcon_batch_find(name, &bat); rc = lstcon_batch_find(name, &bat);
...@@ -1090,7 +1090,7 @@ lstcon_batch_stop(char *name, int force, struct list_head __user *result_up) ...@@ -1090,7 +1090,7 @@ lstcon_batch_stop(char *name, int force, struct list_head __user *result_up)
static void static void
lstcon_batch_destroy(lstcon_batch_t *bat) lstcon_batch_destroy(lstcon_batch_t *bat)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
lstcon_test_t *test; lstcon_test_t *test;
int i; int i;
...@@ -1114,7 +1114,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) ...@@ -1114,7 +1114,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat)
while (!list_empty(&bat->bat_cli_list)) { while (!list_empty(&bat->bat_cli_list)) {
ndl = list_entry(bat->bat_cli_list.next, ndl = list_entry(bat->bat_cli_list.next,
lstcon_ndlink_t, ndl_link); struct lstcon_ndlink, ndl_link);
list_del_init(&ndl->ndl_link); list_del_init(&ndl->ndl_link);
lstcon_ndlink_release(ndl); lstcon_ndlink_release(ndl);
...@@ -1122,7 +1122,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) ...@@ -1122,7 +1122,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat)
while (!list_empty(&bat->bat_srv_list)) { while (!list_empty(&bat->bat_srv_list)) {
ndl = list_entry(bat->bat_srv_list.next, ndl = list_entry(bat->bat_srv_list.next,
lstcon_ndlink_t, ndl_link); struct lstcon_ndlink, ndl_link);
list_del_init(&ndl->ndl_link); list_del_init(&ndl->ndl_link);
lstcon_ndlink_release(ndl); lstcon_ndlink_release(ndl);
...@@ -1145,7 +1145,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) ...@@ -1145,7 +1145,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg)
{ {
lstcon_test_t *test; lstcon_test_t *test;
lstcon_batch_t *batch; lstcon_batch_t *batch;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
struct list_head *hash; struct list_head *hash;
struct list_head *head; struct list_head *head;
...@@ -1258,7 +1258,7 @@ static int ...@@ -1258,7 +1258,7 @@ static int
lstcon_verify_group(const char *name, lstcon_group_t **grp) lstcon_verify_group(const char *name, lstcon_group_t **grp)
{ {
int rc; int rc;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
rc = lstcon_group_find(name, grp); rc = lstcon_group_find(name, grp);
if (rc) { if (rc) {
...@@ -1535,7 +1535,7 @@ int ...@@ -1535,7 +1535,7 @@ int
lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up, lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up,
int timeout, struct list_head __user *result_up) int timeout, struct list_head __user *result_up)
{ {
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
lstcon_group_t *tmp; lstcon_group_t *tmp;
lnet_process_id_t id; lnet_process_id_t id;
int i; int i;
...@@ -1648,7 +1648,7 @@ lstcon_nodes_debug(int timeout, ...@@ -1648,7 +1648,7 @@ lstcon_nodes_debug(int timeout,
struct list_head __user *result_up) struct list_head __user *result_up)
{ {
lnet_process_id_t id; lnet_process_id_t id;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
lstcon_group_t *grp; lstcon_group_t *grp;
int i; int i;
int rc; int rc;
...@@ -1781,7 +1781,7 @@ lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up, ...@@ -1781,7 +1781,7 @@ lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up,
char __user *name_up, int len) char __user *name_up, int len)
{ {
lstcon_ndlist_ent_t *entp; lstcon_ndlist_ent_t *entp;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
int rc = 0; int rc = 0;
if (console_session.ses_state != LST_SESSION_ACTIVE) if (console_session.ses_state != LST_SESSION_ACTIVE)
...@@ -1910,7 +1910,7 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc) ...@@ -1910,7 +1910,7 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc)
srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; srpc_join_reqst_t *jreq = &req->msg_body.join_reqst;
srpc_join_reply_t *jrep = &rep->msg_body.join_reply; srpc_join_reply_t *jrep = &rep->msg_body.join_reply;
lstcon_group_t *grp = NULL; lstcon_group_t *grp = NULL;
lstcon_ndlink_t *ndl; struct lstcon_ndlink *ndl;
int rc = 0; int rc = 0;
sfw_unpack_message(req); sfw_unpack_message(req);
......
...@@ -60,11 +60,12 @@ struct lstcon_node { ...@@ -60,11 +60,12 @@ struct lstcon_node {
struct lstcon_rpc nd_ping; /* ping rpc */ struct lstcon_rpc nd_ping; /* ping rpc */
}; };
typedef struct { /* node link descriptor */
struct lstcon_ndlink {
struct list_head ndl_link; /* chain on list */ struct list_head ndl_link; /* chain on list */
struct list_head ndl_hlink; /* chain on hash */ struct list_head ndl_hlink; /* chain on hash */
struct lstcon_node *ndl_node; /* pointer to node */ struct lstcon_node *ndl_node; /* pointer to node */
} lstcon_ndlink_t; /* node link descriptor */ };
typedef struct { typedef struct {
struct list_head grp_link; /* chain on global group list struct list_head grp_link; /* chain on global group list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment