diff options
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 147aa22c3c3a..10ca6b2c26b7 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -266,15 +266,11 @@ static int wait_for_free_request(struct TCP_Server_Info *server, | |||
266 | while (1) { | 266 | while (1) { |
267 | if (atomic_read(&server->inFlight) >= cifs_max_pending) { | 267 | if (atomic_read(&server->inFlight) >= cifs_max_pending) { |
268 | spin_unlock(&GlobalMid_Lock); | 268 | spin_unlock(&GlobalMid_Lock); |
269 | #ifdef CONFIG_CIFS_STATS2 | 269 | cifs_num_waiters_inc(server); |
270 | atomic_inc(&server->num_waiters); | ||
271 | #endif | ||
272 | wait_event(server->request_q, | 270 | wait_event(server->request_q, |
273 | atomic_read(&server->inFlight) | 271 | atomic_read(&server->inFlight) |
274 | < cifs_max_pending); | 272 | < cifs_max_pending); |
275 | #ifdef CONFIG_CIFS_STATS2 | 273 | cifs_num_waiters_dec(server); |
276 | atomic_dec(&server->num_waiters); | ||
277 | #endif | ||
278 | spin_lock(&GlobalMid_Lock); | 274 | spin_lock(&GlobalMid_Lock); |
279 | } else { | 275 | } else { |
280 | if (server->tcpStatus == CifsExiting) { | 276 | if (server->tcpStatus == CifsExiting) { |
@@ -362,6 +358,8 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov, | |||
362 | mid = AllocMidQEntry(hdr, server); | 358 | mid = AllocMidQEntry(hdr, server); |
363 | if (mid == NULL) { | 359 | if (mid == NULL) { |
364 | mutex_unlock(&server->srv_mutex); | 360 | mutex_unlock(&server->srv_mutex); |
361 | atomic_dec(&server->inFlight); | ||
362 | wake_up(&server->request_q); | ||
365 | return -ENOMEM; | 363 | return -ENOMEM; |
366 | } | 364 | } |
367 | 365 | ||
@@ -379,15 +377,13 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov, | |||
379 | mid->callback = callback; | 377 | mid->callback = callback; |
380 | mid->callback_data = cbdata; | 378 | mid->callback_data = cbdata; |
381 | mid->midState = MID_REQUEST_SUBMITTED; | 379 | mid->midState = MID_REQUEST_SUBMITTED; |
382 | #ifdef CONFIG_CIFS_STATS2 | 380 | |
383 | atomic_inc(&server->inSend); | 381 | cifs_in_send_inc(server); |
384 | #endif | ||
385 | rc = smb_sendv(server, iov, nvec); | 382 | rc = smb_sendv(server, iov, nvec); |
386 | #ifdef CONFIG_CIFS_STATS2 | 383 | cifs_in_send_dec(server); |
387 | atomic_dec(&server->inSend); | 384 | cifs_save_when_sent(mid); |
388 | mid->when_sent = jiffies; | ||
389 | #endif | ||
390 | mutex_unlock(&server->srv_mutex); | 385 | mutex_unlock(&server->srv_mutex); |
386 | |||
391 | if (rc) | 387 | if (rc) |
392 | goto out_err; | 388 | goto out_err; |
393 | 389 | ||
@@ -573,14 +569,10 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
573 | } | 569 | } |
574 | 570 | ||
575 | midQ->midState = MID_REQUEST_SUBMITTED; | 571 | midQ->midState = MID_REQUEST_SUBMITTED; |
576 | #ifdef CONFIG_CIFS_STATS2 | 572 | cifs_in_send_inc(ses->server); |
577 | atomic_inc(&ses->server->inSend); | ||
578 | #endif | ||
579 | rc = smb_sendv(ses->server, iov, n_vec); | 573 | rc = smb_sendv(ses->server, iov, n_vec); |
580 | #ifdef CONFIG_CIFS_STATS2 | 574 | cifs_in_send_dec(ses->server); |
581 | atomic_dec(&ses->server->inSend); | 575 | cifs_save_when_sent(midQ); |
582 | midQ->when_sent = jiffies; | ||
583 | #endif | ||
584 | 576 | ||
585 | mutex_unlock(&ses->server->srv_mutex); | 577 | mutex_unlock(&ses->server->srv_mutex); |
586 | 578 | ||
@@ -701,14 +693,11 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, | |||
701 | } | 693 | } |
702 | 694 | ||
703 | midQ->midState = MID_REQUEST_SUBMITTED; | 695 | midQ->midState = MID_REQUEST_SUBMITTED; |
704 | #ifdef CONFIG_CIFS_STATS2 | 696 | |
705 | atomic_inc(&ses->server->inSend); | 697 | cifs_in_send_inc(ses->server); |
706 | #endif | ||
707 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); | 698 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); |
708 | #ifdef CONFIG_CIFS_STATS2 | 699 | cifs_in_send_dec(ses->server); |
709 | atomic_dec(&ses->server->inSend); | 700 | cifs_save_when_sent(midQ); |
710 | midQ->when_sent = jiffies; | ||
711 | #endif | ||
712 | mutex_unlock(&ses->server->srv_mutex); | 701 | mutex_unlock(&ses->server->srv_mutex); |
713 | 702 | ||
714 | if (rc < 0) | 703 | if (rc < 0) |
@@ -841,14 +830,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
841 | } | 830 | } |
842 | 831 | ||
843 | midQ->midState = MID_REQUEST_SUBMITTED; | 832 | midQ->midState = MID_REQUEST_SUBMITTED; |
844 | #ifdef CONFIG_CIFS_STATS2 | 833 | cifs_in_send_inc(ses->server); |
845 | atomic_inc(&ses->server->inSend); | ||
846 | #endif | ||
847 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); | 834 | rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); |
848 | #ifdef CONFIG_CIFS_STATS2 | 835 | cifs_in_send_dec(ses->server); |
849 | atomic_dec(&ses->server->inSend); | 836 | cifs_save_when_sent(midQ); |
850 | midQ->when_sent = jiffies; | ||
851 | #endif | ||
852 | mutex_unlock(&ses->server->srv_mutex); | 837 | mutex_unlock(&ses->server->srv_mutex); |
853 | 838 | ||
854 | if (rc < 0) { | 839 | if (rc < 0) { |