mirror of
https://github.com/samba-team/samba.git
synced 2025-01-14 19:24:43 +03:00
vfs_io_uring: split out a vfs_io_uring_pread_submit() function
This can be reused when we add handling for short reads. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14361 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
ab89b8e753
commit
9de4f8be1d
@ -399,10 +399,13 @@ static void vfs_io_uring_fd_handler(struct tevent_context *ev,
|
||||
|
||||
struct vfs_io_uring_pread_state {
|
||||
struct vfs_io_uring_request ur;
|
||||
struct files_struct *fsp;
|
||||
off_t offset;
|
||||
struct iovec iov;
|
||||
size_t nread;
|
||||
};
|
||||
|
||||
static void vfs_io_uring_pread_submit(struct vfs_io_uring_pread_state *state);
|
||||
static void vfs_io_uring_pread_completion(struct vfs_io_uring_request *cur,
|
||||
const char *location);
|
||||
|
||||
@ -441,13 +444,11 @@ static struct tevent_req *vfs_io_uring_pread_send(struct vfs_handle_struct *hand
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
state->fsp = fsp;
|
||||
state->offset = offset;
|
||||
state->iov.iov_base = (void *)data;
|
||||
state->iov.iov_len = n;
|
||||
io_uring_prep_readv(&state->ur.sqe,
|
||||
fsp->fh->fd,
|
||||
&state->iov, 1,
|
||||
offset);
|
||||
vfs_io_uring_request_submit(&state->ur);
|
||||
vfs_io_uring_pread_submit(state);
|
||||
|
||||
if (!tevent_req_is_in_progress(req)) {
|
||||
return tevent_req_post(req, ev);
|
||||
@ -457,6 +458,15 @@ static struct tevent_req *vfs_io_uring_pread_send(struct vfs_handle_struct *hand
|
||||
return req;
|
||||
}
|
||||
|
||||
static void vfs_io_uring_pread_submit(struct vfs_io_uring_pread_state *state)
|
||||
{
|
||||
io_uring_prep_readv(&state->ur.sqe,
|
||||
state->fsp->fh->fd,
|
||||
&state->iov, 1,
|
||||
state->offset);
|
||||
vfs_io_uring_request_submit(&state->ur);
|
||||
}
|
||||
|
||||
static void vfs_io_uring_pread_completion(struct vfs_io_uring_request *cur,
|
||||
const char *location)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user