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 Mar 20, 2024
1 parent 47bb17b commit c29dd7b
Showing 1 changed file with 12 additions and 4 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

0 comments on commit c29dd7b

Please sign in to comment.