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>
This commit is contained in:
committed by
Steve French
parent
1daaae8fa4
commit
fc40f9cf82
@@ -643,14 +643,14 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
|
||||
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 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user