From de605666880852ba9d1a0469723126b09782c520 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 31 May 2008 00:21:12 +0200 Subject: [PATCH] ffz() takes ints, so change the file_map to being int based Signed-off-by: Jens Axboe --- filesetup.c | 2 +- fio.h | 4 ++-- io_u.c | 6 +++--- ioengines.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/filesetup.c b/filesetup.c index 60eaeb05..d7fbfc3d 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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 0d3ed4a8..a1555181 100644 --- 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 1637b74d..a6d1f1d0 100644 --- 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; diff --git a/ioengines.c b/ioengines.c index 662d55d7..dd70e1dd 100644 --- a/ioengines.c +++ b/ioengines.c @@ -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); -- 2.25.1