spin_lock(&console_session.ses_rpc_lock);
if (!list_empty(&console_session.ses_rpc_freelist)) {
- crpc = list_entry(console_session.ses_rpc_freelist.next,
- struct lstcon_rpc, crp_link);
+ crpc = list_first_entry(&console_session.ses_rpc_freelist,
+ struct lstcon_rpc, crp_link);
list_del_init(&crpc->crp_link);
}
spin_unlock(&console_session.ses_rpc_lock);
while (!list_empty(&zlist)) {
- crpc = list_entry(zlist.next, struct lstcon_rpc, crp_link);
+ crpc = list_first_entry(&zlist, struct lstcon_rpc, crp_link);
list_del(&crpc->crp_link);
LIBCFS_FREE(crpc, sizeof(*crpc));
struct lstcon_ndlink *ndl;
while (!list_empty(&old->grp_ndl_list)) {
- ndl = list_entry(old->grp_ndl_list.next,
- struct lstcon_ndlink, ndl_link);
+ ndl = list_first_entry(&old->grp_ndl_list,
+ struct lstcon_ndlink, ndl_link);
lstcon_group_ndlink_move(old, new, ndl);
}
}
list_del(&bat->bat_link);
while (!list_empty(&bat->bat_test_list)) {
- test = list_entry(bat->bat_test_list.next,
- struct lstcon_test, tes_link);
+ test = list_first_entry(&bat->bat_test_list,
+ struct lstcon_test, tes_link);
LASSERT(list_empty(&test->tes_trans_list));
list_del(&test->tes_link);
LASSERT(list_empty(&bat->bat_trans_list));
while (!list_empty(&bat->bat_cli_list)) {
- ndl = list_entry(bat->bat_cli_list.next,
- struct lstcon_ndlink, ndl_link);
+ ndl = list_first_entry(&bat->bat_cli_list,
+ struct lstcon_ndlink, ndl_link);
list_del_init(&ndl->ndl_link);
lstcon_ndlink_release(ndl);
}
while (!list_empty(&bat->bat_srv_list)) {
- ndl = list_entry(bat->bat_srv_list.next,
- struct lstcon_ndlink, ndl_link);
+ ndl = list_first_entry(&bat->bat_srv_list,
+ struct lstcon_ndlink, ndl_link);
list_del_init(&ndl->ndl_link);
lstcon_ndlink_release(ndl);
/* destroy all batches */
while (!list_empty(&console_session.ses_bat_list)) {
- bat = list_entry(console_session.ses_bat_list.next,
- struct lstcon_batch, bat_link);
+ bat = list_first_entry(&console_session.ses_bat_list,
+ struct lstcon_batch, bat_link);
lstcon_batch_destroy(bat);
}
/* destroy all groups */
while (!list_empty(&console_session.ses_grp_list)) {
- grp = list_entry(console_session.ses_grp_list.next,
- struct lstcon_group, grp_link);
+ grp = list_first_entry(&console_session.ses_grp_list,
+ struct lstcon_group, grp_link);
LASSERT(grp->grp_ref == 1);
lstcon_group_decref(grp);
LASSERT(!sfw_test_active(tsi));
while (!list_empty(&tsi->tsi_units)) {
- tsu = list_entry(tsi->tsi_units.next,
- struct sfw_test_unit, tsu_list);
+ tsu = list_first_entry(&tsi->tsi_units,
+ struct sfw_test_unit, tsu_list);
list_del(&tsu->tsu_list);
LIBCFS_FREE(tsu, sizeof(*tsu));
}
while (!list_empty(&tsi->tsi_free_rpcs)) {
- rpc = list_entry(tsi->tsi_free_rpcs.next,
- struct srpc_client_rpc, crpc_list);
+ rpc = list_first_entry(&tsi->tsi_free_rpcs,
+ struct srpc_client_rpc, crpc_list);
list_del(&rpc->crpc_list);
swi_cancel_workitem(&rpc->crpc_wi);
LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc));
LASSERT(list_empty(&tsb->bat_list));
while (!list_empty(&tsb->bat_tests)) {
- tsi = list_entry(tsb->bat_tests.next,
- struct sfw_test_instance, tsi_list);
+ tsi = list_first_entry(&tsb->bat_tests,
+ struct sfw_test_instance, tsi_list);
list_del_init(&tsi->tsi_list);
sfw_destroy_test_instance(tsi);
}
LASSERT(sn != sfw_data.fw_session);
while (!list_empty(&sn->sn_batches)) {
- batch = list_entry(sn->sn_batches.next,
- struct sfw_batch, bat_list);
+ batch = list_first_entry(&sn->sn_batches,
+ struct sfw_batch, bat_list);
list_del_init(&batch->bat_list);
sfw_destroy_batch(batch);
}
if (!list_empty(&tsi->tsi_free_rpcs)) {
/* pick request from buffer */
- rpc = list_entry(tsi->tsi_free_rpcs.next,
- struct srpc_client_rpc, crpc_list);
+ rpc = list_first_entry(&tsi->tsi_free_rpcs,
+ struct srpc_client_rpc, crpc_list);
LASSERT(nblk == rpc->crpc_bulk.bk_niov);
list_del_init(&rpc->crpc_list);
}
LASSERT (service <= SRPC_FRAMEWORK_SERVICE_MAX_ID);
if (nbulkiov == 0 && !list_empty(&sfw_data.fw_zombie_rpcs)) {
- rpc = list_entry(sfw_data.fw_zombie_rpcs.next,
- struct srpc_client_rpc, crpc_list);
+ rpc = list_first_entry(&sfw_data.fw_zombie_rpcs,
+ struct srpc_client_rpc, crpc_list);
list_del(&rpc->crpc_list);
}
spin_unlock(&sfw_data.fw_lock);
while (!list_empty(&sfw_data.fw_zombie_rpcs)) {
struct srpc_client_rpc *rpc;
- rpc = list_entry(sfw_data.fw_zombie_rpcs.next,
- struct srpc_client_rpc, crpc_list);
+ rpc = list_first_entry(&sfw_data.fw_zombie_rpcs,
+ struct srpc_client_rpc, crpc_list);
list_del(&rpc->crpc_list);
LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc));
}
while (!list_empty(&sfw_data.fw_tests)) {
- tsc = list_entry(sfw_data.fw_tests.next,
- struct sfw_test_case, tsc_list);
+ tsc = list_first_entry(&sfw_data.fw_tests,
+ struct sfw_test_case, tsc_list);
srpc_wait_service_shutdown(tsc->tsc_srv_service);
LASSERT(list_empty(&scd->scd_rpc_active));
while (!list_empty(&scd->scd_rpc_free)) {
- rpc = list_entry(scd->scd_rpc_free.next,
- struct srpc_server_rpc,
- srpc_list);
+ rpc = list_first_entry(&scd->scd_rpc_free,
+ struct srpc_server_rpc,
+ srpc_list);
list_del(&rpc->srpc_list);
LIBCFS_FREE(rpc, sizeof(*rpc));
}
continue;
}
- rpc = list_entry(scd->scd_rpc_active.next,
- struct srpc_server_rpc, srpc_list);
+ rpc = list_first_entry(&scd->scd_rpc_active,
+ struct srpc_server_rpc, srpc_list);
CNETERR("Active RPC %p on shutdown: sv %s, peer %s, wi %s, ev fired %d type %d status %d lnet %d\n",
rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer),
swi_state2str(rpc->srpc_wi.swi_state),
rpc->srpc_wi.swi_state = SWI_STATE_DONE;
if (!sv->sv_shuttingdown && !list_empty(&scd->scd_buf_blocked)) {
- buffer = list_entry(scd->scd_buf_blocked.next,
- struct srpc_buffer, buf_list);
+ buffer = list_first_entry(&scd->scd_buf_blocked,
+ struct srpc_buffer, buf_list);
list_del(&buffer->buf_list);
srpc_init_server_rpc(rpc, scd, buffer);
}
if (!list_empty(&scd->scd_rpc_free)) {
- srpc = list_entry(scd->scd_rpc_free.next,
- struct srpc_server_rpc,
- srpc_list);
+ srpc = list_first_entry(&scd->scd_rpc_free,
+ struct srpc_server_rpc,
+ srpc_list);
list_del(&srpc->srpc_list);
srpc_init_server_rpc(srpc, scd, buffer);