summaryrefslogtreecommitdiff
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2012-03-15 13:22:27 +0300
committerSteve French <sfrench@us.ibm.com>2012-03-21 11:35:36 -0500
commitbc205ed19bdb56576b291830bc3f752aef5e3923 (patch)
treeabdda57d027c601d40027572b2d070b9432670a2 /fs/cifs/transport.c
parent5bc594982f49220d33e927e3c9e028bf87b4745c (diff)
CIFS: Prepare credits code for a slot reservation
that is essential for CIFS/SMB/SMB2 oplock breaks and SMB2 echos. Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 58b31da17fc5..310918b6fcb4 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -255,26 +255,26 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
}
static int
-wait_for_free_request(struct TCP_Server_Info *server, const int long_op)
+wait_for_free_credits(struct TCP_Server_Info *server, const int optype,
+ int *credits)
{
int rc;
spin_lock(&server->req_lock);
-
- if (long_op == CIFS_ASYNC_OP) {
+ if (optype == CIFS_ASYNC_OP) {
/* oplock breaks must not be held up */
server->in_flight++;
- server->credits--;
+ *credits -= 1;
spin_unlock(&server->req_lock);
return 0;
}
while (1) {
- if (server->credits <= 0) {
+ if (*credits <= 0) {
spin_unlock(&server->req_lock);
cifs_num_waiters_inc(server);
rc = wait_event_killable(server->request_q,
- has_credits(server));
+ has_credits(server, credits));
cifs_num_waiters_dec(server);
if (rc)
return rc;
@@ -291,8 +291,8 @@ wait_for_free_request(struct TCP_Server_Info *server, const int long_op)
*/
/* update # of requests on the wire to server */
- if (long_op != CIFS_BLOCKING_OP) {
- server->credits--;
+ if (optype != CIFS_BLOCKING_OP) {
+ *credits -= 1;
server->in_flight++;
}
spin_unlock(&server->req_lock);
@@ -302,6 +302,12 @@ wait_for_free_request(struct TCP_Server_Info *server, const int long_op)
return 0;
}
+static int
+wait_for_free_request(struct TCP_Server_Info *server, const int optype)
+{
+ return wait_for_free_credits(server, optype, get_credits_field(server));
+}
+
static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
struct mid_q_entry **ppmidQ)
{