Commit c5797a94 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: make wait_for_free_request take a TCP_Server_Info pointer

The cifsSesInfo pointer is only used to get at the server.
Reviewed-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
Reviewed-by: default avatarPavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 9d78315b
...@@ -244,31 +244,31 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer, ...@@ -244,31 +244,31 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
return smb_sendv(server, &iov, 1); return smb_sendv(server, &iov, 1);
} }
static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) static int wait_for_free_request(struct TCP_Server_Info *server,
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(&server->inFlight);
return 0; return 0;
} }
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
while (1) { while (1) {
if (atomic_read(&ses->server->inFlight) >= if (atomic_read(&server->inFlight) >= cifs_max_pending) {
cifs_max_pending){
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
atomic_inc(&ses->server->num_waiters); atomic_inc(&server->num_waiters);
#endif #endif
wait_event(ses->server->request_q, wait_event(server->request_q,
atomic_read(&ses->server->inFlight) atomic_read(&server->inFlight)
< cifs_max_pending); < cifs_max_pending);
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
atomic_dec(&ses->server->num_waiters); atomic_dec(&server->num_waiters);
#endif #endif
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
} else { } else {
if (ses->server->tcpStatus == CifsExiting) { if (server->tcpStatus == CifsExiting) {
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
return -ENOENT; return -ENOENT;
} }
...@@ -278,7 +278,7 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) ...@@ -278,7 +278,7 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
/* update # of requests on the wire to server */ /* update # of requests on the wire to server */
if (long_op != CIFS_BLOCKING_OP) if (long_op != CIFS_BLOCKING_OP)
atomic_inc(&ses->server->inFlight); atomic_inc(&server->inFlight);
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
break; break;
} }
...@@ -413,7 +413,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -413,7 +413,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
to the same server. We may make this configurable later or to the same server. We may make this configurable later or
use ses->maxReq */ use ses->maxReq */
rc = wait_for_free_request(ses, long_op); rc = wait_for_free_request(ses->server, long_op);
if (rc) { if (rc) {
cifs_small_buf_release(in_buf); cifs_small_buf_release(in_buf);
return rc; return rc;
...@@ -610,7 +610,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -610,7 +610,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
return -EIO; return -EIO;
} }
rc = wait_for_free_request(ses, long_op); rc = wait_for_free_request(ses->server, long_op);
if (rc) if (rc)
return rc; return rc;
...@@ -845,7 +845,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, ...@@ -845,7 +845,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
return -EIO; return -EIO;
} }
rc = wait_for_free_request(ses, CIFS_BLOCKING_OP); rc = wait_for_free_request(ses->server, CIFS_BLOCKING_OP);
if (rc) if (rc)
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment