From 01743ee1718e7ec4b16ae3e53c8f64900c6052cc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 2 Jun 2008 12:19:19 +0200 Subject: [PATCH] Rename list_* function and file to flist_ to avoid conflict with FreeBSD Signed-off-by: Jens Axboe --- blktrace.c | 6 ++-- diskutil.c | 38 +++++++++++----------- engines/posixaio.c | 6 ++-- filehash.c | 26 ++++++++-------- fio.c | 28 ++++++++--------- fio.h | 24 +++++++------- list.h => flist.h | 78 ++++++++++++++++++++++++---------------------- gettime.c | 23 +++++++------- io_u.c | 24 +++++++------- ioengines.c | 16 +++++----- log.c | 22 ++++++------- verify.c | 6 ++-- 12 files changed, 150 insertions(+), 147 deletions(-) rename list.h => flist.h (52%) diff --git a/blktrace.c b/blktrace.c index 46dc13bd..4469243e 100644 --- a/blktrace.c +++ b/blktrace.c @@ -6,7 +6,7 @@ #include #include -#include "list.h" +#include "flist.h" #include "fio.h" #include "blktrace_api.h" @@ -157,7 +157,7 @@ static void trace_add_open_event(struct thread_data *td, int fileno) ipo->ddir = DDIR_INVAL; ipo->fileno = fileno; ipo->file_action = FIO_LOG_OPEN_FILE; - list_add_tail(&ipo->list, &td->io_log_list); + flist_add_tail(&ipo->list, &td->io_log_list); } static void trace_add_file(struct thread_data *td, __u32 device) @@ -201,7 +201,7 @@ static void store_ipo(struct thread_data *td, unsigned long long offset, struct io_piece *ipo = malloc(sizeof(*ipo)); memset(ipo, 0, sizeof(*ipo)); - INIT_LIST_HEAD(&ipo->list); + INIT_FLIST_HEAD(&ipo->list); /* * the 512 is wrong here, it should be the hardware sector size... */ diff --git a/diskutil.c b/diskutil.c index 1815c4aa..a38f4fa3 100644 --- a/diskutil.c +++ b/diskutil.c @@ -11,7 +11,7 @@ static int last_majdev, last_mindev; -static struct list_head disk_list = LIST_HEAD_INIT(disk_list); +static struct flist_head disk_list = FLIST_HEAD_INIT(disk_list); static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus) { @@ -76,24 +76,24 @@ static void update_io_tick_disk(struct disk_util *du) void update_io_ticks(void) { - struct list_head *entry; + struct flist_head *entry; struct disk_util *du; dprint(FD_DISKUTIL, "update io ticks\n"); - list_for_each(entry, &disk_list) { - du = list_entry(entry, struct disk_util, list); + flist_for_each(entry, &disk_list) { + du = flist_entry(entry, struct disk_util, list); update_io_tick_disk(du); } } static struct disk_util *disk_util_exists(int major, int minor) { - struct list_head *entry; + struct flist_head *entry; struct disk_util *du; - list_for_each(entry, &disk_list) { - du = list_entry(entry, struct disk_util, list); + flist_for_each(entry, &disk_list) { + du = flist_entry(entry, struct disk_util, list); if (major == du->major && minor == du->minor) return du; @@ -105,21 +105,21 @@ static struct disk_util *disk_util_exists(int major, int minor) static void disk_util_add(int majdev, int mindev, char *path) { struct disk_util *du, *__du; - struct list_head *entry; + struct flist_head *entry; dprint(FD_DISKUTIL, "add maj/min %d/%d: %s\n", majdev, mindev, path); du = malloc(sizeof(*du)); memset(du, 0, sizeof(*du)); - INIT_LIST_HEAD(&du->list); + INIT_FLIST_HEAD(&du->list); sprintf(du->path, "%s/stat", path); du->name = strdup(basename(path)); du->sysfs_root = path; du->major = majdev; du->minor = mindev; - list_for_each(entry, &disk_list) { - __du = list_entry(entry, struct disk_util, list); + flist_for_each(entry, &disk_list) { + __du = flist_entry(entry, struct disk_util, list); dprint(FD_DISKUTIL, "found %s in list\n", __du->name); @@ -135,7 +135,7 @@ static void disk_util_add(int majdev, int mindev, char *path) fio_gettime(&du->time, NULL); get_io_ticks(du, &du->last_dus); - list_add_tail(&du->list, &disk_list); + flist_add_tail(&du->list, &disk_list); } static int check_dev_match(int majdev, int mindev, char *path) @@ -319,17 +319,17 @@ void init_disk_util(struct thread_data *td) void show_disk_util(void) { struct disk_util_stat *dus; - struct list_head *entry, *next; + struct flist_head *entry, *next; struct disk_util *du; double util; - if (list_empty(&disk_list)) + if (flist_empty(&disk_list)) return; log_info("\nDisk stats (read/write):\n"); - list_for_each(entry, &disk_list) { - du = list_entry(entry, struct disk_util, list); + flist_for_each(entry, &disk_list) { + du = flist_entry(entry, struct disk_util, list); dus = &du->dus; util = (double) 100 * du->dus.io_ticks / (double) du->msec; @@ -347,9 +347,9 @@ void show_disk_util(void) /* * now free the list */ - list_for_each_safe(entry, next, &disk_list) { - list_del(entry); - du = list_entry(entry, struct disk_util, list); + flist_for_each_safe(entry, next, &disk_list) { + flist_del(entry); + du = flist_entry(entry, struct disk_util, list); free(du->name); free(du); } diff --git a/engines/posixaio.c b/engines/posixaio.c index acd215c2..4aa1842a 100644 --- a/engines/posixaio.c +++ b/engines/posixaio.c @@ -83,7 +83,7 @@ static int fio_posixaio_getevents(struct thread_data *td, unsigned int min, { struct posixaio_data *pd = td->io_ops->data; struct aiocb *suspend_list[SUSPEND_ENTRIES]; - struct list_head *entry; + struct flist_head *entry; struct timespec start; int have_timeout = 0; int suspend_entries = 0; @@ -95,8 +95,8 @@ static int fio_posixaio_getevents(struct thread_data *td, unsigned int min, r = 0; memset(suspend_list, 0, sizeof(*suspend_list)); restart: - list_for_each(entry, &td->io_u_busylist) { - struct io_u *io_u = list_entry(entry, struct io_u, list); + flist_for_each(entry, &td->io_u_busylist) { + struct io_u *io_u = flist_entry(entry, struct io_u, list); int err; if (io_u->seen) diff --git a/filehash.c b/filehash.c index 54cea990..a00ac788 100644 --- a/filehash.c +++ b/filehash.c @@ -2,15 +2,15 @@ #include #include "fio.h" -#include "list.h" +#include "flist.h" #include "crc/crc16.h" #define HASH_BUCKETS 512 #define HASH_MASK (HASH_BUCKETS - 1) -unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct list_head); +unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct flist_head); -static struct list_head *file_hash; +static struct flist_head *file_hash; static struct fio_mutex *hash_lock; static unsigned short hash(const char *name) @@ -23,8 +23,8 @@ void remove_file_hash(struct fio_file *f) fio_mutex_down(hash_lock); if (f->flags & FIO_FILE_HASHED) { - assert(!list_empty(&f->hash_list)); - list_del_init(&f->hash_list); + assert(!flist_empty(&f->hash_list)); + flist_del_init(&f->hash_list); f->flags &= ~FIO_FILE_HASHED; } @@ -33,11 +33,11 @@ void remove_file_hash(struct fio_file *f) static struct fio_file *__lookup_file_hash(const char *name) { - struct list_head *bucket = &file_hash[hash(name)]; - struct list_head *n; + struct flist_head *bucket = &file_hash[hash(name)]; + struct flist_head *n; - list_for_each(n, bucket) { - struct fio_file *f = list_entry(n, struct fio_file, hash_list); + flist_for_each(n, bucket) { + struct fio_file *f = flist_entry(n, struct fio_file, hash_list); if (!strcmp(f->file_name, name)) { assert(f->fd != -1); @@ -65,14 +65,14 @@ struct fio_file *add_file_hash(struct fio_file *f) if (f->flags & FIO_FILE_HASHED) return NULL; - INIT_LIST_HEAD(&f->hash_list); + INIT_FLIST_HEAD(&f->hash_list); fio_mutex_down(hash_lock); alias = __lookup_file_hash(f->file_name); if (!alias) { f->flags |= FIO_FILE_HASHED; - list_add_tail(&f->hash_list, &file_hash[hash(f->file_name)]); + flist_add_tail(&f->hash_list, &file_hash[hash(f->file_name)]); } fio_mutex_up(hash_lock); @@ -85,7 +85,7 @@ void file_hash_exit(void) fio_mutex_down(hash_lock); for (i = 0; i < HASH_BUCKETS; i++) - has_entries += !list_empty(&file_hash[i]); + has_entries += !flist_empty(&file_hash[i]); fio_mutex_up(hash_lock); if (has_entries) @@ -102,7 +102,7 @@ void file_hash_init(void *ptr) file_hash = ptr; for (i = 0; i < HASH_BUCKETS; i++) - INIT_LIST_HEAD(&file_hash[i]); + INIT_FLIST_HEAD(&file_hash[i]); hash_lock = fio_mutex_init(1); } diff --git a/fio.c b/fio.c index bcabe335..43197b76 100644 --- a/fio.c +++ b/fio.c @@ -243,7 +243,7 @@ static inline int runtime_exceeded(struct thread_data *td, struct timeval *t) */ static void cleanup_pending_aio(struct thread_data *td) { - struct list_head *entry, *n; + struct flist_head *entry, *n; struct io_u *io_u; int r; @@ -258,8 +258,8 @@ static void cleanup_pending_aio(struct thread_data *td) * now cancel remaining active events */ if (td->io_ops->cancel) { - list_for_each_safe(entry, n, &td->io_u_busylist) { - io_u = list_entry(entry, struct io_u, list); + flist_for_each_safe(entry, n, &td->io_u_busylist) { + io_u = flist_entry(entry, struct io_u, list); /* * if the io_u isn't in flight, then that generally @@ -653,13 +653,13 @@ sync_done: static void cleanup_io_u(struct thread_data *td) { - struct list_head *entry, *n; + struct flist_head *entry, *n; struct io_u *io_u; - list_for_each_safe(entry, n, &td->io_u_freelist) { - io_u = list_entry(entry, struct io_u, list); + flist_for_each_safe(entry, n, &td->io_u_freelist) { + io_u = flist_entry(entry, struct io_u, list); - list_del(&io_u->list); + flist_del(&io_u->list); free(io_u); } @@ -703,7 +703,7 @@ static int init_io_u(struct thread_data *td) return 1; io_u = malloc(sizeof(*io_u)); memset(io_u, 0, sizeof(*io_u)); - INIT_LIST_HEAD(&io_u->list); + INIT_FLIST_HEAD(&io_u->list); if (!(td->io_ops->flags & FIO_NOIO)) { io_u->buf = p + max_bs * i; @@ -714,7 +714,7 @@ static int init_io_u(struct thread_data *td) io_u->index = i; io_u->flags = IO_U_F_FREE; - list_add(&io_u->list, &td->io_u_freelist); + flist_add(&io_u->list, &td->io_u_freelist); } io_u_init_timeout(); @@ -850,11 +850,11 @@ static void *thread_main(void *data) dprint(FD_PROCESS, "jobs pid=%d started\n", (int) td->pid); - INIT_LIST_HEAD(&td->io_u_freelist); - INIT_LIST_HEAD(&td->io_u_busylist); - INIT_LIST_HEAD(&td->io_u_requeues); - INIT_LIST_HEAD(&td->io_log_list); - INIT_LIST_HEAD(&td->io_hist_list); + INIT_FLIST_HEAD(&td->io_u_freelist); + INIT_FLIST_HEAD(&td->io_u_busylist); + INIT_FLIST_HEAD(&td->io_u_requeues); + INIT_FLIST_HEAD(&td->io_log_list); + INIT_FLIST_HEAD(&td->io_hist_list); td->io_hist_tree = RB_ROOT; td_set_runstate(td, TD_INITIALIZED); diff --git a/fio.h b/fio.h index b1792abe..25318ae5 100644 --- a/fio.h +++ b/fio.h @@ -16,7 +16,7 @@ #include #include "compiler/compiler.h" -#include "list.h" +#include "flist.h" #include "fifo.h" #include "rbtree.h" #include "arch/arch.h" @@ -92,7 +92,7 @@ struct io_log { struct io_piece { union { struct rb_node rb_node; - struct list_head list; + struct flist_head list; }; union { int fileno; @@ -170,7 +170,7 @@ struct io_u { struct fio_file *file; - struct list_head list; + struct flist_head list; /* * Callback for io completion @@ -295,7 +295,7 @@ enum fio_file_flags { * this structure holds state information for a single file. */ struct fio_file { - struct list_head hash_list; + struct flist_head hash_list; enum fio_filetype filetype; /* @@ -572,9 +572,9 @@ struct thread_data { */ unsigned int cur_depth; unsigned int io_u_queued; - struct list_head io_u_freelist; - struct list_head io_u_busylist; - struct list_head io_u_requeues; + struct flist_head io_u_freelist; + struct flist_head io_u_busylist; + struct flist_head io_u_requeues; /* * Rate state @@ -619,12 +619,12 @@ struct thread_data { * if we are overwriting. Otherwise just use a fifo. */ struct rb_root io_hist_tree; - struct list_head io_hist_list; + struct flist_head io_hist_list; /* * For IO replaying */ - struct list_head io_log_list; + struct flist_head io_log_list; /* * timeout handling @@ -746,7 +746,7 @@ struct disk_util_stat { * Per-device disk util management */ struct disk_util { - struct list_head list; + struct flist_head list; char *name; char *sysfs_root; @@ -904,7 +904,7 @@ extern void free_io_mem(struct thread_data *); /* * io unit handling */ -#define queue_full(td) list_empty(&(td)->io_u_freelist) +#define queue_full(td) flist_empty(&(td)->io_u_freelist) extern struct io_u *__get_io_u(struct thread_data *); extern struct io_u *get_io_u(struct thread_data *); extern void put_io_u(struct thread_data *, struct io_u *); @@ -941,7 +941,7 @@ extern int load_blktrace(struct thread_data *, const char *); #endif struct ioengine_ops { - struct list_head list; + struct flist_head list; char name[16]; int version; int flags; diff --git a/list.h b/flist.h similarity index 52% rename from list.h rename to flist.h index 172fa482..f28a5ab7 100644 --- a/list.h +++ b/flist.h @@ -1,5 +1,5 @@ -#ifndef _LINUX_LIST_H -#define _LINUX_LIST_H +#ifndef _LINUX_FLIST_H +#define _LINUX_FLIST_H #undef offsetof #ifdef __compiler_offsetof @@ -22,16 +22,16 @@ * using the generic single-entry routines. */ -struct list_head { - struct list_head *next, *prev; +struct flist_head { + struct flist_head *next, *prev; }; -#define LIST_HEAD_INIT(name) { &(name), &(name) } +#define FLIST_HEAD_INIT(name) { &(name), &(name) } -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) +#define FLIST_HEAD(name) \ + struct flist_head name = FLIST_HEAD_INIT(name) -#define INIT_LIST_HEAD(ptr) do { \ +#define INIT_FLIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) @@ -41,9 +41,9 @@ struct list_head { * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) +static inline void __flist_add(struct flist_head *new, + struct flist_head *prev, + struct flist_head *next) { next->prev = new; new->next = next; @@ -52,21 +52,22 @@ static inline void __list_add(struct list_head *new, } /** - * list_add - add a new entry + * flist_add - add a new entry * @new: new entry to be added * @head: list head to add it after * * Insert a new entry after the specified head. * This is good for implementing stacks. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static inline void flist_add(struct flist_head *new, struct flist_head *head) { - __list_add(new, head, head->next); + __flist_add(new, head, head->next); } -static inline void list_add_tail(struct list_head *new, struct list_head *head) +static inline void flist_add_tail(struct flist_head *new, + struct flist_head *head) { - __list_add(new, head->prev, head); + __flist_add(new, head->prev, head); } /* @@ -76,68 +77,69 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_del(struct list_head * prev, struct list_head * next) +static inline void __flist_del(struct flist_head *prev, + struct flist_head * next) { next->prev = prev; prev->next = next; } /** - * list_del - deletes entry from list. + * flist_del - deletes entry from list. * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is + * Note: flist_empty on entry does not return true after this, the entry is * in an undefined state. */ -static inline void list_del(struct list_head *entry) +static inline void flist_del(struct flist_head *entry) { - __list_del(entry->prev, entry->next); + __flist_del(entry->prev, entry->next); entry->next = NULL; entry->prev = NULL; } /** - * list_del_init - deletes entry from list and reinitialize it. + * flist_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. */ -static inline void list_del_init(struct list_head *entry) +static inline void flist_del_init(struct flist_head *entry) { - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); + __flist_del(entry->prev, entry->next); + INIT_FLIST_HEAD(entry); } /** - * list_empty - tests whether a list is empty + * flist_empty - tests whether a list is empty * @head: the list to test. */ -static inline int list_empty(const struct list_head *head) +static inline int flist_empty(const struct flist_head *head) { return head->next == head; } /** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. + * flist_entry - get the struct for this entry + * @ptr: the &struct flist_head pointer. * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. + * @member: the name of the flist_struct within the struct. */ -#define list_entry(ptr, type, member) \ +#define flist_entry(ptr, type, member) \ container_of(ptr, type, member) /** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. + * flist_for_each - iterate over a list + * @pos: the &struct flist_head to use as a loop counter. * @head: the head for your list. */ -#define list_for_each(pos, head) \ +#define flist_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage + * flist_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct flist_head to use as a loop counter. + * @n: another &struct flist_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_safe(pos, n, head) \ +#define flist_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) diff --git a/gettime.c b/gettime.c index d78cf6d0..2753faec 100644 --- a/gettime.c +++ b/gettime.c @@ -16,11 +16,11 @@ static int clock_gettime_works; #define HASH_BITS 8 #define HASH_SIZE (1 << HASH_BITS) -static struct list_head hash[HASH_SIZE]; +static struct flist_head hash[HASH_SIZE]; static int gtod_inited; struct gtod_log { - struct list_head list; + struct flist_head list; void *caller; unsigned long calls; }; @@ -28,10 +28,11 @@ struct gtod_log { static struct gtod_log *find_hash(void *caller) { unsigned long h = hash_ptr(caller, HASH_BITS); - struct list_head *entry; + struct flist_head *entry; - list_for_each(entry, &hash[h]) { - struct gtod_log *log = list_entry(entry, struct gtod_log, list); + flist_for_each(entry, &hash[h]) { + struct gtod_log *log = flist_entry(entry, struct gtod_log, + list); if (log->caller == caller) return log; @@ -48,12 +49,12 @@ static struct gtod_log *find_log(void *caller) unsigned long h; log = malloc(sizeof(*log)); - INIT_LIST_HEAD(&log->list); + INIT_FLIST_HEAD(&log->list); log->caller = caller; log->calls = 0; h = hash_ptr(caller, HASH_BITS); - list_add_tail(&log->list, &hash[h]); + flist_add_tail(&log->list, &hash[h]); } return log; @@ -74,11 +75,11 @@ static void fio_exit fio_dump_gtod(void) int i; for (i = 0; i < HASH_SIZE; i++) { - struct list_head *entry; + struct flist_head *entry; struct gtod_log *log; - list_for_each(entry, &hash[i]) { - log = list_entry(entry, struct gtod_log, list); + flist_for_each(entry, &hash[i]) { + log = flist_entry(entry, struct gtod_log, list); printf("function %p, calls %lu\n", log->caller, log->calls); @@ -94,7 +95,7 @@ static void fio_init gtod_init(void) int i; for (i = 0; i < HASH_SIZE; i++) - INIT_LIST_HEAD(&hash[i]); + INIT_FLIST_HEAD(&hash[i]); gtod_inited = 1; } diff --git a/io_u.c b/io_u.c index 927e1611..57b991ae 100644 --- a/io_u.c +++ b/io_u.c @@ -354,8 +354,8 @@ void put_io_u(struct thread_data *td, struct io_u *io_u) put_file_log(td, io_u->file); io_u->file = NULL; - list_del(&io_u->list); - list_add(&io_u->list, &td->io_u_freelist); + flist_del(&io_u->list); + flist_add(&io_u->list, &td->io_u_freelist); td->cur_depth--; } @@ -371,8 +371,8 @@ void requeue_io_u(struct thread_data *td, struct io_u **io_u) __io_u->flags &= ~IO_U_F_FLIGHT; - list_del(&__io_u->list); - list_add_tail(&__io_u->list, &td->io_u_requeues); + flist_del(&__io_u->list); + flist_add_tail(&__io_u->list, &td->io_u_requeues); td->cur_depth--; *io_u = NULL; } @@ -764,10 +764,10 @@ struct io_u *__get_io_u(struct thread_data *td) { struct io_u *io_u = NULL; - if (!list_empty(&td->io_u_requeues)) - io_u = list_entry(td->io_u_requeues.next, struct io_u, list); + if (!flist_empty(&td->io_u_requeues)) + io_u = flist_entry(td->io_u_requeues.next, struct io_u, list); else if (!queue_full(td)) { - io_u = list_entry(td->io_u_freelist.next, struct io_u, list); + io_u = flist_entry(td->io_u_freelist.next, struct io_u, list); io_u->buflen = 0; io_u->resid = 0; @@ -780,8 +780,8 @@ struct io_u *__get_io_u(struct thread_data *td) io_u->flags &= ~IO_U_F_FREE; io_u->error = 0; - list_del(&io_u->list); - list_add(&io_u->list, &td->io_u_busylist); + flist_del(&io_u->list); + flist_add(&io_u->list, &td->io_u_busylist); td->cur_depth++; } @@ -1060,7 +1060,7 @@ static void io_u_timeout_handler(int fio_unused sig) { struct thread_data *td, *__td; pid_t pid = getpid(); - struct list_head *entry; + struct flist_head *entry; struct io_u *io_u; int i; @@ -1089,8 +1089,8 @@ static void io_u_timeout_handler(int fio_unused sig) log_err("fio: io_u timeout: job=%s, pid=%d\n", td->o.name, td->pid); - list_for_each(entry, &td->io_u_busylist) { - io_u = list_entry(entry, struct io_u, list); + flist_for_each(entry, &td->io_u_busylist) { + io_u = flist_entry(entry, struct io_u, list); io_u_dump(io_u); } diff --git a/ioengines.c b/ioengines.c index dd70e1dd..3e178976 100644 --- a/ioengines.c +++ b/ioengines.c @@ -18,7 +18,7 @@ #include "fio.h" -static LIST_HEAD(engine_list); +static FLIST_HEAD(engine_list); static int check_engine_ops(struct ioengine_ops *ops) { @@ -58,24 +58,24 @@ static int check_engine_ops(struct ioengine_ops *ops) void unregister_ioengine(struct ioengine_ops *ops) { dprint(FD_IO, "ioengine %s unregistered\n", ops->name); - list_del(&ops->list); - INIT_LIST_HEAD(&ops->list); + flist_del(&ops->list); + INIT_FLIST_HEAD(&ops->list); } void register_ioengine(struct ioengine_ops *ops) { dprint(FD_IO, "ioengine %s registered\n", ops->name); - INIT_LIST_HEAD(&ops->list); - list_add_tail(&ops->list, &engine_list); + INIT_FLIST_HEAD(&ops->list); + flist_add_tail(&ops->list, &engine_list); } static struct ioengine_ops *find_ioengine(const char *name) { struct ioengine_ops *ops; - struct list_head *entry; + struct flist_head *entry; - list_for_each(entry, &engine_list) { - ops = list_entry(entry, struct ioengine_ops, list); + flist_for_each(entry, &engine_list) { + ops = flist_entry(entry, struct ioengine_ops, list); if (!strcmp(name, ops->name)) return ops; } diff --git a/log.c b/log.c index 191f806a..5c468ad9 100644 --- a/log.c +++ b/log.c @@ -6,14 +6,14 @@ #include #include #include -#include "list.h" +#include "flist.h" #include "fio.h" static const char iolog_ver2[] = "fio version 2 iolog"; void queue_io_piece(struct thread_data *td, struct io_piece *ipo) { - list_add_tail(&ipo->list, &td->io_log_list); + flist_add_tail(&ipo->list, &td->io_log_list); td->total_io_size += ipo->len; } @@ -109,11 +109,11 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) { struct io_piece *ipo; - while (!list_empty(&td->io_log_list)) { + while (!flist_empty(&td->io_log_list)) { int ret; - ipo = list_entry(td->io_log_list.next, struct io_piece, list); - list_del(&ipo->list); + ipo = flist_entry(td->io_log_list.next, struct io_piece, list); + flist_del(&ipo->list); ret = ipo_special(td, ipo); if (ret < 0) { @@ -155,9 +155,9 @@ void prune_io_piece_log(struct thread_data *td) free(ipo); } - while (!list_empty(&td->io_hist_list)) { - ipo = list_entry(td->io_hist_list.next, struct io_piece, list); - list_del(&ipo->list); + while (!flist_empty(&td->io_hist_list)) { + ipo = flist_entry(td->io_hist_list.next, struct io_piece, list); + flist_del(&ipo->list); free(ipo); } } @@ -185,8 +185,8 @@ void log_io_piece(struct thread_data *td, struct io_u *io_u) * wrote it out is the fastest. */ if (!td_random(td) || !td->o.overwrite) { - INIT_LIST_HEAD(&ipo->list); - list_add_tail(&ipo->list, &td->io_hist_list); + INIT_FLIST_HEAD(&ipo->list); + flist_add_tail(&ipo->list, &td->io_hist_list); return; } @@ -307,7 +307,7 @@ static int read_iolog2(struct thread_data *td, FILE *f) */ ipo = malloc(sizeof(*ipo)); memset(ipo, 0, sizeof(*ipo)); - INIT_LIST_HEAD(&ipo->list); + INIT_FLIST_HEAD(&ipo->list); ipo->offset = offset; ipo->len = bytes; ipo->ddir = rw; diff --git a/verify.c b/verify.c index d6025348..680e4910 100644 --- a/verify.c +++ b/verify.c @@ -639,9 +639,9 @@ int get_next_verify(struct thread_data *td, struct io_u *io_u) ipo = rb_entry(n, struct io_piece, rb_node); rb_erase(n, &td->io_hist_tree); - } else if (!list_empty(&td->io_hist_list)) { - ipo = list_entry(td->io_hist_list.next, struct io_piece, list); - list_del(&ipo->list); + } else if (!flist_empty(&td->io_hist_list)) { + ipo = flist_entry(td->io_hist_list.next, struct io_piece, list); + flist_del(&ipo->list); } if (ipo) { -- 2.25.1