[CIFS] Slightly simplify wait_for_free_request(), remove an unnecessary "else" branch
This is no functional change, because in the "if" branch we do an early "return 0;". Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
committed by
Steve French
parent
8fbbd365cc
commit
27a97a613b
@@ -344,37 +344,38 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
|
|||||||
if (long_op == CIFS_ASYNC_OP) {
|
if (long_op == CIFS_ASYNC_OP) {
|
||||||
/* oplock breaks must not be held up */
|
/* oplock breaks must not be held up */
|
||||||
atomic_inc(&ses->server->inFlight);
|
atomic_inc(&ses->server->inFlight);
|
||||||
} else {
|
return 0;
|
||||||
spin_lock(&GlobalMid_Lock);
|
}
|
||||||
while (1) {
|
|
||||||
if (atomic_read(&ses->server->inFlight) >=
|
|
||||||
cifs_max_pending){
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
|
||||||
#ifdef CONFIG_CIFS_STATS2
|
|
||||||
atomic_inc(&ses->server->num_waiters);
|
|
||||||
#endif
|
|
||||||
wait_event(ses->server->request_q,
|
|
||||||
atomic_read(&ses->server->inFlight)
|
|
||||||
< cifs_max_pending);
|
|
||||||
#ifdef CONFIG_CIFS_STATS2
|
|
||||||
atomic_dec(&ses->server->num_waiters);
|
|
||||||
#endif
|
|
||||||
spin_lock(&GlobalMid_Lock);
|
|
||||||
} else {
|
|
||||||
if (ses->server->tcpStatus == CifsExiting) {
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* can not count locking commands against total
|
spin_lock(&GlobalMid_Lock);
|
||||||
as they are allowed to block on server */
|
while (1) {
|
||||||
|
if (atomic_read(&ses->server->inFlight) >=
|
||||||
/* update # of requests on the wire to server */
|
cifs_max_pending){
|
||||||
if (long_op != CIFS_BLOCKING_OP)
|
spin_unlock(&GlobalMid_Lock);
|
||||||
atomic_inc(&ses->server->inFlight);
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
|
atomic_inc(&ses->server->num_waiters);
|
||||||
|
#endif
|
||||||
|
wait_event(ses->server->request_q,
|
||||||
|
atomic_read(&ses->server->inFlight)
|
||||||
|
< cifs_max_pending);
|
||||||
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
|
atomic_dec(&ses->server->num_waiters);
|
||||||
|
#endif
|
||||||
|
spin_lock(&GlobalMid_Lock);
|
||||||
|
} else {
|
||||||
|
if (ses->server->tcpStatus == CifsExiting) {
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
break;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* can not count locking commands against total
|
||||||
|
as they are allowed to block on server */
|
||||||
|
|
||||||
|
/* update # of requests on the wire to server */
|
||||||
|
if (long_op != CIFS_BLOCKING_OP)
|
||||||
|
atomic_inc(&ses->server->inFlight);
|
||||||
|
spin_unlock(&GlobalMid_Lock);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user