mirror of
https://git.openafs.org/openafs.git
synced 2025-02-01 05:57:43 +00:00
rx-tq-busy-20070516
FIXES 60046 abstract tq busy wait code
This commit is contained in:
parent
a900fe3089
commit
7a72e2445f
61
src/rx/rx.c
61
src/rx/rx.c
@ -1039,6 +1039,24 @@ rx_GetConnection(register struct rx_connection *conn)
|
|||||||
USERPRI;
|
USERPRI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait for the transmit queue to no longer be busy.
|
||||||
|
* requires the call->lock to be held */
|
||||||
|
static void rxi_WaitforTQBusy(struct rx_call *call) {
|
||||||
|
while (call->flags & RX_CALL_TQ_BUSY) {
|
||||||
|
call->flags |= RX_CALL_TQ_WAIT;
|
||||||
|
call->tqWaiters++;
|
||||||
|
#ifdef RX_ENABLE_LOCKS
|
||||||
|
osirx_AssertMine(&call->lock, "rxi_WaitforTQ lock");
|
||||||
|
CV_WAIT(&call->cv_tq, &call->lock);
|
||||||
|
#else /* RX_ENABLE_LOCKS */
|
||||||
|
osi_rxSleep(&call->tq);
|
||||||
|
#endif /* RX_ENABLE_LOCKS */
|
||||||
|
call->tqWaiters--;
|
||||||
|
if (call->tqWaiters == 0) {
|
||||||
|
call->flags &= ~RX_CALL_TQ_WAIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Start a new rx remote procedure call, on the specified connection.
|
/* Start a new rx remote procedure call, on the specified connection.
|
||||||
* If wait is set to 1, wait for a free call channel; otherwise return
|
* If wait is set to 1, wait for a free call channel; otherwise return
|
||||||
* 0. Maxtime gives the maximum number of seconds this call may take,
|
* 0. Maxtime gives the maximum number of seconds this call may take,
|
||||||
@ -1164,20 +1182,7 @@ rx_NewCall(register struct rx_connection *conn)
|
|||||||
#ifdef AFS_GLOBAL_RXLOCK_KERNEL
|
#ifdef AFS_GLOBAL_RXLOCK_KERNEL
|
||||||
/* Now, if TQ wasn't cleared earlier, do it now. */
|
/* Now, if TQ wasn't cleared earlier, do it now. */
|
||||||
MUTEX_ENTER(&call->lock);
|
MUTEX_ENTER(&call->lock);
|
||||||
while (call->flags & RX_CALL_TQ_BUSY) {
|
rxi_WaitforTQBusy(call);
|
||||||
call->flags |= RX_CALL_TQ_WAIT;
|
|
||||||
call->tqWaiters++;
|
|
||||||
#ifdef RX_ENABLE_LOCKS
|
|
||||||
osirx_AssertMine(&call->lock, "rxi_Start lock4");
|
|
||||||
CV_WAIT(&call->cv_tq, &call->lock);
|
|
||||||
#else /* RX_ENABLE_LOCKS */
|
|
||||||
osi_rxSleep(&call->tq);
|
|
||||||
#endif /* RX_ENABLE_LOCKS */
|
|
||||||
call->tqWaiters--;
|
|
||||||
if (call->tqWaiters == 0) {
|
|
||||||
call->flags &= ~RX_CALL_TQ_WAIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (call->flags & RX_CALL_TQ_CLEARME) {
|
if (call->flags & RX_CALL_TQ_CLEARME) {
|
||||||
rxi_ClearTransmitQueue(call, 0);
|
rxi_ClearTransmitQueue(call, 0);
|
||||||
queue_Init(&call->tq);
|
queue_Init(&call->tq);
|
||||||
@ -3891,19 +3896,7 @@ rxi_ReceiveAckPacket(register struct rx_call *call, struct rx_packet *np,
|
|||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
call->flags |= RX_CALL_FAST_RECOVER_WAIT;
|
call->flags |= RX_CALL_FAST_RECOVER_WAIT;
|
||||||
while (call->flags & RX_CALL_TQ_BUSY) {
|
rxi_WaitforTQBusy(call);
|
||||||
call->flags |= RX_CALL_TQ_WAIT;
|
|
||||||
call->tqWaiters++;
|
|
||||||
#ifdef RX_ENABLE_LOCKS
|
|
||||||
osirx_AssertMine(&call->lock, "rxi_Start lock2");
|
|
||||||
CV_WAIT(&call->cv_tq, &call->lock);
|
|
||||||
#else /* RX_ENABLE_LOCKS */
|
|
||||||
osi_rxSleep(&call->tq);
|
|
||||||
#endif /* RX_ENABLE_LOCKS */
|
|
||||||
call->tqWaiters--;
|
|
||||||
if (call->tqWaiters == 0)
|
|
||||||
call->flags &= ~RX_CALL_TQ_WAIT;
|
|
||||||
}
|
|
||||||
MUTEX_ENTER(&peer->peer_lock);
|
MUTEX_ENTER(&peer->peer_lock);
|
||||||
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
|
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
|
||||||
call->flags &= ~RX_CALL_FAST_RECOVER_WAIT;
|
call->flags &= ~RX_CALL_FAST_RECOVER_WAIT;
|
||||||
@ -5111,19 +5104,7 @@ rxi_Start(struct rxevent *event, register struct rx_call *call,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
call->flags |= RX_CALL_FAST_RECOVER_WAIT;
|
call->flags |= RX_CALL_FAST_RECOVER_WAIT;
|
||||||
while (call->flags & RX_CALL_TQ_BUSY) {
|
rxi_WaitforTQBusy(call);
|
||||||
call->flags |= RX_CALL_TQ_WAIT;
|
|
||||||
call->tqWaiters++;
|
|
||||||
#ifdef RX_ENABLE_LOCKS
|
|
||||||
osirx_AssertMine(&call->lock, "rxi_Start lock1");
|
|
||||||
CV_WAIT(&call->cv_tq, &call->lock);
|
|
||||||
#else /* RX_ENABLE_LOCKS */
|
|
||||||
osi_rxSleep(&call->tq);
|
|
||||||
#endif /* RX_ENABLE_LOCKS */
|
|
||||||
call->tqWaiters--;
|
|
||||||
if (call->tqWaiters == 0)
|
|
||||||
call->flags &= ~RX_CALL_TQ_WAIT;
|
|
||||||
}
|
|
||||||
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
|
#endif /* AFS_GLOBAL_RXLOCK_KERNEL */
|
||||||
call->flags &= ~RX_CALL_FAST_RECOVER_WAIT;
|
call->flags &= ~RX_CALL_FAST_RECOVER_WAIT;
|
||||||
call->flags |= RX_CALL_FAST_RECOVER;
|
call->flags |= RX_CALL_FAST_RECOVER;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user