The following changes since commit 0cc6ee59fd3caf08e934438241afa4982a15642c: libaio: use container_of() instead of silly casting (2013-01-02 12:57:23 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (6): zipf/pareto: use size= if given, not always device size Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio zipf/pareto: use min of file size and io size for init Start of transition from unsigned long long to uint64_t Use uintptr_t for engine data time: convert to uint64_t engines/binject.c | 14 +++++++------- file.h | 18 +++++++++--------- filesetup.c | 6 ++++-- gettime.c | 12 ++++++------ time.c | 2 +- time.h | 13 ++++++------- 6 files changed, 33 insertions(+), 32 deletions(-) --- Diff of recent changes: diff --git a/engines/binject.c b/engines/binject.c index f78d855..7b8522a 100644 --- a/engines/binject.c +++ b/engines/binject.c @@ -69,7 +69,7 @@ static unsigned int binject_read_commands(struct thread_data *td, void *p, one_more: events = 0; for_each_file(td, f, i) { - bf = (void *) f->engine_data; + bf = (struct binject_file *) f->engine_data; ret = read(bf->fd, p, left * sizeof(struct b_user_cmd)); if (ret < 0) { if (errno == EAGAIN) @@ -104,7 +104,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, * Fill in the file descriptors */ for_each_file(td, f, i) { - bf = (void *) f->engine_data; + bf = (struct binject_file *) f->engine_data; /* * don't block for min events == 0 @@ -153,7 +153,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, if (!min) { for_each_file(td, f, i) { - bf = (void *) f->engine_data; + bf = (struct binject_file *) f->engine_data; fcntl(bf->fd, F_SETFL, bd->fd_flags[i]); } } @@ -167,7 +167,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, static int fio_binject_doio(struct thread_data *td, struct io_u *io_u) { struct b_user_cmd *buc = &io_u->buc; - struct binject_file *bf = (void *) io_u->file->engine_data; + struct binject_file *bf = (struct binject_file *) io_u->file->engine_data; int ret; ret = write(bf->fd, buc, sizeof(*buc)); @@ -181,7 +181,7 @@ static int fio_binject_prep(struct thread_data *td, struct io_u *io_u) { struct binject_data *bd = td->io_ops->data; struct b_user_cmd *buc = &io_u->buc; - struct binject_file *bf = (void *) io_u->file->engine_data; + struct binject_file *bf = (struct binject_file *) io_u->file->engine_data; if (io_u->xfer_buflen & (bf->bs - 1)) { log_err("read/write not sector aligned\n"); @@ -323,7 +323,7 @@ err_unmap: static int fio_binject_close_file(struct thread_data *td, struct fio_file *f) { - struct binject_file *bf = (void *) f->engine_data; + struct binject_file *bf = (struct binject_file *) f->engine_data; if (bf) { binject_unmap_dev(td, bf); @@ -357,7 +357,7 @@ static int fio_binject_open_file(struct thread_data *td, struct fio_file *f) bf = malloc(sizeof(*bf)); bf->bs = bs; bf->minor = bf->fd = -1; - f->engine_data = (uint64_t) bf; + f->engine_data = (uintptr_t) bf; if (binject_map_dev(td, bf, f->fd)) { err_close: diff --git a/file.h b/file.h index e57bebc..5f125c3 100644 --- a/file.h +++ b/file.h @@ -84,20 +84,20 @@ struct fio_file { /* * size of the file, offset into file, and io size from that offset */ - unsigned long long real_file_size; - unsigned long long file_offset; - unsigned long long io_size; + uint64_t real_file_size; + uint64_t file_offset; + uint64_t io_size; - unsigned long long last_pos; - unsigned long long last_start; + uint64_t last_pos; + uint64_t last_start; - unsigned long long first_write; - unsigned long long last_write; + uint64_t first_write; + uint64_t last_write; /* * For use by the io engine */ - uint64_t engine_data; + uintptr_t engine_data; /* * if io is protected by a semaphore, this is set @@ -154,7 +154,7 @@ FILE_FLAG_FNS(partial_mmap); struct thread_data; extern void close_files(struct thread_data *); extern void close_and_free_files(struct thread_data *); -extern unsigned long long get_start_offset(struct thread_data *); +extern uint64_t get_start_offset(struct thread_data *); extern int __must_check setup_files(struct thread_data *); extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_file *); extern int __must_check generic_open_file(struct thread_data *, struct fio_file *); diff --git a/filesetup.c b/filesetup.c index 9d3e062..b1ca921 100644 --- a/filesetup.c +++ b/filesetup.c @@ -709,7 +709,7 @@ static unsigned long long get_fs_free_counts(struct thread_data *td) return ret; } -unsigned long long get_start_offset(struct thread_data *td) +uint64_t get_start_offset(struct thread_data *td) { return td->o.start_offset + (td->thread_number - 1) * td->o.offset_increment; @@ -907,10 +907,12 @@ static int __init_rand_distribution(struct thread_data *td, struct fio_file *f) { unsigned int range_size, seed; unsigned long nranges; + uint64_t file_size; range_size = min(td->o.min_bs[DDIR_READ], td->o.min_bs[DDIR_WRITE]); + file_size = min(f->real_file_size, f->io_size); - nranges = (f->real_file_size + range_size - 1) / range_size; + nranges = (file_size + range_size - 1) / range_size; seed = jhash(f->file_name, strlen(f->file_name), 0) * td->thread_number; if (!td->o.rand_repeatable) diff --git a/gettime.c b/gettime.c index 3011d74..1648b17 100644 --- a/gettime.c +++ b/gettime.c @@ -324,10 +324,10 @@ void fio_clock_init(void) log_info("fio: clocksource=cpu may not be reliable\n"); } -unsigned long long utime_since(struct timeval *s, struct timeval *e) +uint64_t utime_since(struct timeval *s, struct timeval *e) { long sec, usec; - unsigned long long ret; + uint64_t ret; sec = e->tv_sec - s->tv_sec; usec = e->tv_usec - s->tv_usec; @@ -347,7 +347,7 @@ unsigned long long utime_since(struct timeval *s, struct timeval *e) return ret; } -unsigned long long utime_since_now(struct timeval *s) +uint64_t utime_since_now(struct timeval *s) { struct timeval t; @@ -355,7 +355,7 @@ unsigned long long utime_since_now(struct timeval *s) return utime_since(s, &t); } -unsigned long mtime_since(struct timeval *s, struct timeval *e) +uint64_t mtime_since(struct timeval *s, struct timeval *e) { long sec, usec, ret; @@ -376,7 +376,7 @@ unsigned long mtime_since(struct timeval *s, struct timeval *e) return ret; } -unsigned long mtime_since_now(struct timeval *s) +uint64_t mtime_since_now(struct timeval *s) { struct timeval t; void *p = __builtin_return_address(0); @@ -385,7 +385,7 @@ unsigned long mtime_since_now(struct timeval *s) return mtime_since(s, &t); } -unsigned long time_since_now(struct timeval *s) +uint64_t time_since_now(struct timeval *s) { return mtime_since_now(s) / 1000; } diff --git a/time.c b/time.c index c4d1d4c..17f9f6f 100644 --- a/time.c +++ b/time.c @@ -53,7 +53,7 @@ void usec_sleep(struct thread_data *td, unsigned long usec) } while (!td->terminate); } -unsigned long mtime_since_genesis(void) +uint64_t mtime_since_genesis(void) { return mtime_since_now(&genesis); } diff --git a/time.h b/time.h index 3824102..d835191 100644 --- a/time.h +++ b/time.h @@ -1,19 +1,18 @@ #ifndef FIO_TIME_H #define FIO_TIME_H -extern unsigned long long utime_since(struct timeval *, struct timeval *); -extern unsigned long long utime_since_now(struct timeval *); -extern unsigned long mtime_since(struct timeval *, struct timeval *); -extern unsigned long mtime_since_now(struct timeval *); -extern unsigned long time_since_now(struct timeval *); -extern unsigned long mtime_since_genesis(void); +extern uint64_t utime_since(struct timeval *, struct timeval *); +extern uint64_t utime_since_now(struct timeval *); +extern uint64_t mtime_since(struct timeval *, struct timeval *); +extern uint64_t mtime_since_now(struct timeval *); +extern uint64_t time_since_now(struct timeval *); +extern uint64_t mtime_since_genesis(void); extern void usec_spin(unsigned int); extern void usec_sleep(struct thread_data *, unsigned long); extern void fill_start_time(struct timeval *); extern void set_genesis_time(void); extern int ramp_time_over(struct thread_data *); extern int in_ramp_time(struct thread_data *); -extern unsigned long long genesis_cycles; extern void fio_time_init(void); #endif -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html