1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:smbprofile: profile async pread/pwrite/fsync syscalls

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Nov 19 23:13:10 CET 2014 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2014-11-15 23:58:15 +01:00 committed by Jeremy Allison
parent 185c6feab7
commit 553b83c4d5
2 changed files with 13 additions and 0 deletions

View File

@ -52,14 +52,17 @@
SMBPROFILE_STATS_BASIC(syscall_close) \
SMBPROFILE_STATS_BYTES(syscall_read) \
SMBPROFILE_STATS_BYTES(syscall_pread) \
SMBPROFILE_STATS_BYTES(syscall_asys_pread) \
SMBPROFILE_STATS_BYTES(syscall_write) \
SMBPROFILE_STATS_BYTES(syscall_pwrite) \
SMBPROFILE_STATS_BYTES(syscall_asys_pwrite) \
SMBPROFILE_STATS_BASIC(syscall_lseek) \
SMBPROFILE_STATS_BYTES(syscall_sendfile) \
SMBPROFILE_STATS_BYTES(syscall_recvfile) \
SMBPROFILE_STATS_BASIC(syscall_rename) \
SMBPROFILE_STATS_BASIC(syscall_rename_at) \
SMBPROFILE_STATS_BASIC(syscall_fsync) \
SMBPROFILE_STATS_BASIC(syscall_asys_fsync) \
SMBPROFILE_STATS_BASIC(syscall_stat) \
SMBPROFILE_STATS_BASIC(syscall_fstat) \
SMBPROFILE_STATS_BASIC(syscall_lstat) \

View File

@ -687,6 +687,8 @@ struct vfswrap_asys_state {
struct tevent_req *req;
ssize_t ret;
int err;
SMBPROFILE_BASIC_ASYNC_STATE(profile_basic);
SMBPROFILE_BYTES_ASYNC_STATE(profile_bytes);
};
static int vfswrap_asys_state_destructor(struct vfswrap_asys_state *s)
@ -717,6 +719,8 @@ static struct tevent_req *vfswrap_pread_send(struct vfs_handle_struct *handle,
state->asys_ctx = handle->conn->sconn->asys_ctx;
state->req = req;
SMBPROFILE_BYTES_ASYNC_START(syscall_asys_pread, profile_p,
state->profile_bytes, n);
ret = asys_pread(state->asys_ctx, fsp->fh->fd, data, n, offset, req);
if (ret != 0) {
tevent_req_error(req, ret);
@ -749,6 +753,8 @@ static struct tevent_req *vfswrap_pwrite_send(struct vfs_handle_struct *handle,
state->asys_ctx = handle->conn->sconn->asys_ctx;
state->req = req;
SMBPROFILE_BYTES_ASYNC_START(syscall_asys_pwrite, profile_p,
state->profile_bytes, n);
ret = asys_pwrite(state->asys_ctx, fsp->fh->fd, data, n, offset, req);
if (ret != 0) {
tevent_req_error(req, ret);
@ -779,6 +785,8 @@ static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
state->asys_ctx = handle->conn->sconn->asys_ctx;
state->req = req;
SMBPROFILE_BASIC_ASYNC_START(syscall_asys_fsync, profile_p,
state->profile_basic);
ret = asys_fsync(state->asys_ctx, fsp->fh->fd, req);
if (ret != 0) {
tevent_req_error(req, ret);
@ -822,6 +830,8 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
talloc_set_destructor(state, NULL);
SMBPROFILE_BASIC_ASYNC_END(state->profile_basic);
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
state->ret = result->ret;
state->err = result->err;
tevent_req_defer_callback(req, ev);