}
static inline bool
-has_credits(struct TCP_Server_Info *server, int *credits)
+has_credits(struct TCP_Server_Info *server, int *credits, int num_credits)
{
int num;
spin_lock(&server->req_lock);
num = *credits;
spin_unlock(&server->req_lock);
- return num > 0;
+ return num >= num_credits;
}
static inline void
spin_unlock(&server->req_lock);
cifs_num_waiters_inc(server);
rc = wait_event_killable(server->request_q,
- has_credits(server, &server->credits));
+ has_credits(server, &server->credits, 1));
cifs_num_waiters_dec(server);
if (rc)
return rc;
}
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;
}
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;
/* 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);
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