aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2012-02-17 09:09:12 -0500
committerSteve French <sfrench@us.ibm.com>2012-03-21 12:27:35 -0400
commitfc40f9cf828908e91d9af820e9300a9d42fbbd72 (patch)
tree1d0aa12f099ea9c759321d5e75967e152fcf4b11 /fs/cifs/cifsglob.h
parent1daaae8fa4afe3df78ca34e724ed7e8187e4eb32 (diff)
CIFS: Simplify inFlight logic
by making it as unsigned integer and surround access with req_lock from server structure. 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.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index d47d20aac670..fb78bc903887 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -250,7 +250,8 @@ 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 atomic_t inFlight; /* number of requests on the wire to server */ 253 unsigned int in_flight; /* number of requests on the wire to server */
254 spinlock_t req_lock; /* protect the value above */
254 struct mutex srv_mutex; 255 struct mutex srv_mutex;
255 struct task_struct *tsk; 256 struct task_struct *tsk;
256 char server_GUID[16]; 257 char server_GUID[16];
@@ -303,6 +304,24 @@ struct TCP_Server_Info {
303#endif 304#endif
304}; 305};
305 306
307static inline unsigned int
308in_flight(struct TCP_Server_Info *server)
309{
310 unsigned int num;
311 spin_lock(&server->req_lock);
312 num = server->in_flight;
313 spin_unlock(&server->req_lock);
314 return num;
315}
316
317static inline void
318dec_in_flight(struct TCP_Server_Info *server)
319{
320 spin_lock(&server->req_lock);
321 server->in_flight--;
322 spin_unlock(&server->req_lock);
323}
324
306/* 325/*
307 * Macros to allow the TCP_Server_Info->net field and related code to drop out 326 * Macros to allow the TCP_Server_Info->net field and related code to drop out
308 * when CONFIG_NET_NS isn't set. 327 * when CONFIG_NET_NS isn't set.