[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Mar 2 03:35:04 UTC 2016


The branch, master has been updated
       via  ae2083e vfs:glusterfs: fix build after opendir signature change
       via  5540587 vfs:ceph: fix build after opendir signature change.
       via  7054217 vfs/time_audit: use duration we get from the async backend
       via  d8f71a4 vfs/glusterfs: measure libglusterfs aio function call duration
       via  1e2d8d2 vfs/aio_linux: measure libaio aio function call duration
       via  c3892aa vfs/aio_fork: measure async request syscall duration
       via  fd85ee4 vfs/default: store async VFS op duration we got from libasys
       via  0ea6a07 s3:lib/asys: measure async request syscall duration
       via  9892809 s3/vfs: add duration to vfs_aio_state
       via  3884a66 s3/vfs: wrap async io function args inside struct vfs_aio_state
      from  6af7ebf passdb: Avoid a "ret == true"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ae2083e1cc0961313a9a9ef9dc1e2af271d2e5b1
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 2 00:18:32 2016 +0100

    vfs:glusterfs: fix build after opendir signature change
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Mar  2 04:34:15 CET 2016 on sn-devel-144

commit 55405871b9c22849ac9242fe7d2333682f96fbfe
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 2 00:15:50 2016 +0100

    vfs:ceph: fix build after opendir signature change.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7054217a790c8d051d78aa7ee6b0144b3f1f55a0
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 26 12:54:23 2016 +0100

    vfs/time_audit: use duration we get from the async backend
    
    Finally! The previous commits changed the VFS and the async backend to
    pass the duration of an aync operation up the stack.
    
    We now can use this value instead of doing our own sampling which avoids
    the following problem:
    
    1. SMB2 read request received, added to the async queue
    
    2. SMB2 create_file request comes in, is processed and blocks for N
       seconds in open()
    
    3. async read completes in the dispatcher thread, completion callback
       will be called when we enter the main tevent loop
    
    4. open() completes after N seconds
    
    5. main tevent event loop is entered, async results are processed
    
    6. async read result is processed, time sampling will include the N
       seconds blocked in open()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d8f71a43c37b1c59bb79b5afe6c9daefada95503
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 26 11:14:36 2016 +0100

    vfs/glusterfs: measure libglusterfs aio function call duration
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1e2d8d2c37f03208a12c6a868ef0e03d51191887
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 26 10:52:39 2016 +0100

    vfs/aio_linux: measure libaio aio function call duration
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3892aa705cea3de0e0fd03de0c0a2f8a8fad669
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 26 09:59:23 2016 +0100

    vfs/aio_fork: measure async request syscall duration
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fd85ee43e7234aa41f89b50adb1c108dd2066419
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 26 12:29:02 2016 +0100

    vfs/default: store async VFS op duration we got from libasys
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0ea6a070c4aa90e2622b2d245a87821c50f2f0b0
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Feb 25 08:06:00 2016 +0100

    s3:lib/asys: measure async request syscall duration
    
    This uses time functions from lib/util/ which requires pulling in
    samba-util. This sucks, but there's just no way of rewrapping a minimal
    time utility library without modifying the public samba-util.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9892809233f50028f6d4d9698861074c00e6fe8f
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Feb 29 12:17:18 2016 +0100

    s3/vfs: add duration to vfs_aio_state
    
    This will be used in the aio backends to pass the competion time of the
    async request in the backend.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3884a66e174020b009ee8302d21b18d2bceb99c9
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 26 10:54:01 2016 +0100

    s3/vfs: wrap async io function args inside struct vfs_aio_state
    
    Subsequent commits that are going to track aio request duration in the
    aio backends will use this.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 examples/VFS/skel_opaque.c       | 15 ++++++-----
 examples/VFS/skel_transparent.c  | 33 ++++++++++++-----------
 source3/include/vfs.h            | 18 ++++++++-----
 source3/lib/asys/asys.c          | 13 +++++++++
 source3/lib/asys/asys.h          |  1 +
 source3/lib/asys/wscript_build   |  2 +-
 source3/modules/vfs_aio_fork.c   | 48 ++++++++++++++++++---------------
 source3/modules/vfs_aio_linux.c  | 27 ++++++++++++-------
 source3/modules/vfs_ceph.c       |  8 +++---
 source3/modules/vfs_commit.c     | 11 ++++----
 source3/modules/vfs_default.c    | 19 ++++++++------
 source3/modules/vfs_full_audit.c | 33 ++++++++++++-----------
 source3/modules/vfs_glusterfs.c  | 39 ++++++++++++++++-----------
 source3/modules/vfs_gpfs.c       | 22 +++++++++-------
 source3/modules/vfs_time_audit.c | 57 +++++++++++++++++-----------------------
 source3/modules/vfs_tsmsm.c      | 22 +++++++++-------
 source3/smbd/aio.c               | 33 ++++++++++++-----------
 source3/smbd/smb2_flush.c        |  7 ++---
 source3/smbd/vfs.c               | 47 ++++++++++++++++-----------------
 19 files changed, 253 insertions(+), 202 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index ae165a6..4ffdacc 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -243,9 +243,10 @@ static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
 	return NULL;
 }
 
