diff options
author | Pavel Shilovsky <pshilov@microsoft.com> | 2019-01-23 18:15:52 -0800 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-03-05 18:10:01 -0600 |
commit | 9a1c67e8d5dad143d5166dac1ee6776f433dac00 (patch) | |
tree | 3af988a600e442519eb6cee59b8dec7499b1c3e5 /fs/cifs/cifsglob.h | |
parent | 97ea499883cc0566b1fafdc12ca49d0926aab332 (diff) | |
download | lwn-9a1c67e8d5dad143d5166dac1ee6776f433dac00.tar.gz lwn-9a1c67e8d5dad143d5166dac1ee6776f433dac00.zip |
CIFS: Adjust MTU credits before reopening a file
Currently we adjust MTU credits before sending an IO request
and after reopening a file. This approach doesn't allow the
reopen routine to use existing credits that are not needed
for IO. Reorder credit adjustment and reopening a file to
use credits available to the client more efficiently. Also
unwrap complex if statement into few pieces to improve
readability.
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r-- | fs/cifs/cifsglob.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 84ce388de89d..f293e052e351 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -457,6 +457,10 @@ struct smb_version_operations { /* get mtu credits */ int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, unsigned int *, struct cifs_credits *); + /* adjust previously taken mtu credits to request size */ + int (*adjust_credits)(struct TCP_Server_Info *server, + struct cifs_credits *credits, + const unsigned int payload_size); /* check if we need to issue closedir */ bool (*dir_needs_close)(struct cifsFileInfo *); long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, @@ -763,6 +767,14 @@ set_credits(struct TCP_Server_Info *server, const int val) server->ops->set_credits(server, val); } +static inline int +adjust_credits(struct TCP_Server_Info *server, struct cifs_credits *credits, + const unsigned int payload_size) +{ + return server->ops->adjust_credits ? + server->ops->adjust_credits(server, credits, payload_size) : 0; +} + static inline __le64 get_next_mid64(struct TCP_Server_Info *server) { |