mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
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>
This commit is contained in:
parent
4e28dd16c5
commit
20075e6b30
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user