Skip to content

Commit

Permalink
blk/aio: fix incomplete patch to get rid off aio_size
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
  • Loading branch information
ifed01 committed Apr 15, 2024
1 parent 7b52409 commit 3666d9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/blk/aio/aio.cc
Expand Up @@ -29,18 +29,25 @@ int aio_queue_t::submit_batch(aio_iter begin, aio_iter end,
struct aio_t *piocb[max_iodepth];
#endif
int done = 0;
while (cur != end) {
int itemCount0 = 0; //used for LIBAIO only
int itemCount = 0;
while (cur != end || itemCount0 < itemCount) {
#if defined(HAVE_LIBAIO)
int itemCount = 0;
while (cur != end && itemCount < max_iodepth) {
cur->priv = priv;
piocb[itemCount] = &(*cur);
++itemCount;
++cur;
}
r = io_submit(ctx, itemCount, (struct iocb**)piocb);
int toSubmit = itemCount - itemCount0;
r = io_submit(ctx, toSubmit, (struct iocb**)(piocb + itemCount0));
if (r >= 0 && r < toSubmit) {
r = -EAGAIN;
itemCount0 += (r > 0 ? r : 0);
done += (r > 0 ? r : 0);
}
#elif defined(HAVE_POSIXAIO)
cur->priv = priv
cur->priv = priv;
if ((cur->n_aiocb == 1) {
// TODO: consider batching multiple reads together with lio_listio
cur->aio.aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
Expand Down Expand Up @@ -69,6 +76,7 @@ int aio_queue_t::submit_batch(aio_iter begin, aio_iter end,
done += r;
attempts = 16;
delay = 125;
itemCount0 = itemCount = 0;
}
return done;
}
Expand Down
2 changes: 1 addition & 1 deletion src/blk/aio/aio.h
Expand Up @@ -100,7 +100,7 @@ struct io_queue_t {

virtual int init(std::vector<int> &fds) = 0;
virtual void shutdown() = 0;
virtual int submit_batch(aio_iter begin, aio_iter end,
virtual int submit_batch(aio_iter begin, aio_iter end,
void *priv, int *retries) = 0;
virtual int get_next_completed(int timeout_ms, aio_t **paio, int max) = 0;
};
Expand Down

0 comments on commit 3666d9d

Please sign in to comment.