}
void
-lst_free_rpcent(cfs_list_t *head)
+lst_free_rpcent(struct list_head *head)
{
- lstcon_rpc_ent_t *ent;
+ lstcon_rpc_ent_t *ent;
- while (!cfs_list_empty(head)) {
- ent = cfs_list_entry(head->next, lstcon_rpc_ent_t, rpe_link);
+ while (!list_empty(head)) {
+ ent = list_entry(head->next, lstcon_rpc_ent_t, rpe_link);
- cfs_list_del(&ent->rpe_link);
- free(ent);
- }
+ list_del(&ent->rpe_link);
+ free(ent);
+ }
}
void
-lst_reset_rpcent(cfs_list_t *head)
+lst_reset_rpcent(struct list_head *head)
{
- lstcon_rpc_ent_t *ent;
+ lstcon_rpc_ent_t *ent;
- cfs_list_for_each_entry_typed(ent, head, lstcon_rpc_ent_t, rpe_link) {
- ent->rpe_sid = LST_INVALID_SID;
- ent->rpe_peer.nid = LNET_NID_ANY;
- ent->rpe_peer.pid = LNET_PID_ANY;
- ent->rpe_rpc_errno = ent->rpe_fwk_errno = 0;
- }
+ list_for_each_entry(ent, head, rpe_link) {
+ ent->rpe_sid = LST_INVALID_SID;
+ ent->rpe_peer.nid = LNET_NID_ANY;
+ ent->rpe_peer.pid = LNET_PID_ANY;
+ ent->rpe_rpc_errno = ent->rpe_fwk_errno = 0;
+ }
}
int
-lst_alloc_rpcent(cfs_list_t *head, int count, int offset)
+lst_alloc_rpcent(struct list_head *head, int count, int offset)
{
lstcon_rpc_ent_t *ent;
int i;
memset(ent, 0, offsetof(lstcon_rpc_ent_t, rpe_payload[offset]));
- ent->rpe_sid = LST_INVALID_SID;
- ent->rpe_peer.nid = LNET_NID_ANY;
- ent->rpe_peer.pid = LNET_PID_ANY;
- cfs_list_add(&ent->rpe_link, head);
- }
+ ent->rpe_sid = LST_INVALID_SID;
+ ent->rpe_peer.nid = LNET_NID_ANY;
+ ent->rpe_peer.pid = LNET_PID_ANY;
+ list_add(&ent->rpe_link, head);
+ }
- return 0;
+ return 0;
}
void
-lst_print_transerr(cfs_list_t *head, char *optstr)
+lst_print_transerr(struct list_head *head, char *optstr)
{
- lstcon_rpc_ent_t *ent;
+ lstcon_rpc_ent_t *ent;
- cfs_list_for_each_entry_typed(ent, head, lstcon_rpc_ent_t, rpe_link) {
- if (ent->rpe_rpc_errno == 0 && ent->rpe_fwk_errno == 0)
- continue;
+ list_for_each_entry(ent, head, rpe_link) {
+ if (ent->rpe_rpc_errno == 0 && ent->rpe_fwk_errno == 0)
+ continue;
if (ent->rpe_rpc_errno != 0) {
fprintf(stderr, "%s RPC failed on %s: %s\n",
int *idx, int *count, lstcon_node_ent_t *dents);
int lst_query_batch_ioctl(char *batch, int test, int server,
- int timeout, cfs_list_t *head);
+ int timeout, struct list_head *head);
int
lst_ioctl(unsigned int opc, void *buf, int len)
int
lst_ping_ioctl(char *str, int type, int timeout,
- int count, lnet_process_id_t *ids, cfs_list_t *head)
+ int count, lnet_process_id_t *ids, struct list_head *head)
{
lstio_debug_args_t args = {0};
int
jt_lst_ping(int argc, char **argv)
{
- cfs_list_t head;
- lnet_process_id_t *ids = NULL;
- lstcon_rpc_ent_t *ent = NULL;
+ struct list_head head;
+ lnet_process_id_t *ids = NULL;
+ lstcon_rpc_ent_t *ent = NULL;
char *str = NULL;
int optidx = 0;
int server = 0;
return -1;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
rc = lst_alloc_rpcent(&head, count, LST_NAME_SIZE);
if (rc != 0) {
goto out;
}
- /* ignore RPC errors and framwork errors */
- cfs_list_for_each_entry_typed(ent, &head, lstcon_rpc_ent_t, rpe_link) {
- fprintf(stdout, "\t%s: %s [session: %s id: %s]\n",
- libcfs_id2str(ent->rpe_peer),
- lst_node_state2str(ent->rpe_state),
- (ent->rpe_state == LST_NODE_ACTIVE ||
- ent->rpe_state == LST_NODE_BUSY)?
- (ent->rpe_rpc_errno == 0 ?
- &ent->rpe_payload[0] : "Unknown") :
- "<NULL>", libcfs_nid2str(ent->rpe_sid.ses_nid));
- }
+ /* ignore RPC errors and framwork errors */
+ list_for_each_entry(ent, &head, rpe_link) {
+ fprintf(stdout, "\t%s: %s [session: %s id: %s]\n",
+ libcfs_id2str(ent->rpe_peer),
+ lst_node_state2str(ent->rpe_state),
+ (ent->rpe_state == LST_NODE_ACTIVE ||
+ ent->rpe_state == LST_NODE_BUSY) ?
+ (ent->rpe_rpc_errno == 0 ?
+ &ent->rpe_payload[0] : "Unknown") :
+ "<NULL>", libcfs_nid2str(ent->rpe_sid.ses_nid));
+ }
out:
lst_free_rpcent(&head);
int
lst_add_nodes_ioctl (char *name, int count, lnet_process_id_t *ids,
- unsigned *featp, cfs_list_t *resultp)
+ unsigned *featp, struct list_head *resultp)
{
lstio_group_nodes_args_t args = {0};
int
jt_lst_add_group(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
lnet_process_id_t *ids;
char *name;
unsigned feats = session_features;
return -1;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
for (i = 2; i < argc; i++) {
/* parse address list */
int
lst_update_group_ioctl(int opc, char *name, int clean, int count,
- lnet_process_id_t *ids, cfs_list_t *resultp)
+ lnet_process_id_t *ids, struct list_head *resultp)
{
lstio_group_update_args_t args = {0};
int
jt_lst_update_group(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
lnet_process_id_t *ids = NULL;
char *str = NULL;
char *grp = NULL;
grp = argv[optind];
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
if (opc == LST_GROUP_RMND || opc == LST_GROUP_REFRESH) {
rc = lst_get_node_count(opc == LST_GROUP_RMND ? LST_OPC_NODES :
int
lst_stat_ioctl (char *name, int count, lnet_process_id_t *idsp,
- int timeout, cfs_list_t *resultp)
+ int timeout, struct list_head *resultp)
{
lstio_stat_args_t args = {0};
}
typedef struct {
- cfs_list_t srp_link;
+ struct list_head srp_link;
int srp_count;
char *srp_name;
lnet_process_id_t *srp_ids;
- cfs_list_t srp_result[2];
+ struct list_head srp_result[2];
} lst_stat_req_param_t;
static void
return -ENOMEM;
memset(srp, 0, sizeof(*srp));
- CFS_INIT_LIST_HEAD(&srp->srp_result[0]);
- CFS_INIT_LIST_HEAD(&srp->srp_result[1]);
+ INIT_LIST_HEAD(&srp->srp_result[0]);
+ INIT_LIST_HEAD(&srp->srp_result[1]);
rc = lst_get_node_count(LST_OPC_GROUP, name,
&srp->srp_count, NULL);
}
void
-lst_print_stat(char *name, cfs_list_t *resultp,
+lst_print_stat(char *name, struct list_head *resultp,
int idx, int lnet, int bwrt, int rdwr, int type)
{
- cfs_list_t tmp[2];
+ struct list_head tmp[2];
lstcon_rpc_ent_t *new;
lstcon_rpc_ent_t *old;
sfw_counters_t *sfwk_new;
float delta;
int errcount = 0;
- CFS_INIT_LIST_HEAD(&tmp[0]);
- CFS_INIT_LIST_HEAD(&tmp[1]);
+ INIT_LIST_HEAD(&tmp[0]);
+ INIT_LIST_HEAD(&tmp[1]);
memset(&lnet_stat_result, 0, sizeof(lnet_stat_result));
- while (!cfs_list_empty(&resultp[idx])) {
- if (cfs_list_empty(&resultp[1 - idx])) {
+ while (!list_empty(&resultp[idx])) {
+ if (list_empty(&resultp[1 - idx])) {
fprintf(stderr, "Group is changed, re-run stat\n");
break;
}
- new = cfs_list_entry(resultp[idx].next, lstcon_rpc_ent_t,
+ new = list_entry(resultp[idx].next, lstcon_rpc_ent_t,
rpe_link);
- old = cfs_list_entry(resultp[1 - idx].next, lstcon_rpc_ent_t,
+ old = list_entry(resultp[1 - idx].next, lstcon_rpc_ent_t,
rpe_link);
/* first time get stats result, can't calculate diff */
break;
}
- cfs_list_del(&new->rpe_link);
- cfs_list_add_tail(&new->rpe_link, &tmp[idx]);
+ list_del(&new->rpe_link);
+ list_add_tail(&new->rpe_link, &tmp[idx]);
- cfs_list_del(&old->rpe_link);
- cfs_list_add_tail(&old->rpe_link, &tmp[1 - idx]);
+ list_del(&old->rpe_link);
+ list_add_tail(&old->rpe_link, &tmp[1 - idx]);
if (new->rpe_rpc_errno != 0 || new->rpe_fwk_errno != 0 ||
old->rpe_rpc_errno != 0 || old->rpe_fwk_errno != 0) {
lst_cal_lnet_stat(delta, lnet_new, lnet_old);
}
- cfs_list_splice(&tmp[idx], &resultp[idx]);
- cfs_list_splice(&tmp[1 - idx], &resultp[1 - idx]);
+ list_splice(&tmp[idx], &resultp[idx]);
+ list_splice(&tmp[1 - idx], &resultp[1 - idx]);
if (errcount > 0)
fprintf(stdout, "Failed to stat on %d nodes\n", errcount);
int
jt_lst_stat(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
lst_stat_req_param_t *srp;
time_t last = 0;
int optidx = 0;
if (count != -1)
count++;
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
while (optind < argc) {
rc = lst_stat_req_param_alloc(argv[optind++], &srp, 1);
if (rc != 0)
goto out;
- cfs_list_add_tail(&srp->srp_link, &head);
+ list_add_tail(&srp->srp_link, &head);
}
do {
sleep(delay - now + last);
time(&now);
}
+ last = now;
- last = now;
-
- cfs_list_for_each_entry_typed(srp, &head, lst_stat_req_param_t,
- srp_link) {
+ list_for_each_entry(srp, &head, srp_link) {
rc = lst_stat_ioctl(srp->srp_name,
srp->srp_count, srp->srp_ids,
timeout, &srp->srp_result[idx]);
} while (count == -1 || count > 0);
out:
- while (!cfs_list_empty(&head)) {
- srp = cfs_list_entry(head.next, lst_stat_req_param_t, srp_link);
+ while (!list_empty(&head)) {
+ srp = list_entry(head.next, lst_stat_req_param_t, srp_link);
- cfs_list_del(&srp->srp_link);
+ list_del(&srp->srp_link);
lst_stat_req_param_free(srp);
}
int
jt_lst_show_error(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
lst_stat_req_param_t *srp;
lstcon_rpc_ent_t *ent;
sfw_counters_t *sfwk;
return -1;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
while (optind < argc) {
rc = lst_stat_req_param_alloc(argv[optind++], &srp, 0);
if (rc != 0)
goto out;
- cfs_list_add_tail(&srp->srp_link, &head);
+ list_add_tail(&srp->srp_link, &head);
}
- cfs_list_for_each_entry_typed(srp, &head, lst_stat_req_param_t,
- srp_link) {
+ list_for_each_entry(srp, &head, srp_link) {
rc = lst_stat_ioctl(srp->srp_name, srp->srp_count,
srp->srp_ids, 10, &srp->srp_result[0]);
ecount = 0;
- cfs_list_for_each_entry_typed(ent, &srp->srp_result[0],
- lstcon_rpc_ent_t, rpe_link) {
+ list_for_each_entry(ent, &srp->srp_result[0], rpe_link) {
if (ent->rpe_rpc_errno != 0) {
ecount ++;
fprintf(stderr, "RPC failure, can't show error on %s\n",
fprintf(stdout, "Total %d error nodes in %s\n", ecount, srp->srp_name);
}
out:
- while (!cfs_list_empty(&head)) {
- srp = cfs_list_entry(head.next, lst_stat_req_param_t, srp_link);
+ while (!list_empty(&head)) {
+ srp = list_entry(head.next, lst_stat_req_param_t, srp_link);
- cfs_list_del(&srp->srp_link);
+ list_del(&srp->srp_link);
lst_stat_req_param_free(srp);
}
}
int
-lst_start_batch_ioctl (char *name, int timeout, cfs_list_t *resultp)
+lst_start_batch_ioctl(char *name, int timeout, struct list_head *resultp)
{
lstio_batch_run_args_t args = {0};
int
jt_lst_start_batch(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
char *batch;
int optidx = 0;
int timeout = 0;
return -1;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
rc = lst_alloc_rpcent(&head, count, 0);
if (rc != 0) {
}
int
-lst_stop_batch_ioctl(char *name, int force, cfs_list_t *resultp)
+lst_stop_batch_ioctl(char *name, int force, struct list_head *resultp)
{
lstio_batch_stop_args_t args = {0};
int
jt_lst_stop_batch(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
char *batch;
int force = 0;
int optidx;
return -1;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
rc = lst_alloc_rpcent(&head, count, 0);
if (rc != 0) {
int
lst_query_batch_ioctl(char *batch, int test, int server,
- int timeout, cfs_list_t *head)
+ int timeout, struct list_head *head)
{
lstio_batch_query_args_t args = {0};
}
void
-lst_print_tsb_verbose(cfs_list_t *head,
+lst_print_tsb_verbose(struct list_head *head,
int active, int idle, int error)
{
lstcon_rpc_ent_t *ent;
- cfs_list_for_each_entry_typed(ent, head, lstcon_rpc_ent_t, rpe_link) {
+ list_for_each_entry(ent, head, rpe_link) {
if (ent->rpe_priv[0] == 0 && active)
continue;
jt_lst_query_batch(int argc, char **argv)
{
lstcon_test_batch_ent_t ent;
- cfs_list_t head;
+ struct list_head head;
char *batch = NULL;
time_t last = 0;
int optidx = 0;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
if (verbose) {
rc = lst_info_batch_ioctl(batch, test, server,
int
lst_add_test_ioctl(char *batch, int type, int loop, int concur,
int dist, int span, char *sgrp, char *dgrp,
- void *param, int plen, int *retp, cfs_list_t *resultp)
+ void *param, int plen, int *retp, struct list_head *resultp)
{
lstio_test_args_t args = {0};
int
jt_lst_add_test(int argc, char **argv)
{
- cfs_list_t head;
+ struct list_head head;
char *batch = NULL;
char *test = NULL;
char *dstr = NULL;
return -1;
}
- CFS_INIT_LIST_HEAD(&head);
+ INIT_LIST_HEAD(&head);
rc = lst_get_node_count(LST_OPC_GROUP, from, &fcount, NULL);
if (rc != 0) {