-static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
+static ssize_t skel_pread_recv(struct tevent_req *req,
+			       struct vfs_aio_state *vfs_aio_state)
 {
-	*err = ENOSYS;
+	vfs_aio_state->error = ENOSYS;
 	return -1;
 }
 
@@ -273,9 +274,10 @@ static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
 	return NULL;
 }
 
-static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
+static ssize_t skel_pwrite_recv(struct tevent_req *req,
+				struct vfs_aio_state *vfs_aio_state)
 {
-	*err = ENOSYS;
+	vfs_aio_state->error = ENOSYS;
 	return -1;
 }
 
@@ -323,9 +325,10 @@ static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
 	return NULL;
 }
 
-static int skel_fsync_recv(struct tevent_req *req, int *err)
+static int skel_fsync_recv(struct tevent_req *req,
+			   struct vfs_aio_state *vfs_aio_state)
 {
-	*err = ENOSYS;
+	vfs_aio_state->error = ENOSYS;
 	return -1;
 }
 
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 549d7d8..5d3ffb7 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -243,7 +243,7 @@ static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
 
 struct skel_pread_state {
 	ssize_t ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
 };
 
 static void skel_pread_done(struct tevent_req *subreq);
@@ -277,20 +277,21 @@ static void skel_pread_done(struct tevent_req *subreq)
 	struct skel_pread_state *state =
 	    tevent_req_data(req, struct skel_pread_state);
 
-	state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
+	state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
 	TALLOC_FREE(subreq);
 	tevent_req_done(req);
 }
 
-static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
+static ssize_t skel_pread_recv(struct tevent_req *req,
+			       struct vfs_aio_state *vfs_aio_state)
 {
 	struct skel_pread_state *state =
 	    tevent_req_data(req, struct skel_pread_state);
 
-	if (tevent_req_is_unix_error(req, err)) {
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
 		return -1;
 	}
-	*err = state->err;
+	*vfs_aio_state = state->vfs_aio_state;
 	return state->ret;
 }
 
@@ -308,7 +309,7 @@ static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
 
 struct skel_pwrite_state {
 	ssize_t ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
 };
 
 static void skel_pwrite_done(struct tevent_req *subreq);
@@ -343,20 +344,21 @@ static void skel_pwrite_done(struct tevent_req *subreq)
 	struct skel_pwrite_state *state =
 	    tevent_req_data(req, struct skel_pwrite_state);
 
-	state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
+	state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
 	TALLOC_FREE(subreq);
 	tevent_req_done(req);
 }
 
-static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
+static ssize_t skel_pwrite_recv(struct tevent_req *req,
+				struct vfs_aio_state *vfs_aio_state)
 {
 	struct skel_pwrite_state *state =
 	    tevent_req_data(req, struct skel_pwrite_state);
 
-	if (tevent_req_is_unix_error(req, err)) {
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
 		return -1;
 	}
-	*err = state->err;
+	*vfs_aio_state = state->vfs_aio_state;
 	return state->ret;
 }
 
@@ -393,7 +395,7 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 
 struct skel_fsync_state {
 	int ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
 };
 
 static void skel_fsync_done(struct tevent_req *subreq);
@@ -425,20 +427,21 @@ static void skel_fsync_done(struct tevent_req *subreq)
 	struct skel_fsync_state *state =
 	    tevent_req_data(req, struct skel_fsync_state);
 
-	state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
+	state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
 	TALLOC_FREE(subreq);
 	tevent_req_done(req);
 }
 
