Optimize __get_io_u() for better code foot print
authorJens Axboe <jens.axboe@oracle.com>
Fri, 19 Mar 2010 09:33:39 +0000 (10:33 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 19 Mar 2010 09:33:39 +0000 (10:33 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index a4bf0c08581861076ccd31a8f720dcd861fbfe01..afc90de001f720d266d0ad612cb8c2d1873958f9 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -888,14 +888,6 @@ again:
                io_u->end_io = NULL;
        }
 
                io_u->end_io = NULL;
        }
 
-       /*
-        * We ran out, wait for async verify threads to finish and return one
-        */
-       if (!io_u && td->o.verify_async) {
-               pthread_cond_wait(&td->free_cond, &td->io_u_lock);
-               goto again;
-       }
-
        if (io_u) {
                assert(io_u->flags & IO_U_F_FREE);
                io_u->flags &= ~(IO_U_F_FREE | IO_U_F_FREE_DEF);
        if (io_u) {
                assert(io_u->flags & IO_U_F_FREE);
                io_u->flags &= ~(IO_U_F_FREE | IO_U_F_FREE_DEF);
@@ -905,6 +897,13 @@ again:
                flist_add(&io_u->list, &td->io_u_busylist);
                td->cur_depth++;
                io_u->flags |= IO_U_F_IN_CUR_DEPTH;
                flist_add(&io_u->list, &td->io_u_busylist);
                td->cur_depth++;
                io_u->flags |= IO_U_F_IN_CUR_DEPTH;
+       } else if (td->o.verify_async) {
+               /*
+                * We ran out, wait for async verify threads to finish and
+                * return one
+                */
+               pthread_cond_wait(&td->free_cond, &td->io_u_lock);
+               goto again;
        }
 
        td_io_u_unlock(td);
        }
 
        td_io_u_unlock(td);