diff options
author | Pavel Shilovsky <piastry@etersoft.ru> | 2012-03-15 06:22:27 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2012-03-21 12:35:36 -0400 |
commit | bc205ed19bdb56576b291830bc3f752aef5e3923 (patch) | |
tree | abdda57d027c601d40027572b2d070b9432670a2 /fs/cifs/transport.c | |
parent | 5bc594982f49220d33e927e3c9e028bf87b4745c (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.c | 22 |
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, | |||
255 | } | 255 | } |
256 | 256 | ||
257 | static int | 257 | static int |
258 | wait_for_free_request(struct TCP_Server_Info *server, const int long_op) | 258 | wait_for_free_credits(struct TCP_Server_Info *server, const int optype, |
259 | int *credits) | ||
259 | { | 260 | { |
260 | int rc; | 261 | int rc; |
261 | 262 | ||
262 | spin_lock(&server->req_lock); | 263 | spin_lock(&server->req_lock); |
263 | 264 | if (optype == CIFS_ASYNC_OP) { | |
264 | if (long_op == CIFS_ASYNC_OP) { | ||
265 | /* oplock breaks must not be held up */ | 265 | /* oplock breaks must not be held up */ |
266 | server->in_flight++; | 266 | server->in_flight++; |
267 | server->credits--; | 267 | *credits -= 1; |
268 | spin_unlock(&server->req_lock); | 268 | spin_unlock(&server->req_lock); |
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
271 | 271 | ||
272 | while (1) { | 272 | while (1) { |
273 | if (server->credits <= 0) { | 273 | if (*credits <= 0) { |
274 | spin_unlock(&server->req_lock); | 274 | spin_unlock(&server->req_lock); |
275 | cifs_num_waiters_inc(server); | 275 | cifs_num_waiters_inc(server); |
276 | rc = wait_event_killable(server->request_q, | 276 | rc = wait_event_killable(server->request_q, |
277 | has_credits(server)); | 277 | has_credits(server, credits)); |
278 | cifs_num_waiters_dec(server); | 278 | cifs_num_waiters_dec(server); |
279 | if (rc) | 279 | if (rc) |
280 | return rc; | 280 | return rc; |
@@ -291,8 +291,8 @@ wait_for_free_request(struct TCP_Server_Info *server, const int long_op) | |||
291 | */ | 291 | */ |
292 | 292 | ||
293 | /* update # of requests on the wire to server */ | 293 | /* update # of requests on the wire to server */ |
294 | if (long_op != CIFS_BLOCKING_OP) { | 294 | if (optype != CIFS_BLOCKING_OP) { |
295 | server->credits--; | 295 | *credits -= 1; |
296 | server->in_flight++; | 296 | server->in_flight++; |
297 | } | 297 | } |
298 | spin_unlock(&server->req_lock); | 298 | spin_unlock(&server->req_lock); |
@@ -302,6 +302,12 @@ wait_for_free_request(struct TCP_Server_Info *server, const int long_op) | |||
302 | return 0; | 302 | return 0; |
303 | } | 303 | } |
304 | 304 | ||
305 | static int | ||
306 | wait_for_free_request(struct TCP_Server_Info *server, const int optype) | ||
307 | { | ||
308 | return wait_for_free_credits(server, optype, get_credits_field(server)); | ||
309 | } | ||
310 | |||
305 | static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, | 311 | static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, |
306 | struct mid_q_entry **ppmidQ) | 312 | struct mid_q_entry **ppmidQ) |
307 | { | 313 | { |