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

smbd: Use asys_results

When multiple aio requests finish simultaneously, this saves a few syscalls

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 27 08:05:46 CET 2014 on sn-devel-104
This commit is contained in:
Volker Lendecke 2014-03-24 14:53:36 +00:00 committed by Jeremy Allison
parent c35fec883c
commit 2e2137f56d

View File

@ -793,39 +793,36 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
uint16_t flags, void *p) uint16_t flags, void *p)
{ {
struct asys_context *asys_ctx = (struct asys_context *)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) { if ((flags & TEVENT_FD_READ) == 0) {
return; 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; i<ret; i++) {
struct asys_result *result = &results[i];
struct tevent_req *req; struct tevent_req *req;
struct vfswrap_asys_state *state; struct vfswrap_asys_state *state;
struct asys_result result;
int res;
res = asys_results(asys_ctx, &result, 1); if ((result->ret == -1) && (result->err == ECANCELED)) {
if (res < 0) { continue;
DEBUG(1, ("asys_result returned %s\n",
strerror(-res)));
return;
}
if (res == 0) {
return;
} }
if ((result.ret == -1) && (result.err == ECANCELED)) { req = talloc_get_type_abort(result->private_data,
return;
}
req = talloc_get_type_abort(result.private_data,
struct tevent_req); struct tevent_req);
state = tevent_req_data(req, struct vfswrap_asys_state); state = tevent_req_data(req, struct vfswrap_asys_state);
talloc_set_destructor(state, NULL); talloc_set_destructor(state, NULL);
state->ret = result.ret; state->ret = result->ret;
state->err = result.err; state->err = result->err;
tevent_req_defer_callback(req, ev); tevent_req_defer_callback(req, ev);
tevent_req_done(req); tevent_req_done(req);
} }