aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-08 15:59:39 -0500
committerSteve French <sfrench@us.ibm.com>2008-12-25 21:29:12 -0500
commit27a97a613b96688e59dd116cae3f0c94107b434c (patch)
treee2b4a13769731fa57c19d9840b9850d18ed2af66 /fs/cifs/transport.c
parent8fbbd365cc700e288fb6f9780b092c5afa4946e5 (diff)
[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>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index c98f929315f2..5f224e999585 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -344,37 +344,38 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
344 if (long_op == CIFS_ASYNC_OP) { 344 if (long_op == CIFS_ASYNC_OP) {
345 /* oplock breaks must not be held up */ 345 /* oplock breaks must not be held up */
346 atomic_inc(&ses->server->inFlight); 346 atomic_inc(&ses->server->inFlight);
347 } else { 347 return 0;
348 spin_lock(&GlobalMid_Lock); 348 }
349 while (1) { 349
350 if (atomic_read(&ses->server->inFlight) >= 350 spin_lock(&GlobalMid_Lock);
351 cifs_max_pending){ 351 while (1) {
352 spin_unlock(&GlobalMid_Lock); 352 if (atomic_read(&ses->server->inFlight) >=
353 cifs_max_pending){
354 spin_unlock(&GlobalMid_Lock);
353#ifdef CONFIG_CIFS_STATS2 355#ifdef CONFIG_CIFS_STATS2
354 atomic_inc(&ses->server->num_waiters); 356 atomic_inc(&ses->server->num_waiters);
355#endif 357#endif
356 wait_event(ses->server->request_q, 358 wait_event(ses->server->request_q,
357 atomic_read(&ses->server->inFlight) 359 atomic_read(&ses->server->inFlight)
358 < cifs_max_pending); 360 < cifs_max_pending);
359#ifdef CONFIG_CIFS_STATS2 361#ifdef CONFIG_CIFS_STATS2
360 atomic_dec(&ses->server->num_waiters); 362 atomic_dec(&ses->server->num_waiters);
361#endif 363#endif
362 spin_lock(&GlobalMid_Lock); 364 spin_lock(&GlobalMid_Lock);
363 } else { 365 } else {
364 if (ses->server->tcpStatus == CifsExiting) { 366 if (ses->server->tcpStatus == CifsExiting) {
365 spin_unlock(&GlobalMid_Lock);
366 return -ENOENT;
367 }
368
369 /* can not count locking commands against total
370 as they are allowed to block on server */
371
372 /* update # of requests on the wire to server */
373 if (long_op != CIFS_BLOCKING_OP)
374 atomic_inc(&ses->server->inFlight);
375 spin_unlock(&GlobalMid_Lock); 367 spin_unlock(&GlobalMid_Lock);
376 break; 368 return -ENOENT;
377 } 369 }
370
371 /* can not count locking commands against total
372 as they are allowed to block on server */
373
374 /* update # of requests on the wire to server */
375 if (long_op != CIFS_BLOCKING_OP)
376 atomic_inc(&ses->server->inFlight);
377 spin_unlock(&GlobalMid_Lock);
378 break;
378 } 379 }
379 } 380 }
380 return 0; 381 return 0;