-static int skel_fsync_recv(struct tevent_req *req, int *err)
+static int skel_fsync_recv(struct tevent_req *req,
+			   struct vfs_aio_state *vfs_aio_state)
 {
 	struct skel_fsync_state *state =
 	    tevent_req_data(req, struct skel_fsync_state);
 
-	if (tevent_req_is_unix_error(req, err)) {
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
 		return -1;
 	}
-	*err = state->err;
+	*vfs_aio_state = state->vfs_aio_state;
 	return state->ret;
 }
 
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 2f34c22..9ea4e75 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -179,6 +179,7 @@
 		const struct smb_filename * */
 /* Version 35 - Change opendir from const char *, to
 		const struct smb_filename * */
+/* Version 35 - Wrap aio async funtions args in a struct vfs_aio_state */
 
 #define SMB_VFS_INTERFACE_VERSION 35
 
@@ -520,6 +521,11 @@ enum vfs_fallocate_flags {
 	VFS_FALLOCATE_FL_PUNCH_HOLE		= 0x0002,
 };
 
+struct vfs_aio_state {
+	int error;
+	uint64_t duration;
+};
+
 /*
     Available VFS operations. These values must be in sync with vfs_ops struct
     (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops).
@@ -604,7 +610,7 @@ struct vfs_fn_pointers {
 					    struct files_struct *fsp,
 					    void *data,
 					    size_t n, off_t offset);
-	ssize_t (*pread_recv_fn)(struct tevent_req *req, int *err);
+	ssize_t (*pread_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
 	ssize_t (*write_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
 	ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, off_t offset);
 	struct tevent_req *(*pwrite_send_fn)(struct vfs_handle_struct *handle,
@@ -613,7 +619,7 @@ struct vfs_fn_pointers {
 					     struct files_struct *fsp,
 					     const void *data,
 					     size_t n, off_t offset);
-	ssize_t (*pwrite_recv_fn)(struct tevent_req *req, int *err);
+	ssize_t (*pwrite_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
 	off_t (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset, int whence);
 	ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, off_t offset, size_t count);
 	ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t count);
@@ -625,7 +631,7 @@ struct vfs_fn_pointers {
 					    TALLOC_CTX *mem_ctx,
 					    struct tevent_context *ev,
 					    struct files_struct *fsp);
-	int (*fsync_recv_fn)(struct tevent_req *req, int *err);
+	int (*fsync_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
 	int (*stat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
 	int (*fstat_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
 	int (*lstat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
@@ -1028,7 +1034,7 @@ struct tevent_req *smb_vfs_call_pread_send(struct vfs_handle_struct *handle,
 					   struct files_struct *fsp,
 					   void *data,
 					   size_t n, off_t offset);
-ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, int *perrno);
+ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, struct vfs_aio_state *state);
 
 ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
 			   struct files_struct *fsp, const void *data,
@@ -1042,7 +1048,7 @@ struct tevent_req *smb_vfs_call_pwrite_send(struct vfs_handle_struct *handle,
 					    struct files_struct *fsp,
 					    const void *data,
 					    size_t n, off_t offset);
-ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, int *perrno);
+ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, struct vfs_aio_state *state);
 
 off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle,
 			     struct files_struct *fsp, off_t offset,
@@ -1063,7 +1069,7 @@ struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
 					   TALLOC_CTX *mem_ctx,
 					   struct tevent_context *ev,
 					   struct files_struct *fsp);
-int SMB_VFS_FSYNC_RECV(struct tevent_req *req, int *perrno);
+int SMB_VFS_FSYNC_RECV(struct tevent_req *req, struct vfs_aio_state *state);
 
 int smb_vfs_call_stat(struct vfs_handle_struct *handle,
 		      struct smb_filename *smb_fname);
diff --git a/source3/lib/asys/asys.c b/source3/lib/asys/asys.c
index 906d8cf..068b460 100644
--- a/source3/lib/asys/asys.c
+++ b/source3/lib/asys/asys.c
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include "../pthreadpool/pthreadpool.h"
+#include "lib/util/time.h"
 
 struct asys_pwrite_args {
 	int fildes;
@@ -52,6 +53,8 @@ struct asys_job {
 	int err;
 	char busy;
 	char canceled;
+	struct timespec start_time;
+	struct timespec end_time;
 };
 
 struct asys_context {
@@ -189,7 +192,10 @@ static void asys_pwrite_do(void *private_data)
 	struct asys_job *job = (struct asys_job *)private_data;
 	struct asys_pwrite_args *args = &job->args.pwrite_args;
 
+	clock_gettime_mono(&job->start_time);
 	job->ret = pwrite(args->fildes, args->buf, args->nbyte, args->offset);
+	clock_gettime_mono(&job->end_time);
+
 	if (job->ret == -1) {
 		job->err = errno;
 	}
@@ -231,7 +237,10 @@ static void asys_pread_do(void *private_data)
 	struct asys_job *job = (struct asys_job *)private_data;
 	struct asys_pread_args *args = &job->args.pread_args;
 
+	clock_gettime_mono(&job->start_time);
 	job->ret = pread(args->fildes, args->buf, args->nbyte, args->offset);
+	clock_gettime_mono(&job->end_time);
+
 	if (job->ret == -1) {
 		job->err = errno;
 	}
@@ -269,7 +278,10 @@ static void asys_fsync_do(void *private_data)
 	struct asys_job *job = (struct asys_job *)private_data;
 	struct asys_fsync_args *args = &job->args.fsync_args;
 
+	clock_gettime_mono(&job->start_time);
 	job->ret = fsync(args->fildes);
+	clock_gettime_mono(&job->end_time);
+
 	if (job->ret == -1) {
 		job->err = errno;
 	}
@@ -320,6 +332,7 @@ int asys_results(struct asys_context *ctx, struct asys_result *results,
 			result->err = job->err;
 		}
 		result->private_data = job->private_data;
+		result->duration = nsec_time_diff(&job->end_time, &job->start_time);
 
 		job->busy = 0;
 	}
diff --git a/source3/lib/asys/asys.h b/source3/lib/asys/asys.h
index 7c3dfdf..f576bd3 100644
--- a/source3/lib/asys/asys.h
+++ b/source3/lib/asys/asys.h
@@ -108,6 +108,7 @@ struct asys_result {
 	ssize_t ret;
 	int err;
 	void *private_data;
+	uint64_t duration;	/* nanoseconds */
 };
 
 /**
diff --git a/source3/lib/asys/wscript_build b/source3/lib/asys/wscript_build
index 15de977..520994f 100644
--- a/source3/lib/asys/wscript_build
+++ b/source3/lib/asys/wscript_build
@@ -2,7 +2,7 @@
 
 bld.SAMBA3_SUBSYSTEM('LIBASYS',
 		     source='asys.c',
-		     deps='PTHREADPOOL')
+		     deps='PTHREADPOOL samba-util')
 
 bld.SAMBA3_BINARY('asystest',
 		  source='tests.c',
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 472ef0c..a722102 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -128,6 +128,7 @@ struct rw_cmd {
 struct rw_ret {
 	ssize_t size;
 	int ret_errno;
+	uint64_t duration;
 };
 
 struct aio_child_list;
@@ -310,6 +311,7 @@ static void aio_child_loop(int sockfd, struct mmap_area *map)
 		ssize_t ret;
 		struct rw_cmd cmd_struct;
 		struct rw_ret ret_struct;
+		struct timespec start, end;
 
 		ret = read_fd(sockfd, &cmd_struct, sizeof(cmd_struct), &fd);
 		if (ret != sizeof(cmd_struct)) {
@@ -341,6 +343,8 @@ static void aio_child_loop(int sockfd, struct mmap_area *map)
 
 		ZERO_STRUCT(ret_struct);
 
+		clock_gettime_mono(&start);
+
 		switch (cmd_struct.cmd) {
 		case READ_CMD:
 			ret_struct.size = sys_pread(
@@ -366,6 +370,8 @@ static void aio_child_loop(int sockfd, struct mmap_area *map)
 			errno = EINVAL;
 		}
 
+		clock_gettime_mono(&end);
+		ret_struct.duration = nsec_time_diff(&end, &start);
 		DEBUG(10, ("aio_child_loop: syscall returned %d\n",
 			   (int)ret_struct.size));
 
@@ -534,7 +540,7 @@ static int get_idle_child(struct vfs_handle_struct *handle,
 struct aio_fork_pread_state {
 	struct aio_child *child;
 	ssize_t ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
 };
 
 static void aio_fork_pread_done(struct tevent_req *subreq);
@@ -632,28 +638,28 @@ static void aio_fork_pread_done(struct tevent_req *subreq)
 
 	retbuf = (struct rw_ret *)buf;
 	state->ret = retbuf->size;
-	state->err = retbuf->ret_errno;
+	state->vfs_aio_state.error = retbuf->ret_errno;
+	state->vfs_aio_state.duration = retbuf->duration;
 	tevent_req_done(req);
 }
 
-static ssize_t aio_fork_pread_recv(struct tevent_req *req, int *err)
+static ssize_t aio_fork_pread_recv(struct tevent_req *req,
+				   struct vfs_aio_state *vfs_aio_state)
 {
 	struct aio_fork_pread_state *state = tevent_req_data(
 		req, struct aio_fork_pread_state);
 
-	if (tevent_req_is_unix_error(req, err)) {
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
 		return -1;
 	}
-	if (state->ret == -1) {
-		*err = state->err;
-	}
+	*vfs_aio_state = state->vfs_aio_state;
 	return state->ret;
 }
 
 struct aio_fork_pwrite_state {
 	struct aio_child *child;
 	ssize_t ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
 };
 
 static void aio_fork_pwrite_done(struct tevent_req *subreq);
@@ -748,28 +754,28 @@ static void aio_fork_pwrite_done(struct tevent_req *subreq)
 
 	retbuf = (struct rw_ret *)buf;
 	state->ret = retbuf->size;
-	state->err = retbuf->ret_errno;
+	state->vfs_aio_state.error = retbuf->ret_errno;
+	state->vfs_aio_state.duration = retbuf->duration;
 	tevent_req_done(req);
 }
 
-static ssize_t aio_fork_pwrite_recv(struct tevent_req *req, int *err)
+static ssize_t aio_fork_pwrite_recv(struct tevent_req *req,
+				    struct vfs_aio_state *vfs_aio_state)
 {
 	struct aio_fork_pwrite_state *state = tevent_req_data(
 		req, struct aio_fork_pwrite_state);
 
-	if (tevent_req_is_unix_error(req, err)) {
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
 		return -1;
 	}
-	if (state->ret == -1) {
-		*err = state->err;
-	}
+	*vfs_aio_state = state->vfs_aio_state;
 	return state->ret;
 }
 
 struct aio_fork_fsync_state {
 	struct aio_child *child;
 	ssize_t ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
 };
 
 static void aio_fork_fsync_done(struct tevent_req *subreq);
@@ -856,21 +862,21 @@ static void aio_fork_fsync_done(struct tevent_req *subreq)
 
 	retbuf = (struct rw_ret *)buf;
 	state->ret = retbuf->size;
-	state->err = retbuf->ret_errno;
+	state->vfs_aio_state.error = retbuf->ret_errno;
+	state->vfs_aio_state.duration = retbuf->duration;
 	tevent_req_done(req);
 }
 
-static int aio_fork_fsync_recv(struct tevent_req *req, int *err)
+static int aio_fork_fsync_recv(struct tevent_req *req,
+			       struct vfs_aio_state *vfs_aio_state)
 {
 	struct aio_fork_fsync_state *state = tevent_req_data(
 		req, struct aio_fork_fsync_state);
 
-	if (tevent_req_is_unix_error(req, err)) {
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
 		return -1;
 	}
-	if (state->ret == -1) {
-		*err = state->err;
-	}
+	*vfs_aio_state = state->vfs_aio_state;
 	return state->ret;
 }
 
diff --git a/source3/modules/vfs_aio_linux.c b/source3/modules/vfs_aio_linux.c
index 4f6230a..caa3149 100644
--- a/source3/modules/vfs_aio_linux.c
+++ b/source3/modules/vfs_aio_linux.c
@@ -139,7 +139,8 @@ static bool init_aio_linux(struct vfs_handle_struct *handle)
 struct aio_linux_state {
 	struct iocb event_iocb;
 	ssize_t ret;
-	int err;
+	struct vfs_aio_state vfs_aio_state;
+	struct timespec start;
 };
 
 static struct tevent_req *aio_linux_pread_send(
@@ -167,6 +168,7 @@ static struct tevent_req *aio_linux_pread_send(
 
 	piocb = &state->event_iocb;
 
+	clock_gettime_mono(&state->start);
 	ret = io_submit(io_ctx, 1, &piocb);
 	if (ret < 0) {
 		tevent_req_error(req, -ret);
@@ -203,6 +205,7 @@ static struct tevent_req *aio_linux_pwrite_send(
 
 	piocb = &state->event_iocb;
 
+	clock_gettime_mono(&state->start);
 	ret = io_submit(io_ctx, 1, &piocb);
 	if (ret < 0) {
 		tevent_req_error(req, -ret);
@@ -237,6 +240,7 @@ static struct tevent_req *aio_linux_fsync_send(
 
 	piocb = &state->event_iocb;
 
+	clock_gettime_mono(&state->start);
 	ret = io_submit(io_ctx, 1, &piocb);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list