* Don't try to link it to peer because the conn
* has already had a chance to proceed at the beginning */
if (peer == NULL) {
- LASSERT(cfs_list_empty(&conn->uc_tx_list) &&
- cfs_list_empty(&conn->uc_zcack_list));
+ LASSERT(list_empty(&conn->uc_tx_list) &&
+ list_empty(&conn->uc_zcack_list));
usocklnd_conn_kill(conn);
return 0;
* make us zombie soon and take care of our txs and
* zc_acks */
- cfs_list_t tx_list, zcack_list;
+ struct list_head tx_list, zcack_list;
usock_conn_t *conn2;
int idx = usocklnd_type2idx(conn->uc_type);
- CFS_INIT_LIST_HEAD (&tx_list);
- CFS_INIT_LIST_HEAD (&zcack_list);
+ INIT_LIST_HEAD(&tx_list);
+ INIT_LIST_HEAD(&zcack_list);
/* Block usocklnd_send() to check peer->up_conns[idx]
* and to enqueue more txs */
conn2->uc_peer = peer;
/* unlink txs and zcack from the conn */
- cfs_list_add(&tx_list, &conn->uc_tx_list);
- cfs_list_del_init(&conn->uc_tx_list);
- cfs_list_add(&zcack_list, &conn->uc_zcack_list);
- cfs_list_del_init(&conn->uc_zcack_list);
+ list_add(&tx_list, &conn->uc_tx_list);
+ list_del_init(&conn->uc_tx_list);
+ list_add(&zcack_list, &conn->uc_zcack_list);
+ list_del_init(&conn->uc_zcack_list);
/* link they to the conn2 */
- cfs_list_add(&conn2->uc_tx_list, &tx_list);
- cfs_list_del_init(&tx_list);
- cfs_list_add(&conn2->uc_zcack_list, &zcack_list);
- cfs_list_del_init(&zcack_list);
+ list_add(&conn2->uc_tx_list, &tx_list);
+ list_del_init(&tx_list);
+ list_add(&conn2->uc_zcack_list, &zcack_list);
+ list_del_init(&zcack_list);
/* make conn zombie */
conn->uc_peer = NULL;
* received hello, but maybe we've smth. to
* send? */
LASSERT (conn->uc_sending == 0);
- if ( !cfs_list_empty(&conn->uc_tx_list) ||
- !cfs_list_empty(&conn->uc_zcack_list) ) {
+ if (!list_empty(&conn->uc_tx_list) ||
+ !list_empty(&conn->uc_zcack_list)) {
conn->uc_tx_deadline =
cfs_time_shift(usock_tuns.ut_timeout);
LASSERT (peer != NULL);
ni = peer->up_ni;
- if (cfs_list_empty(&conn->uc_tx_list) &&
- cfs_list_empty(&conn->uc_zcack_list)) {
+ if (list_empty(&conn->uc_tx_list) &&
+ list_empty(&conn->uc_zcack_list)) {
LASSERT(usock_tuns.ut_fair_limit > 1);
pthread_mutex_unlock(&conn->uc_lock);
return 0;
rc = usocklnd_send_tx(conn, tx);
if (rc == 0) { /* partial send or connection closed */
pthread_mutex_lock(&conn->uc_lock);
- cfs_list_add(&tx->tx_list, &conn->uc_tx_list);
+ list_add(&tx->tx_list, &conn->uc_tx_list);
conn->uc_sending = 0;
pthread_mutex_unlock(&conn->uc_lock);
break;
pthread_mutex_lock(&conn->uc_lock);
conn->uc_sending = 0;
if (conn->uc_state != UC_DEAD &&
- cfs_list_empty(&conn->uc_tx_list) &&
- cfs_list_empty(&conn->uc_zcack_list)) {
+ list_empty(&conn->uc_tx_list) &&
+ list_empty(&conn->uc_zcack_list)) {
conn->uc_tx_flag = 0;
ret = usocklnd_add_pollrequest(conn,
POLL_TX_SET_REQUEST, 0);
* brand new noop tx for zc_ack from zcack_list. Return NULL
* if an error happened */
usock_tx_t *
-usocklnd_try_piggyback(cfs_list_t *tx_list_p,
- cfs_list_t *zcack_list_p)
+usocklnd_try_piggyback(struct list_head *tx_list_p,
+ struct list_head *zcack_list_p)
{
usock_tx_t *tx;
usock_zc_ack_t *zc_ack;
/* assign tx and zc_ack */
- if (cfs_list_empty(tx_list_p))
+ if (list_empty(tx_list_p))
tx = NULL;
else {
- tx = cfs_list_entry(tx_list_p->next, usock_tx_t, tx_list);
- cfs_list_del(&tx->tx_list);
+ tx = list_entry(tx_list_p->next, usock_tx_t, tx_list);
+ list_del(&tx->tx_list);
/* already piggybacked or partially send */
if (tx->tx_msg.ksm_zc_cookies[1] != 0 ||
return tx;
}
- if (cfs_list_empty(zcack_list_p)) {
+ if (list_empty(zcack_list_p)) {
/* nothing to piggyback */
return tx;
} else {
- zc_ack = cfs_list_entry(zcack_list_p->next,
+ zc_ack = list_entry(zcack_list_p->next,
usock_zc_ack_t, zc_list);
- cfs_list_del(&zc_ack->zc_list);
+ list_del(&zc_ack->zc_list);
}
if (tx != NULL)
{
usock_conn_t *conn2;
usock_peer_t *peer;
- cfs_list_t tx_list;
- cfs_list_t zcack_list;
+ struct list_head tx_list;
+ struct list_head zcack_list;
int idx;
int rc = 0;
/* all code below is race resolution, because normally
* passive conn is linked to peer just after receiving hello */
- CFS_INIT_LIST_HEAD (&tx_list);
- CFS_INIT_LIST_HEAD (&zcack_list);
+ INIT_LIST_HEAD(&tx_list);
+ INIT_LIST_HEAD(&zcack_list);
/* conn is passive and isn't linked to any peer,
so its tx and zc_ack lists have to be empty */
- LASSERT (cfs_list_empty(&conn->uc_tx_list) &&
- cfs_list_empty(&conn->uc_zcack_list) &&
+ LASSERT(list_empty(&conn->uc_tx_list) &&
+ list_empty(&conn->uc_zcack_list) &&
conn->uc_sending == 0);
rc = usocklnd_find_or_create_peer(conn->uc_ni, conn->uc_peerid, &peer);
* We're sure that nobody but us can access to conn,
* nevertheless we use mutex (if we're wrong yet,
* deadlock is easy to see that corrupted list */
- cfs_list_add(&tx_list, &conn2->uc_tx_list);
- cfs_list_del_init(&conn2->uc_tx_list);
- cfs_list_add(&zcack_list, &conn2->uc_zcack_list);
- cfs_list_del_init(&conn2->uc_zcack_list);
+ list_add(&tx_list, &conn2->uc_tx_list);
+ list_del_init(&conn2->uc_tx_list);
+ list_add(&zcack_list, &conn2->uc_zcack_list);
+ list_del_init(&conn2->uc_zcack_list);
pthread_mutex_lock(&conn->uc_lock);
- cfs_list_add_tail(&conn->uc_tx_list, &tx_list);
- cfs_list_del_init(&tx_list);
- cfs_list_add_tail(&conn->uc_zcack_list, &zcack_list);
- cfs_list_del_init(&zcack_list);
+ list_add_tail(&conn->uc_tx_list, &tx_list);
+ list_del_init(&tx_list);
+ list_add_tail(&conn->uc_zcack_list, &zcack_list);
+ list_del_init(&zcack_list);
conn->uc_peer = peer;
pthread_mutex_unlock(&conn->uc_lock);
/* we're ready to recive incoming packets and maybe
already have smth. to transmit */
LASSERT (conn->uc_sending == 0);
- if ( cfs_list_empty(&conn->uc_tx_list) &&
- cfs_list_empty(&conn->uc_zcack_list) ) {
+ if (list_empty(&conn->uc_tx_list) &&
+ list_empty(&conn->uc_zcack_list)) {
conn->uc_tx_flag = 0;
rc = usocklnd_add_pollrequest(conn, POLL_SET_REQUEST,
POLLIN);