diff mbox

[CIFS] set copy chunk defaults

Message ID CAH2r5ms-1ZZxKqCDr+0xOxmDcjNPtmv=v+-Q1FkQ4EnJb=DSOg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve French Nov. 15, 2013, 5:34 p.m. UTC
From e53cf824641ad237e1b7ceb09aefbfbfb1787f47 Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
Date: Fri, 15 Nov 2013 11:26:24 -0600
Subject: [PATCH] [CIFS] Set copychunk defaults

Patch 2 of the copy chunk series (the final patch will
use these to handle copies of files larger than the chunk size.

We set the same defaults that Windows and Samba expect for
CopyChunk.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/cifsglob.h |  3 +++
 fs/cifs/smb2pdu.c  | 10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

   struct cifs_tcon *tcon, const struct nls_table *cp)
@@ -818,7 +826,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses
*ses, const char *tree,
  if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) &&
     ((tcon->share_flags & SHI1005_FLAGS_DFS) == 0))
  cifs_dbg(VFS, "DFS capability contradicts DFS flag\n");
-
+ init_copy_chunk_defaults(tcon);
 tcon_exit:
  free_rsp_buf(resp_buftype, rsp);
  kfree(unc_path);

Comments

David Disseldorp Nov. 15, 2013, 6:14 p.m. UTC | #1
On Fri, 15 Nov 2013 11:34:18 -0600
Steve French <smfrench@gmail.com> wrote:

> From e53cf824641ad237e1b7ceb09aefbfbfb1787f47 Mon Sep 17 00:00:00 2001
> From: Steve French <smfrench@gmail.com>
> Date: Fri, 15 Nov 2013 11:26:24 -0600
> Subject: [PATCH] [CIFS] Set copychunk defaults
> 
> Patch 2 of the copy chunk series (the final patch will
> use these to handle copies of files larger than the chunk size.
> 
> We set the same defaults that Windows and Samba expect for
> CopyChunk.
> 
> Signed-off-by: Steve French <smfrench@gmail.com>
> ---
>  fs/cifs/cifsglob.h |  3 +++
>  fs/cifs/smb2pdu.c  | 10 +++++++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 50a6ca1..d9ea7ad 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -858,6 +858,9 @@ struct cifs_tcon {
>   __le64 vol_create_time;
>   __u32 ss_flags; /* sector size flags */
>   __u32 perf_sector_size; /* best sector size for perf */
> + __u32 max_chunks;
> + __u32 max_bytes_chunk;
> + __u32 max_bytes_copy;

Might be worth prefixing or nesting these to make it clear that they're
copy-chunk specific. Anyhow, looks good as is.

Reviewed-by: David Disseldorp <ddiss@samba.org>

Cheers, David
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From e53cf824641ad237e1b7ceb09aefbfbfb1787f47 Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
Date: Fri, 15 Nov 2013 11:26:24 -0600
Subject: [PATCH] [CIFS] Set copychunk defaults

Patch 2 of the copy chunk series (the final patch will
use these to handle copies of files larger than the chunk size.

We set the same defaults that Windows and Samba expect for
CopyChunk.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/cifsglob.h |  3 +++
 fs/cifs/smb2pdu.c  | 10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 50a6ca1..d9ea7ad 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -858,6 +858,9 @@  struct cifs_tcon {
 	__le64 vol_create_time;
 	__u32 ss_flags;		/* sector size flags */
 	__u32 perf_sector_size; /* best sector size for perf */
+	__u32 max_chunks;
+	__u32 max_bytes_chunk;
+	__u32 max_bytes_copy;
 #endif /* CONFIG_CIFS_SMB2 */
 #ifdef CONFIG_CIFS_FSCACHE
 	u64 resource_id;		/* server resource id */
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8ab05b0..ca7f307 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -717,6 +717,14 @@  static inline void cifs_stats_fail_inc(struct cifs_tcon *tcon, uint16_t code)
 
 #define MAX_SHARENAME_LENGTH (255 /* server */ + 80 /* share */ + 1 /* NULL */)
 
+/* These are similar values to what Windows uses */
+static inline void init_copy_chunk_defaults(struct cifs_tcon *tcon)
+{
+	tcon->max_chunks = 256;
+	tcon->max_bytes_chunk = 1048576;
+	tcon->max_bytes_copy = 16777216;
+}
+
 int
 SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	  struct cifs_tcon *tcon, const struct nls_table *cp)
@@ -818,7 +826,7 @@  SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) &&
 	    ((tcon->share_flags & SHI1005_FLAGS_DFS) == 0))
 		cifs_dbg(VFS, "DFS capability contradicts DFS flag\n");
-
+	init_copy_chunk_defaults(tcon);
 tcon_exit:
 	free_rsp_buf(resp_buftype, rsp);
 	kfree(unc_path);
-- 
1.8.3.1