!list_empty(&conn->ibc_tx_queue_rsrvd)) {
tx = list_entry(conn->ibc_tx_queue_rsrvd.next,
struct kib_tx, tx_list);
- list_del(&tx->tx_list);
- list_add_tail(&tx->tx_list, &conn->ibc_tx_queue);
+ list_move_tail(&tx->tx_list, &conn->ibc_tx_queue);
conn->ibc_reserved_credits--;
}
bool
kiblnd_reconnect_peer(struct kib_peer_ni *peer_ni)
{
- rwlock_t *glock = &kiblnd_data.kib_global_lock;
- char *reason = NULL;
- struct list_head txs;
- unsigned long flags;
-
- INIT_LIST_HEAD(&txs);
+ rwlock_t *glock = &kiblnd_data.kib_global_lock;
+ char *reason = NULL;
+ LIST_HEAD(txs);
+ unsigned long flags;
write_lock_irqsave(glock, flags);
if (peer_ni->ibp_reconnecting == 0) {
void
kiblnd_abort_txs(struct kib_conn *conn, struct list_head *txs)
{
- struct list_head zombies = LIST_HEAD_INIT(zombies);
+ LIST_HEAD(zombies);
struct list_head *tmp;
struct list_head *nxt;
struct kib_tx *tx;
*/
if (tx->tx_sending == 0) {
tx->tx_queued = 0;
- list_del(&tx->tx_list);
- list_add(&tx->tx_list, &zombies);
+ list_move(&tx->tx_list, &zombies);
}
}
kiblnd_peer_connect_failed(struct kib_peer_ni *peer_ni, int active,
int error)
{
- struct list_head zombies = LIST_HEAD_INIT(zombies);
+ LIST_HEAD(zombies);
unsigned long flags;
LASSERT (error != 0);
{
struct kib_peer_ni *peer_ni = conn->ibc_peer;
struct kib_tx *tx;
- struct list_head txs;
+ LIST_HEAD(txs);
unsigned long flags;
int active;
}
/* grab pending txs while I have the lock */
- INIT_LIST_HEAD(&txs);
list_splice_init(&peer_ni->ibp_tx_queue, &txs);
if (!kiblnd_peer_active(peer_ni) || /* peer_ni has been deleted */
}
write_lock_irqsave(glock, flags);
- /* retry connection if it's still needed and no other connection
- * attempts (active or passive) are in progress
- * NB: reconnect is still needed even when ibp_tx_queue is
- * empty if ibp_version != version because reconnect may be
- * initiated by kiblnd_query() */
+ /* retry connection if it's still needed and no other connection
+ * attempts (active or passive) are in progress
+ * NB: reconnect is still needed even when ibp_tx_queue is
+ * empty if ibp_version != version because reconnect may be
+ * initiated.
+ */
reconnect = (!list_empty(&peer_ni->ibp_tx_queue) ||
peer_ni->ibp_version != version) &&
peer_ni->ibp_connecting &&
static void
kiblnd_check_conns (int idx)
{
- struct list_head closes = LIST_HEAD_INIT(closes);
- struct list_head checksends = LIST_HEAD_INIT(checksends);
- struct list_head timedout_txs = LIST_HEAD_INIT(timedout_txs);
+ LIST_HEAD(closes);
+ LIST_HEAD(checksends);
+ LIST_HEAD(timedout_txs);
struct list_head *peers = &kiblnd_data.kib_peers[idx];
struct list_head *ptmp;
struct kib_peer_ni *peer_ni;