1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

vfs_default: fix async fsync idle/busy time profiling

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2018-06-20 10:54:04 +02:00 committed by Stefan Metzmacher
parent 580ff20643
commit 27bb2cbc2e
2 changed files with 10 additions and 5 deletions

View File

@ -63,7 +63,7 @@ struct tevent_context;
SMBPROFILE_STATS_BYTES(syscall_recvfile) \
SMBPROFILE_STATS_BASIC(syscall_rename) \
SMBPROFILE_STATS_BASIC(syscall_rename_at) \
SMBPROFILE_STATS_BASIC(syscall_asys_fsync) \
SMBPROFILE_STATS_BYTES(syscall_asys_fsync) \
SMBPROFILE_STATS_BASIC(syscall_stat) \
SMBPROFILE_STATS_BASIC(syscall_fstat) \
SMBPROFILE_STATS_BASIC(syscall_lstat) \

View File

@ -886,7 +886,7 @@ struct vfswrap_fsync_state {
int fd;
struct vfs_aio_state vfs_aio_state;
SMBPROFILE_BASIC_ASYNC_STATE(profile_basic);
SMBPROFILE_BYTES_ASYNC_STATE(profile_bytes);
};
static void vfs_fsync_do(void *private_data);
@ -909,8 +909,9 @@ static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
state->ret = -1;
state->fd = fsp->fh->fd;
SMBPROFILE_BASIC_ASYNC_START(syscall_asys_fsync, profile_p,
state->profile_basic);
SMBPROFILE_BYTES_ASYNC_START(syscall_asys_fsync, profile_p,
state->profile_bytes, 0);
SMBPROFILE_BYTES_ASYNC_SET_IDLE(state->profile_bytes);
subreq = pthreadpool_tevent_job_send(
state, ev, handle->conn->sconn->pool, vfs_fsync_do, state);
@ -931,6 +932,8 @@ static void vfs_fsync_do(void *private_data)
struct timespec start_time;
struct timespec end_time;
SMBPROFILE_BYTES_ASYNC_SET_BUSY(state->profile_bytes);
PROFILE_TIMESTAMP(&start_time);
do {
@ -944,6 +947,8 @@ static void vfs_fsync_do(void *private_data)
PROFILE_TIMESTAMP(&end_time);
state->vfs_aio_state.duration = nsec_time_diff(&end_time, &start_time);
SMBPROFILE_BYTES_ASYNC_SET_IDLE(state->profile_bytes);
}
static int vfs_fsync_state_destructor(struct vfswrap_fsync_state *state)
@ -961,7 +966,7 @@ static void vfs_fsync_done(struct tevent_req *subreq)
ret = pthreadpool_tevent_job_recv(subreq);
TALLOC_FREE(subreq);
SMBPROFILE_BASIC_ASYNC_END(state->profile_basic);
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
talloc_set_destructor(state, NULL);
if (tevent_req_error(req, ret)) {
return;