Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message May 29, 2013 Kbuild

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 6e5c4b8e46c95ca75e30e1110a0d24b2df9c47e9:

Catch NULL td->o.ioengine (2013-05-27 09:50:31 +0200)

are available in the git repository at:
git://git.kernel.dk/fio.git master

Jens Axboe (2):
Replace list based free/busy/requeue list with FIFO + ring Bump IO engine version number

 Makefile           |    2 +-
 backend.c          |   52 +++++++++++++++++++----------------
 engines/posixaio.c |    8 +++---
 fio.h              |    7 +++--
 io_u.c             |   20 ++++++-------
 io_u_queue.c       |   43 +++++++++++++++++++++++++++++
 io_u_queue.h       |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 ioengine.h         |   55 +++++++++++++++++++------------------
 verify.c           |    7 ++---
 9 files changed, 195 insertions(+), 74 deletions(-)
 create mode 100644 io_u_queue.c
 create mode 100644 io_u_queue.h

---

Diff of recent changes:

Makefile +1 -1
index d78be34..57f3f82 100644
@@ -33,7 +33,7 @@ SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
 		cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \
 		lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
 		lib/hweight.c lib/getrusage.c idletime.c td_error.c \
-		profiles/tiobench.c profiles/act.c
+		profiles/tiobench.c profiles/act.c io_u_queue.c
 
 ifdef CONFIG_64BIT_LLP64
   CFLAGS += -DBITS_PER_LONG=32
backend.c +28 -24

109 lines not on this page · raw message

engines/posixaio.c +4 -4
index 1858e52..a2b5387 100644
@@ -95,11 +95,12 @@ static int fio_posixaio_getevents(struct thread_data *td, unsigned int min,
 {
 	struct posixaio_data *pd = td->io_ops->data;
 	os_aiocb_t *suspend_list[SUSPEND_ENTRIES];
-	struct flist_head *entry;
 	struct timespec start;
 	int have_timeout = 0;
 	int suspend_entries;
+	struct io_u *io_u;
 	unsigned int r;
+	int i;
 
 	if (t && !fill_timespec(&start))
 		have_timeout = 1;
@@ -110,11 +111,10 @@ static int fio_posixaio_getevents(struct thread_data *td, unsigned int min,
 restart:
 	memset(suspend_list, 0, sizeof(*suspend_list));
 	suspend_entries = 0;
-	flist_for_each(entry, &td->io_u_busylist) {
-		struct io_u *io_u = flist_entry(entry, struct io_u, list);
+	io_u_qiter(&td->io_u_all, io_u, i) {
 		int err;
 
-		if (io_u->seen)
+		if (io_u->seen || !(io_u->flags & IO_U_F_FLIGHT))
 			continue;
 
 		err = aio_error(&io_u->aiocb);
fio.h +4 -3
index 965d7d9..8c67fcc 100644
@@ -39,6 +39,7 @@
 #include "server.h"
 #include "stat.h"
 #include "flow.h"
+#include "io_u_queue.h"
 
 #ifdef CONFIG_SOLARISAIO
 #include <sys/asynch.h>
@@ -193,9 +194,9 @@ struct thread_data {
 	/*
 	 * List of free and busy io_u's
 	 */
-	struct flist_head io_u_freelist;
-	struct flist_head io_u_busylist;
-	struct flist_head io_u_requeues;
+	struct io_u_ring io_u_requeues;
+	struct io_u_queue io_u_freelist;
+	struct io_u_queue io_u_all;
 	pthread_mutex_t io_u_lock;
 	pthread_cond_t free_cond;
 
io_u.c +9 -11
index 645a680..11672cf 100644
@@ -676,8 +676,7 @@ void put_io_u(struct thread_data *td, struct io_u *io_u)
 
 	if (io_u->flags & IO_U_F_IN_CUR_DEPTH)
 		td->cur_depth--;
-	flist_del_init(&io_u->list);
-	flist_add(&io_u->list, &td->io_u_freelist);
+	io_u_qpush(&td->io_u_freelist, io_u);
 	td_io_u_unlock(td);
 	td_io_u_free_notify(td);
 }
@@ -704,8 +703,8 @@ void requeue_io_u(struct thread_data *td, struct io_u **io_u)
 	__io_u->flags &= ~IO_U_F_FLIGHT;
 	if (__io_u->flags & IO_U_F_IN_CUR_DEPTH)
 		td->cur_depth--;
-	flist_del(&__io_u->list);
-	flist_add_tail(&__io_u->list, &td->io_u_requeues);
+
+	io_u_rpush(&td->io_u_requeues, __io_u);
 	td_io_u_unlock(td);
 	*io_u = NULL;
 }
@@ -1107,16 +1106,17 @@ static int set_io_u_file(struct thread_data *td, struct io_u *io_u)
 
 struct io_u *__get_io_u(struct thread_data *td)
 {
-	struct io_u *io_u = NULL;
+	struct io_u *io_u;
 
 	td_io_u_lock(td);
 
 again:
-	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 = flist_entry(td->io_u_freelist.next, struct io_u, list);
+	if (!io_u_rempty(&td->io_u_requeues))
+		io_u = io_u_rpop(&td->io_u_requeues);
+	else if (!io_u_qempty(&td->io_u_freelist))
+		io_u = io_u_qpop(&td->io_u_freelist);
 
+	if (io_u) {
 		io_u->buflen = 0;
 		io_u->resid = 0;
 		io_u->file = NULL;
@@ -1131,8 +1131,6 @@ again:
 
 		io_u->error = 0;
 		io_u->acct_ddir = -1;
-		flist_del(&io_u->list);
-		flist_add_tail(&io_u->list, &td->io_u_busylist);
 		td->cur_depth++;
 		io_u->flags |= IO_U_F_IN_CUR_DEPTH;
 	} else if (td->o.verify_async) {
io_u_queue.c new file +43 -0

43 lines not on this page · raw message

io_u_queue.h new file +75 -0

75 lines not on this page · raw message

ioengine.h +28 -27

85 lines not on this page · raw message

verify.c +3 -4
index 787cc37..b3cd402 100644
@@ -595,8 +595,7 @@ int verify_io_u_async(struct thread_data *td, struct io_u *io_u)
 		td->cur_depth--;
 		io_u->flags &= ~IO_U_F_IN_CUR_DEPTH;
 	}
-	flist_del(&io_u->list);
-	flist_add_tail(&io_u->list, &td->verify_list);
+	flist_add_tail(&io_u->verify_list, &td->verify_list);
 	io_u->flags |= IO_U_F_FREE_DEF;
 	pthread_mutex_unlock(&td->io_u_lock);
 
@@ -1052,8 +1051,8 @@ static void *verify_async_thread(void *data)
 			continue;
 
 		while (!flist_empty(&list)) {
-			io_u = flist_entry(list.next, struct io_u, list);
-			flist_del_init(&io_u->list);
+			io_u = flist_entry(list.next, struct io_u, verify_list);
+			flist_del(&io_u->verify_list);
 
 			ret = verify_io_u(td, io_u);
 			put_io_u(td, io_u);