diff options
author | Volker Lendecke <vl@samba.org> | 2012-07-15 12:08:59 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-07-18 15:52:52 -0700 |
commit | d948b1bfeec02706e8cd08a4f82c0ce54f99491c (patch) | |
tree | 17ee41d2bc8b2042ac0695a842d76bff1b48f0da /source3 | |
parent | d6cb302988294c382d8bd6298e33d71504ff1a90 (diff) | |
download | samba-d948b1bfeec02706e8cd08a4f82c0ce54f99491c.tar.gz samba-d948b1bfeec02706e8cd08a4f82c0ce54f99491c.tar.bz2 samba-d948b1bfeec02706e8cd08a4f82c0ce54f99491c.zip |
s3: Add aio_fsync to the aio_linux module
Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_aio_linux.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/modules/vfs_aio_linux.c b/source3/modules/vfs_aio_linux.c index b685cdcad2..4ccdd8fb7e 100644 --- a/source3/modules/vfs_aio_linux.c +++ b/source3/modules/vfs_aio_linux.c @@ -212,6 +212,40 @@ static struct tevent_req *aio_linux_pwrite_send( return req; } +static struct tevent_req *aio_linux_fsync_send( + struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, + struct tevent_context *ev, struct files_struct *fsp) +{ + struct tevent_req *req; + struct aio_linux_state *state; + struct iocb *piocb; + int ret; + + req = tevent_req_create(mem_ctx, &state, struct aio_linux_state); + if (req == NULL) { + return NULL; + } + if (!init_aio_linux(handle)) { + tevent_req_error(req, EIO); + return tevent_req_post(req, ev); + } + + io_prep_fsync(&state->event_iocb, fsp->fh->fd); + io_set_eventfd(&state->event_iocb, event_fd); + state->event_iocb.data = req; + + piocb = &state->event_iocb; + + ret = io_submit(io_ctx, 1, &piocb); + if (ret < 0) { + tevent_req_error(req, -ret); + return tevent_req_post(req, ev); + } + num_busy += 1; + used = true; + return req; +} + static void aio_linux_done(struct event_context *event_ctx, struct fd_event *event, uint16 flags, void *private_data) @@ -278,6 +312,14 @@ static ssize_t aio_linux_recv(struct tevent_req *req, int *err) return state->ret; } +static int aio_linux_int_recv(struct tevent_req *req, int *err) +{ + /* + * Use implicit conversion ssize_t->int + */ + return aio_linux_recv(req, err); +} + static int aio_linux_connect(vfs_handle_struct *handle, const char *service, const char *user) { @@ -301,6 +343,8 @@ static struct vfs_fn_pointers vfs_aio_linux_fns = { .pread_recv_fn = aio_linux_recv, .pwrite_send_fn = aio_linux_pwrite_send, .pwrite_recv_fn = aio_linux_recv, + .fsync_send_fn = aio_linux_fsync_send, + .fsync_recv_fn = aio_linux_int_recv, }; NTSTATUS vfs_aio_linux_init(void) |