CIFS: Simplify inFlight logic
by making it as unsigned integer and surround access with req_lock
from server structure.
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 0ac595c..ed91abc 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -643,14 +643,14 @@
wake_up_all(&server->response_q);
/* Check if we have blocked requests that need to free. */
- spin_lock(&GlobalMid_Lock);
- if (atomic_read(&server->inFlight) >= server->maxReq)
- atomic_set(&server->inFlight, server->maxReq - 1);
+ spin_lock(&server->req_lock);
+ if (server->in_flight >= server->maxReq)
+ server->in_flight = server->maxReq - 1;
/*
* We do not want to set the max_pending too low or we could end up
* with the counter going negative.
*/
- spin_unlock(&GlobalMid_Lock);
+ spin_unlock(&server->req_lock);
/*
* Although there should not be any requests blocked on this queue it
* can not hurt to be paranoid and try to wake up requests that may
@@ -1905,7 +1905,7 @@
tcp_ses->noblocksnd = volume_info->noblocksnd;
tcp_ses->noautotune = volume_info->noautotune;
tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
- atomic_set(&tcp_ses->inFlight, 0);
+ tcp_ses->in_flight = 0;
tcp_ses->maxReq = 1; /* enough to send negotiate request */
init_waitqueue_head(&tcp_ses->response_q);
init_waitqueue_head(&tcp_ses->request_q);