[PATCH] Move related code next to each other
authorJens Axboe <jens.axboe@oracle.com>
Fri, 20 Oct 2006 09:41:03 +0000 (11:41 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 20 Oct 2006 09:41:03 +0000 (11:41 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index baf5d474dcee5b10f78a457f61571839f90b4c23..962c17a9e8ddeb7c0ffa70926aa30142b417e947 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -21,6 +21,35 @@ static int random_map_free(struct thread_data *td, struct fio_file *f,
        return (f->file_map[idx] & (1UL << bit)) == 0;
 }
 
+/*
+ * Mark a given offset as used in the map.
+ */
+static void mark_random_map(struct thread_data *td, struct fio_file *f,
+                           struct io_u *io_u)
+{
+       unsigned long long block = io_u->offset / (unsigned long long) td->min_bs;
+       unsigned int blocks = 0;
+
+       while (blocks < (io_u->buflen / td->min_bs)) {
+               unsigned int idx, bit;
+
+               if (!random_map_free(td, f, block))
+                       break;
+
+               idx = RAND_MAP_IDX(td, f, block);
+               bit = RAND_MAP_BIT(td, f, block);
+
+               assert(idx < f->num_maps);
+
+               f->file_map[idx] |= (1UL << bit);
+               block++;
+               blocks++;
+       }
+
+       if ((blocks * td->min_bs) < io_u->buflen)
+               io_u->buflen = blocks * td->min_bs;
+}
+
 /*
  * Return the next free block in the map.
  */
@@ -143,35 +172,6 @@ static int get_rw_ddir(struct thread_data *td)
                return DDIR_WRITE;
 }
 
-/*
- * Mark a given offset as used in the map.
- */
-static void mark_random_map(struct thread_data *td, struct fio_file *f,
-                           struct io_u *io_u)
-{
-       unsigned long long block = io_u->offset / (unsigned long long) td->min_bs;
-       unsigned int blocks = 0;
-
-       while (blocks < (io_u->buflen / td->min_bs)) {
-               unsigned int idx, bit;
-
-               if (!random_map_free(td, f, block))
-                       break;
-
-               idx = RAND_MAP_IDX(td, f, block);
-               bit = RAND_MAP_BIT(td, f, block);
-
-               assert(idx < f->num_maps);
-
-               f->file_map[idx] |= (1UL << bit);
-               block++;
-               blocks++;
-       }
-
-       if ((blocks * td->min_bs) < io_u->buflen)
-               io_u->buflen = blocks * td->min_bs;
-}
-
 void put_io_u(struct thread_data *td, struct io_u *io_u)
 {
        io_u->file = NULL;