]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/fs: uninline aio methods
authorSage Weil <sage@redhat.com>
Mon, 7 Nov 2016 22:51:01 +0000 (17:51 -0500)
committerSage Weil <sage@redhat.com>
Mon, 7 Nov 2016 22:51:01 +0000 (17:51 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/fs/FS.cc
src/os/fs/FS.h

index 187217087a3e08015ac0bfe270b20385efcf052c..d2a9f350d343f202e247eaacd3a7b0e39ce8b536 100644 (file)
@@ -182,3 +182,46 @@ int FS::zero(int fd, uint64_t offset, uint64_t length)
  out:
   return r;
 }
+
+// ---------------
+
+int FS::aio_queue_t::submit(aio_t &aio, int *retries)
+{
+  // 2^16 * 125us = ~8 seconds, so max sleep is ~16 seconds
+  int attempts = 16;
+  int delay = 125;
+  iocb *piocb = &aio.iocb;
+  while (true) {
+    int r = io_submit(ctx, 1, &piocb);
+    if (r < 0) {
+      if (r == -EAGAIN && attempts-- > 0) {
+       usleep(delay);
+       delay *= 2;
+       (*retries)++;
+       continue;
+      }
+      return r;
+    }
+    assert(r == 1);
+    break;
+  }
+  return 0;
+}
+
+int FS::aio_queue_t::get_next_completed(int timeout_ms, aio_t **paio, int max)
+{
+  io_event event[max];
+  struct timespec t = {
+    timeout_ms / 1000,
+    (timeout_ms % 1000) * 1000 * 1000
+  };
+  int r = io_getevents(ctx, 1, max, event, &t);
+  if (r <= 0) {
+    return r;
+  }
+  for (int i=0; i<r; ++i) {
+    paio[i] = (aio_t *)event[i].obj;
+    paio[i]->rval = event[i].res;
+  }
+  return r;
+}
index 63cd05f0b6b7f6a1a3f30dc3440571ffd8238d18..27b4334f364dd86412729fdeaf0b313015193cc7 100644 (file)
@@ -109,44 +109,8 @@ public:
       }
     }
 
-    int submit(aio_t &aio, int *retries) {
-      // 2^16 * 125us = ~8 seconds, so max sleep is ~16 seconds
-      int attempts = 16;
-      int delay = 125;
-      iocb *piocb = &aio.iocb;
-      while (true) {
-       int r = io_submit(ctx, 1, &piocb);
-       if (r < 0) {
-         if (r == -EAGAIN && attempts-- > 0) {
-           usleep(delay);
-           delay *= 2;
-           (*retries)++;
-           continue;
-         }
-         return r;
-       }
-       assert(r == 1);
-       break;
-      }
-      return 0;
-    }
-
-    int get_next_completed(int timeout_ms, aio_t **paio, int max) {
-      io_event event[max];
-      struct timespec t = {
-       timeout_ms / 1000,
-       (timeout_ms % 1000) * 1000 * 1000
-      };
-      int r = io_getevents(ctx, 1, max, event, &t);
-      if (r <= 0) {
-       return r;
-      }
-      for (int i=0; i<r; ++i) {
-       paio[i] = (aio_t *)event[i].obj;
-       paio[i]->rval = event[i].res;
-      }
-      return r;
-    }
+    int submit(aio_t &aio, int *retries);
+    int get_next_completed(int timeout_ms, aio_t **paio, int max);
   };
 #endif
 };