]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/fs: make aio EAGAIN backoff exponential
authorSage Weil <sage@redhat.com>
Wed, 6 Jan 2016 19:19:54 +0000 (14:19 -0500)
committerSage Weil <sage@redhat.com>
Fri, 8 Jan 2016 18:10:19 +0000 (13:10 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/fs/FS.h

index ec0376e4fb38c74a94be818e1652d1717b27f85d..3941799398e2fad56c778ff8fd90afc8b1c5efcc 100644 (file)
@@ -110,13 +110,16 @@ public:
     }
 
     int submit(aio_t &aio, int *retries) {
-      int attempts = 10;
+      // 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(500);
+           usleep(delay);
+           delay *= 2;
            (*retries)++;
            continue;
          }