allow for outstanding_aio_calls to be decremented
authorOlaf Flebbe <o.flebbe@science-computing.de>
Wed, 30 Sep 2009 22:20:09 +0000 (15:20 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 26 Nov 2009 10:38:48 +0000 (11:38 +0100)
(cherry picked from commit 5b0b93991f256d1cd5c681c60075c4b17a0bc3c9)

source3/smbd/aio.c

index c0367a5ee813ab57d78176b0cfd582dbd29d027d..491dd794646bdd89fa4310b5c2468e4193d85873 100644 (file)
@@ -184,6 +184,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
                return False;
        }
 
+       outstanding_aio_calls++;
        aio_ex->req = talloc_move(aio_ex, &req);
 
        DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
@@ -191,7 +192,6 @@ bool schedule_aio_read_and_X(connection_struct *conn,
                  fsp_str_dbg(fsp), (double)startpos, (unsigned int)smb_maxcnt,
                  (unsigned int)aio_ex->req->mid ));
 
-       outstanding_aio_calls++;
        return True;
 }
 
@@ -279,6 +279,7 @@ bool schedule_aio_write_and_X(connection_struct *conn,
                return False;
        }
 
+       outstanding_aio_calls++;
        aio_ex->req = talloc_move(aio_ex, &req);
 
        /* This should actually be improved to span the write. */
@@ -302,7 +303,6 @@ bool schedule_aio_write_and_X(connection_struct *conn,
                DEBUG(10,("schedule_aio_write_and_X: scheduled aio_write "
                          "behind for file %s\n", fsp_str_dbg(fsp)));
        }
-       outstanding_aio_calls++;
 
        DEBUG(10,("schedule_aio_write_and_X: scheduled aio_write for file "
                  "%s, offset %.0f, len = %u (mid = %u) "
@@ -519,6 +519,8 @@ void smbd_aio_complete_mid(unsigned int mid)
        struct aio_extra *aio_ex = find_aio_ex(mid);
        int ret = 0;
 
+       outstanding_aio_calls--;
+
        DEBUG(10,("smbd_aio_complete_mid: mid[%u]\n", mid));
 
        if (!aio_ex) {