summaryrefslogtreecommitdiff
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2019-03-08 05:58:20 +0300
committerSteve French <stfrench@microsoft.com>2019-03-15 03:32:35 +0300
commitb227d215deef4f3528b8f754accef4db03539a59 (patch)
tree99fafcb617c74ccb739dd290be960723091142b2 /fs/cifs/transport.c
parent4230cff8c0b7aaee7203e434b05a9acc1635fc04 (diff)
downloadlinux-b227d215deef4f3528b8f754accef4db03539a59.tar.xz
cifs: wait_for_free_credits() make it possible to wait for >=1 credits
Change wait_for_free_credits() to allow waiting for >=1 credits instead of just a single credit. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 9fcc4a82943d..1951f9f74bb2 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -486,8 +486,8 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
}
static int
-wait_for_free_credits(struct TCP_Server_Info *server, const int flags,
- unsigned int *instance)
+wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits,
+ const int flags, unsigned int *instance)
{
int rc;
int *credits;
@@ -513,11 +513,11 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int flags,
}
while (1) {
- if (*credits <= 0) {
+ if (*credits < num_credits) {
spin_unlock(&server->req_lock);
cifs_num_waiters_inc(server);
rc = wait_event_killable(server->request_q,
- has_credits(server, credits));
+ has_credits(server, credits, num_credits));
cifs_num_waiters_dec(server);
if (rc)
return rc;
@@ -535,8 +535,8 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int flags,
/* update # of requests on the wire to server */
if ((flags & CIFS_TIMEOUT_MASK) != CIFS_BLOCKING_OP) {
- *credits -= 1;
- server->in_flight++;
+ *credits -= num_credits;
+ server->in_flight += num_credits;
*instance = server->reconnect_instance;
}
spin_unlock(&server->req_lock);
@@ -550,7 +550,7 @@ static int
wait_for_free_request(struct TCP_Server_Info *server, const int flags,
unsigned int *instance)
{
- return wait_for_free_credits(server, flags, instance);
+ return wait_for_free_credits(server, 1, flags, instance);
}
int