Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/plugins/posix/linux_aio_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ linuxAioQueue::linuxAioQueue(int num_entries, nixl_xfer_op_t operation)
ios(num_entries),
num_entries(num_entries),
num_ios_to_submit(0),
completed(num_entries),
num_completed(0),
num_ios_to_complete(0),
operation(operation) {
if (num_entries <= 0) {
throw std::runtime_error("Invalid number of entries for AIO queue");
Expand Down Expand Up @@ -58,6 +57,11 @@ linuxAioQueue::submit(const nixl_meta_dlist_t &, const nixl_meta_dlist_t &) {
return NIXL_IN_PROG;
}

if (num_ios_to_complete) {
NIXL_ERROR << "previous submit is not completed";
Copy link
Contributor

@aranadive aranadive Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NIXL_ERROR << "previous submit is not completed";
NIXL_ERROR << "previously submitted IO is not yet complete";

return NIXL_ERR_NOT_ALLOWED;
}

int ret = io_submit(io_ctx, num_ios_to_submit, ios_to_submit.data());
if (ret != num_ios_to_submit) {
if (ret < 0) {
Expand All @@ -69,14 +73,13 @@ linuxAioQueue::submit(const nixl_meta_dlist_t &, const nixl_meta_dlist_t &) {
return NIXL_ERR_BACKEND;
}

num_completed = 0;
num_ios_to_submit = 0;
num_ios_to_complete = ret;
return NIXL_IN_PROG;
}

nixl_status_t
linuxAioQueue::checkCompleted() {
if (num_completed == num_entries) {
if (!num_ios_to_complete) {
return NIXL_SUCCESS;
}

Expand All @@ -91,20 +94,15 @@ linuxAioQueue::checkCompleted() {
}

for (int i = 0; i < rc; i++) {
struct iocb *io = events[i].obj;
size_t idx = (size_t)io->data;

ios_to_submit[idx] = nullptr; // Mark as completed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still need to set this then in prepIO?


if (events[i].res < 0) {
NIXL_ERROR << "AIO operation failed: " << events[i].res;
return NIXL_ERR_BACKEND;
}
}

num_completed += rc;
num_ios_to_complete -= rc;

return (num_completed == num_entries) ? NIXL_SUCCESS : NIXL_IN_PROG;
return num_ios_to_complete ? NIXL_IN_PROG : NIXL_SUCCESS;
}

nixl_status_t
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/posix/linux_aio_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class linuxAioQueue : public nixlPosixQueue {
int num_entries; // Total number of entries expected
std::vector<struct iocb *> ios_to_submit; // Array of I/Os to submit
int num_ios_to_submit; // Total number of entries to submit
std::vector<bool> completed; // Track completed I/Os
int num_completed; // Number of completed operations
int num_ios_to_complete; // Total number of entries to complete
nixl_xfer_op_t operation; // Whether this is a read operation

// Delete copy and move operations
Expand Down