diff options
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r-- | fs/cifs/cifsglob.h | 86 |
1 files changed, 66 insertions, 20 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 76e7d8b6da1..4ff6313f0a9 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -55,14 +55,9 @@ | |||
55 | 55 | ||
56 | /* | 56 | /* |
57 | * MAX_REQ is the maximum number of requests that WE will send | 57 | * MAX_REQ is the maximum number of requests that WE will send |
58 | * on one socket concurrently. It also matches the most common | 58 | * on one socket concurrently. |
59 | * value of max multiplex returned by servers. We may | ||
60 | * eventually want to use the negotiated value (in case | ||
61 | * future servers can handle more) when we are more confident that | ||
62 | * we will not have problems oveloading the socket with pending | ||
63 | * write data. | ||
64 | */ | 59 | */ |
65 | #define CIFS_MAX_REQ 50 | 60 | #define CIFS_MAX_REQ 32767 |
66 | 61 | ||
67 | #define RFC1001_NAME_LEN 15 | 62 | #define RFC1001_NAME_LEN 15 |
68 | #define RFC1001_NAME_LEN_WITH_NULL (RFC1001_NAME_LEN + 1) | 63 | #define RFC1001_NAME_LEN_WITH_NULL (RFC1001_NAME_LEN + 1) |
@@ -235,6 +230,12 @@ struct cifs_mnt_data { | |||
235 | int flags; | 230 | int flags; |
236 | }; | 231 | }; |
237 | 232 | ||
233 | static inline unsigned int | ||
234 | get_rfc1002_length(void *buf) | ||
235 | { | ||
236 | return be32_to_cpu(*((__be32 *)buf)); | ||
237 | } | ||
238 | |||
238 | struct TCP_Server_Info { | 239 | struct TCP_Server_Info { |
239 | struct list_head tcp_ses_list; | 240 | struct list_head tcp_ses_list; |
240 | struct list_head smb_ses_list; | 241 | struct list_head smb_ses_list; |
@@ -255,7 +256,9 @@ struct TCP_Server_Info { | |||
255 | bool noblocksnd; /* use blocking sendmsg */ | 256 | bool noblocksnd; /* use blocking sendmsg */ |
256 | bool noautotune; /* do not autotune send buf sizes */ | 257 | bool noautotune; /* do not autotune send buf sizes */ |
257 | bool tcp_nodelay; | 258 | bool tcp_nodelay; |
258 | atomic_t inFlight; /* number of requests on the wire to server */ | 259 | int credits; /* send no more requests at once */ |
260 | unsigned int in_flight; /* number of requests on the wire to server */ | ||
261 | spinlock_t req_lock; /* protect the two values above */ | ||
259 | struct mutex srv_mutex; | 262 | struct mutex srv_mutex; |
260 | struct task_struct *tsk; | 263 | struct task_struct *tsk; |
261 | char server_GUID[16]; | 264 | char server_GUID[16]; |
@@ -263,6 +266,7 @@ struct TCP_Server_Info { | |||
263 | bool session_estab; /* mark when very first sess is established */ | 266 | bool session_estab; /* mark when very first sess is established */ |
264 | u16 dialect; /* dialect index that server chose */ | 267 | u16 dialect; /* dialect index that server chose */ |
265 | enum securityEnum secType; | 268 | enum securityEnum secType; |
269 | bool oplocks:1; /* enable oplocks */ | ||
266 | unsigned int maxReq; /* Clients should submit no more */ | 270 | unsigned int maxReq; /* Clients should submit no more */ |
267 | /* than maxReq distinct unanswered SMBs to the server when using */ | 271 | /* than maxReq distinct unanswered SMBs to the server when using */ |
268 | /* multiplexed reads or writes */ | 272 | /* multiplexed reads or writes */ |
@@ -278,7 +282,7 @@ struct TCP_Server_Info { | |||
278 | vcnumbers */ | 282 | vcnumbers */ |
279 | int capabilities; /* allow selective disabling of caps by smb sess */ | 283 | int capabilities; /* allow selective disabling of caps by smb sess */ |
280 | int timeAdj; /* Adjust for difference in server time zone in sec */ | 284 | int timeAdj; /* Adjust for difference in server time zone in sec */ |
281 | __u16 CurrentMid; /* multiplex id - rotating counter */ | 285 | __u64 CurrentMid; /* multiplex id - rotating counter */ |
282 | char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ | 286 | char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ |
283 | /* 16th byte of RFC1001 workstation name is always null */ | 287 | /* 16th byte of RFC1001 workstation name is always null */ |
284 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; | 288 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; |
@@ -307,6 +311,48 @@ struct TCP_Server_Info { | |||
307 | #endif | 311 | #endif |
308 | }; | 312 | }; |
309 | 313 | ||
314 | static inline unsigned int | ||
315 | in_flight(struct TCP_Server_Info *server) | ||
316 | { | ||
317 | unsigned int num; | ||
318 | spin_lock(&server->req_lock); | ||
319 | num = server->in_flight; | ||
320 | spin_unlock(&server->req_lock); | ||
321 | return num; | ||
322 | } | ||
323 | |||
324 | static inline int* | ||
325 | get_credits_field(struct TCP_Server_Info *server) | ||
326 | { | ||
327 | /* | ||
328 | * This will change to switch statement when we reserve slots for echos | ||
329 | * and oplock breaks. | ||
330 | */ | ||
331 | return &server->credits; | ||
332 | } | ||
333 | |||
334 | static inline bool | ||
335 | has_credits(struct TCP_Server_Info *server, int *credits) | ||
336 | { | ||
337 | int num; | ||
338 | spin_lock(&server->req_lock); | ||
339 | num = *credits; | ||
340 | spin_unlock(&server->req_lock); | ||
341 | return num > 0; | ||
342 | } | ||
343 | |||
344 | static inline size_t | ||
345 | header_size(void) | ||
346 | { | ||
347 | return sizeof(struct smb_hdr); | ||
348 | } | ||
349 | |||
350 | static inline size_t | ||
351 | max_header_size(void) | ||
352 | { | ||
353 | return MAX_CIFS_HDR_SIZE; | ||
354 | } | ||
355 | |||
310 | /* | 356 | /* |
311 | * Macros to allow the TCP_Server_Info->net field and related code to drop out | 357 | * Macros to allow the TCP_Server_Info->net field and related code to drop out |
312 | * when CONFIG_NET_NS isn't set. | 358 | * when CONFIG_NET_NS isn't set. |
@@ -555,9 +601,11 @@ struct cifs_io_parms { | |||
555 | * Take a reference on the file private data. Must be called with | 601 | * Take a reference on the file private data. Must be called with |
556 | * cifs_file_list_lock held. | 602 | * cifs_file_list_lock held. |
557 | */ | 603 | */ |
558 | static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file) | 604 | static inline |
605 | struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file) | ||
559 | { | 606 | { |
560 | ++cifs_file->count; | 607 | ++cifs_file->count; |
608 | return cifs_file; | ||
561 | } | 609 | } |
562 | 610 | ||
563 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file); | 611 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file); |
@@ -578,7 +626,7 @@ struct cifsInodeInfo { | |||
578 | bool delete_pending; /* DELETE_ON_CLOSE is set */ | 626 | bool delete_pending; /* DELETE_ON_CLOSE is set */ |
579 | bool invalid_mapping; /* pagecache is invalid */ | 627 | bool invalid_mapping; /* pagecache is invalid */ |
580 | unsigned long time; /* jiffies of last update of inode */ | 628 | unsigned long time; /* jiffies of last update of inode */ |
581 | u64 server_eof; /* current file size on server */ | 629 | u64 server_eof; /* current file size on server -- protected by i_lock */ |
582 | u64 uniqueid; /* server inode number */ | 630 | u64 uniqueid; /* server inode number */ |
583 | u64 createtime; /* creation time on server */ | 631 | u64 createtime; /* creation time on server */ |
584 | #ifdef CONFIG_CIFS_FSCACHE | 632 | #ifdef CONFIG_CIFS_FSCACHE |
@@ -685,8 +733,8 @@ typedef void (mid_callback_t)(struct mid_q_entry *mid); | |||
685 | /* one of these for every pending CIFS request to the server */ | 733 | /* one of these for every pending CIFS request to the server */ |
686 | struct mid_q_entry { | 734 | struct mid_q_entry { |
687 | struct list_head qhead; /* mids waiting on reply from this server */ | 735 | struct list_head qhead; /* mids waiting on reply from this server */ |
688 | __u16 mid; /* multiplex id */ | 736 | __u64 mid; /* multiplex id */ |
689 | __u16 pid; /* process id */ | 737 | __u32 pid; /* process id */ |
690 | __u32 sequence_number; /* for CIFS signing */ | 738 | __u32 sequence_number; /* for CIFS signing */ |
691 | unsigned long when_alloc; /* when mid was created */ | 739 | unsigned long when_alloc; /* when mid was created */ |
692 | #ifdef CONFIG_CIFS_STATS2 | 740 | #ifdef CONFIG_CIFS_STATS2 |
@@ -696,10 +744,10 @@ struct mid_q_entry { | |||
696 | mid_receive_t *receive; /* call receive callback */ | 744 | mid_receive_t *receive; /* call receive callback */ |
697 | mid_callback_t *callback; /* call completion callback */ | 745 | mid_callback_t *callback; /* call completion callback */ |
698 | void *callback_data; /* general purpose pointer for callback */ | 746 | void *callback_data; /* general purpose pointer for callback */ |
699 | struct smb_hdr *resp_buf; /* pointer to received SMB header */ | 747 | void *resp_buf; /* pointer to received SMB header */ |
700 | int midState; /* wish this were enum but can not pass to wait_event */ | 748 | int mid_state; /* wish this were enum but can not pass to wait_event */ |
701 | __u8 command; /* smb command code */ | 749 | __le16 command; /* smb command code */ |
702 | bool largeBuf:1; /* if valid response, is pointer to large buf */ | 750 | bool large_buf:1; /* if valid response, is pointer to large buf */ |
703 | bool multiRsp:1; /* multiple trans2 responses for one request */ | 751 | bool multiRsp:1; /* multiple trans2 responses for one request */ |
704 | bool multiEnd:1; /* both received */ | 752 | bool multiEnd:1; /* both received */ |
705 | }; | 753 | }; |
@@ -1010,9 +1058,6 @@ GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */ | |||
1010 | GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */ | 1058 | GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */ |
1011 | GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/ | 1059 | GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/ |
1012 | 1060 | ||
1013 | /* reconnect after this many failed echo attempts */ | ||
1014 | GLOBAL_EXTERN unsigned short echo_retries; | ||
1015 | |||
1016 | #ifdef CONFIG_CIFS_ACL | 1061 | #ifdef CONFIG_CIFS_ACL |
1017 | GLOBAL_EXTERN struct rb_root uidtree; | 1062 | GLOBAL_EXTERN struct rb_root uidtree; |
1018 | GLOBAL_EXTERN struct rb_root gidtree; | 1063 | GLOBAL_EXTERN struct rb_root gidtree; |
@@ -1027,5 +1072,6 @@ GLOBAL_EXTERN spinlock_t gidsidlock; | |||
1027 | void cifs_oplock_break(struct work_struct *work); | 1072 | void cifs_oplock_break(struct work_struct *work); |
1028 | 1073 | ||
1029 | extern const struct slow_work_ops cifs_oplock_break_ops; | 1074 | extern const struct slow_work_ops cifs_oplock_break_ops; |
1075 | extern struct workqueue_struct *cifsiod_wq; | ||
1030 | 1076 | ||
1031 | #endif /* _CIFS_GLOB_H */ | 1077 | #endif /* _CIFS_GLOB_H */ |