From 2e2137f56de2c763b874562868d9879d2ae24fee Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Mar 2014 14:53:36 +0000 Subject: [PATCH] smbd: Use asys_results When multiple aio requests finish simultaneously, this saves a few syscalls Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Mar 27 08:05:46 CET 2014 on sn-devel-104 --- source3/modules/vfs_default.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 02ab35b1283..673ebfe35bf 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -793,39 +793,36 @@ static void vfswrap_asys_finished(struct tevent_context *ev, uint16_t flags, void *p) { struct asys_context *asys_ctx = (struct asys_context *)p; + struct asys_result results[outstanding_aio_calls]; + int i, ret; if ((flags & TEVENT_FD_READ) == 0) { return; } - while (true) { + ret = asys_results(asys_ctx, results, outstanding_aio_calls); + if (ret < 0) { + DEBUG(1, ("asys_results returned %s\n", strerror(-ret))); + return; + } + + for (i=0; iret == -1) && (result->err == ECANCELED)) { + continue; } - if ((result.ret == -1) && (result.err == ECANCELED)) { - return; - } - - req = talloc_get_type_abort(result.private_data, + req = talloc_get_type_abort(result->private_data, struct tevent_req); state = tevent_req_data(req, struct vfswrap_asys_state); talloc_set_destructor(state, NULL); - state->ret = result.ret; - state->err = result.err; + state->ret = result->ret; + state->err = result->err; tevent_req_defer_callback(req, ev); tevent_req_done(req); }