ffz() takes ints, so change the file_map to being int based
authorJens Axboe <jens.axboe@oracle.com>
Fri, 30 May 2008 22:21:12 +0000 (00:21 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 30 May 2008 22:21:12 +0000 (00:21 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
fio.h
io_u.c
ioengines.c

index 60eaeb057a7e0a144ee27fccd1b1f2da49fbe0ac..d7fbfc3d00275fee2dc76f831c1dc84dca3d03c3 100644 (file)
@@ -601,7 +601,7 @@ int init_random_map(struct thread_data *td)
                                (unsigned long long) td->o.rw_min_bs;
                num_maps = (blocks + BLOCKS_PER_MAP - 1) /
                                (unsigned long long) BLOCKS_PER_MAP;
-               f->file_map = smalloc(num_maps * sizeof(long));
+               f->file_map = smalloc(num_maps * sizeof(int));
                if (f->file_map) {
                        f->num_maps = num_maps;
                        continue;
diff --git a/fio.h b/fio.h
index 0d3ed4a850d3322e50607297f538a8a5412423f6..a155518160757bf16e3d9fb7210d51a4da4e130d 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -326,7 +326,7 @@ struct fio_file {
        /*
         * block map for random io
         */
-       unsigned long *file_map;
+       unsigned int *file_map;
        unsigned int num_maps;
        unsigned int last_free_lookup;
 
@@ -704,7 +704,7 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u)
        assert(!(io_u->ddir == DDIR_WRITE && !td_write(td)));
 }
 
-#define BLOCKS_PER_MAP         (8 * sizeof(long))
+#define BLOCKS_PER_MAP         (8 * sizeof(int))
 #define TO_MAP_BLOCK(f, b)     (b)
 #define RAND_MAP_IDX(f, b)     (TO_MAP_BLOCK(f, b) / BLOCKS_PER_MAP)
 #define RAND_MAP_BIT(f, b)     (TO_MAP_BLOCK(f, b) & (BLOCKS_PER_MAP - 1))
diff --git a/io_u.c b/io_u.c
index 1637b74daf69ede187ad5c063ac95e1dcee31cd5..a6d1f1d04c593c72c3f4d6f01bbb78b10b525f0e 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -33,7 +33,7 @@ static int random_map_free(struct fio_file *f, const unsigned long long block)
 
        dprint(FD_RANDOM, "free: b=%llu, idx=%u, bit=%u\n", block, idx, bit);
 
-       return (f->file_map[idx] & (1UL << bit)) == 0;
+       return (f->file_map[idx] & (1 << bit)) == 0;
 }
 
 /*
@@ -66,7 +66,7 @@ static void mark_random_map(struct thread_data *td, struct io_u *io_u)
 
                fio_assert(td, idx < f->num_maps);
 
-               f->file_map[idx] |= (1UL << bit);
+               f->file_map[idx] |= (1 << bit);
                block++;
                blocks++;
        }
@@ -108,7 +108,7 @@ static int get_next_free_block(struct thread_data *td, struct fio_file *f,
        i = f->last_free_lookup;
        *b = (i * BLOCKS_PER_MAP);
        while ((*b) * min_bs < f->real_file_size) {
-               if (f->file_map[i] != -1UL) {
+               if (f->file_map[i] != (unsigned int) -1) {
                        *b += ffz(f->file_map[i]);
                        if (*b > last_block(td, f, ddir))
                                break;
index 662d55d7cf9d1087750a209fee471de0203dc532..dd70e1dd733a702cf571b054c60d6e815c9dd5c0 100644 (file)
@@ -362,7 +362,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
        }
 
        if (f->file_map)
-               memset(f->file_map, 0, f->num_maps * sizeof(long));
+               memset(f->file_map, 0, f->num_maps * sizeof(int));
 
 done:
        log_file(td, f, FIO_LOG_OPEN_FILE);