diff options
author | Ralph Boehme <slow@samba.org> | 2015-07-01 17:57:36 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-07-01 23:05:55 +0200 |
commit | 20075e6b3082939fbd5d7ca4f327d29d62c33c87 (patch) | |
tree | b2dde1e110523e8b2e9a98691721437f15efbcd9 /source3/modules | |
parent | 4e28dd16c528e3bf3cfa0a4ecfdee9188f02ec49 (diff) | |
download | samba-20075e6b3082939fbd5d7ca4f327d29d62c33c87.tar.gz |
s3:vfs: copy_chunk buffer size
Use a dynamically allocated copy_chunk buffer size with an upper bound
of 8 MB for now.
The previous size of 64 KB has proven to really hurt performance,
especially with "strict locking = yes".
The SMB2 protocol level maximum allowed copy_chunk size is 1 MB, that's
what will be used as buffer size in the typical case.
With the AAPL copyfile extension the requested copy_chunk size is the
size whole file, which would then make use of a larger buffer up to the
limit of 8 MB.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_default.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 9b434a0dfd5..69826348d5c 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1395,7 +1395,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, struct vfs_cc_state { off_t copied; - uint8_t buf[65536]; + uint8_t *buf; }; static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *handle, @@ -1419,6 +1419,12 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *hand return NULL; } + vfs_cc_state->buf = talloc_array(vfs_cc_state, uint8_t, + MIN(num, 8*1024*1024)); + if (tevent_req_nomem(vfs_cc_state->buf, req)) { + return tevent_req_post(req, ev); + } + status = vfs_stat_fsp(src_fsp); if (tevent_req_nterror(req, status)) { return tevent_req_post(req, ev); @@ -1444,7 +1450,7 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *hand struct lock_struct lck; int saved_errno; - off_t this_num = MIN(sizeof(vfs_cc_state->buf), + off_t this_num = MIN(talloc_array_length(vfs_cc_state->buf), num - vfs_cc_state->copied); if (src_fsp->op == NULL) { |