Skip to content

Commit

Permalink
cifs: make wait_for_free_request take a TCP_Server_Info pointer
Browse files Browse the repository at this point in the history
The cifsSesInfo pointer is only used to get at the server.

Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Reviewed-by:  Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Jeff Layton authored and Steve French committed Jan 19, 2011
1 parent 9d78315 commit c5797a9
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions fs/cifs/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,31 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
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) {
/* oplock breaks must not be held up */
atomic_inc(&ses->server->inFlight);
atomic_inc(&server->inFlight);
return 0;
}

spin_lock(&GlobalMid_Lock);
while (1) {
if (atomic_read(&ses->server->inFlight) >=
cifs_max_pending){
if (atomic_read(&server->inFlight) >= cifs_max_pending) {
spin_unlock(&GlobalMid_Lock);
#ifdef CONFIG_CIFS_STATS2
atomic_inc(&ses->server->num_waiters);
atomic_inc(&server->num_waiters);
#endif
wait_event(ses->server->request_q,
atomic_read(&ses->server->inFlight)
wait_event(server->request_q,
atomic_read(&server->inFlight)
< cifs_max_pending);
#ifdef CONFIG_CIFS_STATS2
atomic_dec(&ses->server->num_waiters);
atomic_dec(&server->num_waiters);
#endif
spin_lock(&GlobalMid_Lock);
} else {
if (ses->server->tcpStatus == CifsExiting) {
if (server->tcpStatus == CifsExiting) {
spin_unlock(&GlobalMid_Lock);
return -ENOENT;
}
Expand All @@ -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 */
if (long_op != CIFS_BLOCKING_OP)
atomic_inc(&ses->server->inFlight);
atomic_inc(&server->inFlight);
spin_unlock(&GlobalMid_Lock);
break;
}
Expand Down Expand Up @@ -413,7 +413,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
to the same server. We may make this configurable later or
use ses->maxReq */

rc = wait_for_free_request(ses, long_op);
rc = wait_for_free_request(ses->server, long_op);
if (rc) {
cifs_small_buf_release(in_buf);
return rc;
Expand Down Expand Up @@ -610,7 +610,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
return -EIO;
}

rc = wait_for_free_request(ses, long_op);
rc = wait_for_free_request(ses->server, long_op);
if (rc)
return rc;

Expand Down Expand Up @@ -845,7 +845,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
return -EIO;
}

rc = wait_for_free_request(ses, CIFS_BLOCKING_OP);
rc = wait_for_free_request(ses->server, CIFS_BLOCKING_OP);
if (rc)
return rc;

Expand Down

0 comments on commit c5797a9

Please sign in to comment.