]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/aio: fix incomplete patch to get rid off aio_size
authorIgor Fedotov <ifedotov@suse.com>
Wed, 20 Mar 2024 18:27:41 +0000 (21:27 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Fri, 19 Jul 2024 11:54:30 +0000 (14:54 +0300)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit 8238b6086968d9da18081a14cfd00cc669ffc4ad)

src/blk/aio/aio.cc
src/blk/aio/aio.h

index e550165a960575f45c21e19b243e41c3c6cc077c..cb553b80bde209ebfa39a47efc6d19794b78136a 100644 (file)
@@ -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 pushed = 0; //used for LIBAIO only
+  int pulled = 0;
+  while (cur != end || pushed < pulled) {
 #if defined(HAVE_LIBAIO)
-    int itemCount = 0;
-    while (cur != end && itemCount < max_iodepth) {
+    while (cur != end && pulled < max_iodepth) {
       cur->priv = priv;
-      piocb[itemCount] = &(*cur);
-      ++itemCount;
+      piocb[pulled] = &(*cur);
+      ++pulled;
       ++cur;
     }
-    r = io_submit(ctx, itemCount, (struct iocb**)piocb);
+    int toSubmit = pulled - pushed;
+    r = io_submit(ctx, toSubmit, (struct iocb**)(piocb + pushed));
+    if (r >= 0 && r < toSubmit) {
+      pushed += r;
+      done += r;
+      r = -EAGAIN;
+    }
 #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;
@@ -69,6 +76,7 @@ int aio_queue_t::submit_batch(aio_iter begin, aio_iter end,
     done += r;
     attempts = 16;
     delay = 125;
+    pushed = pulled = 0;
   }
   return done;
 }
index 0d8211e7858a45bcec442f7450f6fc18f3a2393a..cf21c416731634066cdea1ef7d3e01a9ad2b7713 100644 (file)
@@ -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;
 };