aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2012-02-06 06:59:18 -0500
committerSteve French <sfrench@us.ibm.com>2012-03-21 12:35:03 -0400
commit2d86dbc97094ea4cfc2204fdefd7d07685496189 (patch)
tree9aee614e155fd837c78ded2cd083dead1a9d4a3f /fs/cifs/cifsglob.h
parentfc40f9cf828908e91d9af820e9300a9d42fbbd72 (diff)
CIFS: Introduce credit-based flow control
and send no more than credits value requests at once. For SMB/CIFS it's trivial: increment this value by receiving any message and decrement by sending one. 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/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index fb78bc903887..d55de9684df9 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -250,8 +250,9 @@ struct TCP_Server_Info {
250 bool noblocksnd; /* use blocking sendmsg */ 250 bool noblocksnd; /* use blocking sendmsg */
251 bool noautotune; /* do not autotune send buf sizes */ 251 bool noautotune; /* do not autotune send buf sizes */
252 bool tcp_nodelay; 252 bool tcp_nodelay;
253 int credits; /* send no more requests at once */
253 unsigned int in_flight; /* number of requests on the wire to server */ 254 unsigned int in_flight; /* number of requests on the wire to server */
254 spinlock_t req_lock; /* protect the value above */ 255 spinlock_t req_lock; /* protect the two values above */
255 struct mutex srv_mutex; 256 struct mutex srv_mutex;
256 struct task_struct *tsk; 257 struct task_struct *tsk;
257 char server_GUID[16]; 258 char server_GUID[16];
@@ -314,12 +315,14 @@ in_flight(struct TCP_Server_Info *server)
314 return num; 315 return num;
315} 316}
316 317
317static inline void 318static inline bool
318dec_in_flight(struct TCP_Server_Info *server) 319has_credits(struct TCP_Server_Info *server)
319{ 320{
321 int num;
320 spin_lock(&server->req_lock); 322 spin_lock(&server->req_lock);
321 server->in_flight--; 323 num = server->credits;
322 spin_unlock(&server->req_lock); 324 spin_unlock(&server->req_lock);
325 return num > 0;
323} 326}
324 327
325/* 328/*