* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
if (crpc->crp_trans == NULL) {
/* Orphan RPC is not in any transaction,
* I'm just a poor body and nobody loves me */
if (crpc->crp_trans == NULL) {
/* Orphan RPC is not in any transaction,
* I'm just a poor body and nobody loves me */
- if (!list_empty(&console_session.ses_rpc_freelist)) {
- crpc = list_entry(console_session.ses_rpc_freelist.next,
- lstcon_rpc_t, crp_link);
- list_del_init(&crpc->crp_link);
+ if (!cfs_list_empty(&console_session.ses_rpc_freelist)) {
+ crpc = cfs_list_entry(console_session.ses_rpc_freelist.next,
+ lstcon_rpc_t, crp_link);
+ cfs_list_del_init(&crpc->crp_link);
int transop, lstcon_rpc_trans_t **transpp)
{
lstcon_rpc_trans_t *trans;
if (translist != NULL) {
int transop, lstcon_rpc_trans_t **transpp)
{
lstcon_rpc_trans_t *trans;
if (translist != NULL) {
- list_for_each_entry(trans, translist, tas_link) {
+ cfs_list_for_each_entry_typed(trans, translist,
+ lstcon_rpc_trans_t, tas_link) {
- list_for_each_entry (crpc, &trans->tas_rpcs_list, crp_link) {
+ cfs_list_for_each_entry_typed (crpc, &trans->tas_rpcs_list,
+ lstcon_rpc_t, crp_link) {
- list_for_each_entry (crpc, &trans->tas_rpcs_list, crp_link) {
+ cfs_list_for_each_entry_typed (crpc, &trans->tas_rpcs_list,
+ lstcon_rpc_t, crp_link) {
- list_for_each_entry(crpc, &trans->tas_rpcs_list, crp_link) {
+ cfs_list_for_each_entry_typed(crpc, &trans->tas_rpcs_list,
+ lstcon_rpc_t, crp_link) {
- list_for_each_entry(crpc, &trans->tas_rpcs_list, crp_link) {
- if (copy_from_user(&tmp, next, sizeof(struct list_head)))
+ cfs_list_for_each_entry_typed(crpc, &trans->tas_rpcs_list,
+ lstcon_rpc_t, crp_link) {
+ if (cfs_copy_from_user(&tmp, next,
+ sizeof(cfs_list_t)))
- dur = cfs_time_sub(crpc->crp_stamp,
- console_session.ses_id.ses_stamp);
+ dur = (cfs_duration_t)cfs_time_sub(crpc->crp_stamp,
+ (cfs_time_t)console_session.ses_id.ses_stamp);
- if (copy_to_user(&ent->rpe_peer,
- &nd->nd_id, sizeof(lnet_process_id_t)) ||
- copy_to_user(&ent->rpe_stamp, &tv, sizeof(tv)) ||
- copy_to_user(&ent->rpe_state,
- &nd->nd_state, sizeof(nd->nd_state)) ||
- copy_to_user(&ent->rpe_rpc_errno, &error, sizeof(error)))
+ if (cfs_copy_to_user(&ent->rpe_peer,
+ &nd->nd_id, sizeof(lnet_process_id_t)) ||
+ cfs_copy_to_user(&ent->rpe_stamp, &tv, sizeof(tv)) ||
+ cfs_copy_to_user(&ent->rpe_state,
+ &nd->nd_state, sizeof(nd->nd_state)) ||
+ cfs_copy_to_user(&ent->rpe_rpc_errno, &error,
+ sizeof(error)))
- if (copy_to_user(&ent->rpe_sid,
- &rep->sid, sizeof(lst_sid_t)) ||
- copy_to_user(&ent->rpe_fwk_errno,
- &rep->status, sizeof(rep->status)))
+ if (cfs_copy_to_user(&ent->rpe_sid,
+ &rep->sid, sizeof(lst_sid_t)) ||
+ cfs_copy_to_user(&ent->rpe_fwk_errno,
+ &rep->status, sizeof(rep->status)))
-
- list_for_each_entry_safe(crpc, tmp,
- &trans->tas_rpcs_list, crp_link) {
+
+ cfs_list_for_each_entry_safe_typed(crpc, tmp,
+ &trans->tas_rpcs_list,
+ lstcon_rpc_t, crp_link) {
/* rpcs can be still not callbacked (even LNetMDUnlink is called)
* because huge timeout for inaccessible network, don't make
/* rpcs can be still not callbacked (even LNetMDUnlink is called)
* because huge timeout for inaccessible network, don't make
- list_del(&trans->tas_link);
- if (!list_empty(&trans->tas_olink))
- list_del(&trans->tas_olink);
+ cfs_list_del(&trans->tas_link);
+ if (!cfs_list_empty(&trans->tas_olink))
+ cfs_list_del(&trans->tas_olink);
CDEBUG(D_NET, "Transaction %s destroyed with %d pending RPCs\n",
lstcon_rpc_trans_name(trans->tas_opc), count);
CDEBUG(D_NET, "Transaction %s destroyed with %d pending RPCs\n",
lstcon_rpc_trans_name(trans->tas_opc), count);
}
int
lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
int dist, int span, int nkiov, lnet_kiov_t *kiov)
{
}
int
lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
int dist, int span, int nkiov, lnet_kiov_t *kiov)
{
start = ((idx / dist) * span) % grp->grp_nnode;
end = ((idx / dist) * span + span - 1) % grp->grp_nnode;
start = ((idx / dist) * span) % grp->grp_nnode;
end = ((idx / dist) * span + span - 1) % grp->grp_nnode;
- list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link) {
+ cfs_list_for_each_entry_typed(ndl, &grp->grp_ndl_list,
+ lstcon_ndlink_t, ndl_link) {
- list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link) {
+ cfs_list_for_each_entry_typed(ndl, &grp->grp_ndl_list,
+ lstcon_ndlink_t, ndl_link) {
if (i > grp->grp_nnode + end)
break;
nd = ndl->ndl_node;
pid = lstcon_next_id((i - start), nkiov, kiov);
if (i > grp->grp_nnode + end)
break;
nd = ndl->ndl_node;
pid = lstcon_next_id((i - start), nkiov, kiov);
trq->tsr_bid = test->tes_hdr.tsb_id;
trq->tsr_concur = test->tes_concur;
trq->tsr_is_client = (transop == LST_TRANS_TSBCLIADD) ? 1 : 0;
trq->tsr_bid = test->tes_hdr.tsb_id;
trq->tsr_concur = test->tes_concur;
trq->tsr_is_client = (transop == LST_TRANS_TSBCLIADD) ? 1 : 0;
srpc_batch_reply_t *bat_rep;
srpc_test_reply_t *test_rep;
srpc_stat_reply_t *stat_rep;
srpc_batch_reply_t *bat_rep;
srpc_test_reply_t *test_rep;
srpc_stat_reply_t *stat_rep;
mksn_rep->mksn_status == EINVAL);
lstcon_sesop_stat_failure(stat, 1);
mksn_rep->mksn_status == EINVAL);
lstcon_sesop_stat_failure(stat, 1);
rmsn_rep->rmsn_status == EINVAL);
lstcon_sesop_stat_failure(stat, 1);
rmsn_rep->rmsn_status == EINVAL);
lstcon_sesop_stat_failure(stat, 1);
-lstcon_rpc_trans_ndlist(struct list_head *ndlist,
- struct list_head *translist, int transop,
+lstcon_rpc_trans_ndlist(cfs_list_t *ndlist,
+ cfs_list_t *translist, int transop,
void *arg, lstcon_rpc_cond_func_t condition,
lstcon_rpc_trans_t **transpp)
{
void *arg, lstcon_rpc_cond_func_t condition,
lstcon_rpc_trans_t **transpp)
{
- list_for_each_entry(ndl, ndlist, ndl_link) {
+ cfs_list_for_each_entry_typed(ndl, ndlist, lstcon_ndlink_t, ndl_link) {
rc = condition == NULL ? 1 :
condition(transop, ndl->ndl_node, arg);
rc = condition == NULL ? 1 :
condition(transop, ndl->ndl_node, arg);
/* RPC pinger is a special case of transaction,
* it's called by timer at 8 seconds interval.
*/
/* RPC pinger is a special case of transaction,
* it's called by timer at 8 seconds interval.
*/
- list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link) {
+ cfs_list_for_each_entry_typed(ndl, &console_session.ses_ndl_list,
+ lstcon_ndlink_t, ndl_link) {
continue;
rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG, 0, 0, crpc);
continue;
rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG, 0, 0, crpc);
- LASSERT (list_empty(&console_session.ses_rpc_freelist));
- LASSERT (atomic_read(&console_session.ses_rpc_counter) == 0);
+ LASSERT (cfs_list_empty(&console_session.ses_rpc_freelist));
+ LASSERT (cfs_atomic_read(&console_session.ses_rpc_counter) == 0);
rc = lstcon_rpc_trans_prep(NULL, LST_TRANS_SESPING,
&console_session.ses_ping);
rc = lstcon_rpc_trans_prep(NULL, LST_TRANS_SESPING,
&console_session.ses_ping);
- while (!list_empty(&console_session.ses_trans_list)) {
- list_for_each(pacer, &console_session.ses_trans_list) {
- trans = list_entry(pacer, lstcon_rpc_trans_t, tas_link);
+ while (!cfs_list_empty(&console_session.ses_trans_list)) {
+ cfs_list_for_each(pacer, &console_session.ses_trans_list) {
+ trans = cfs_list_entry(pacer, lstcon_rpc_trans_t,
+ tas_link);
CDEBUG(D_NET, "Session closed, wakeup transaction %s\n",
lstcon_rpc_trans_name(trans->tas_opc));
CDEBUG(D_NET, "Session closed, wakeup transaction %s\n",
lstcon_rpc_trans_name(trans->tas_opc));
CWARN("Session is shutting down, "
"waiting for termination of transactions\n");
cfs_pause(cfs_time_seconds(1));
CWARN("Session is shutting down, "
"waiting for termination of transactions\n");
cfs_pause(cfs_time_seconds(1));
console_session.ses_rpc_lock,
"Network is not accessable or target is down, "
"waiting for %d console RPCs to being recycled\n",
console_session.ses_rpc_lock,
"Network is not accessable or target is down, "
"waiting for %d console RPCs to being recycled\n",
- list_add(&zlist, &console_session.ses_rpc_freelist);
- list_del_init(&console_session.ses_rpc_freelist);
+ cfs_list_add(&zlist, &console_session.ses_rpc_freelist);
+ cfs_list_del_init(&console_session.ses_rpc_freelist);
- while (!list_empty(&zlist)) {
- crpc = list_entry(zlist.next, lstcon_rpc_t, crp_link);
+ while (!cfs_list_empty(&zlist)) {
+ crpc = cfs_list_entry(zlist.next, lstcon_rpc_t, crp_link);
- spin_lock_init(&console_session.ses_rpc_lock);
- atomic_set(&console_session.ses_rpc_counter, 0);
+ cfs_spin_lock_init(&console_session.ses_rpc_lock);
+ cfs_atomic_set(&console_session.ses_rpc_counter, 0);
- LASSERT (list_empty(&console_session.ses_rpc_freelist));
- LASSERT (atomic_read(&console_session.ses_rpc_counter) == 0);
+ LASSERT (cfs_list_empty(&console_session.ses_rpc_freelist));
+ LASSERT (cfs_atomic_read(&console_session.ses_rpc_counter) == 0);