All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop
@ 2011-07-20 21:11 Dan Ehrenberg
  2011-07-20 21:11 ` [PATCH 2/2] Libaio engine support for iodepth_batch_complete=0 Dan Ehrenberg
  2011-07-23 11:37 ` [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Ehrenberg @ 2011-07-20 21:11 UTC (permalink / raw)
  To: fio@vger.kernel.org, Jens Axboe; +Cc: Dan Ehrenberg

If the iodepth_batch_complete is 0, then even if the queue is full,
we still don't make min_events be 1 in the main loop. Instead, poll
in a non-blocking way until a result is found.

Signed-off-by: Dan Ehrenberg <dehrenberg@google.com>
---
 fio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fio.c b/fio.c
index 120431e..7396421 100644
--- a/fio.c
+++ b/fio.c
@@ -557,7 +557,7 @@ sync_done:
 		if (full || !td->o.iodepth_batch_complete) {
 			min_events = min(td->o.iodepth_batch_complete,
 					 td->cur_depth);
-			if (full && !min_events)
+			if (full && !min_events && td->o.iodepth_batch_complete != 0)
 				min_events = 1;
 
 			do {
@@ -719,7 +719,7 @@ sync_done:
 		if (full || !td->o.iodepth_batch_complete) {
 			min_evts = min(td->o.iodepth_batch_complete,
 					td->cur_depth);
-			if (full && !min_evts)
+			if (full && !min_evts && td->o.iodepth_batch_complete != 0)
 				min_evts = 1;
 
 			if (__should_check_rate(td, 0) ||
-- 
1.7.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Libaio engine support for iodepth_batch_complete=0
  2011-07-20 21:11 [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop Dan Ehrenberg
@ 2011-07-20 21:11 ` Dan Ehrenberg
  2011-07-23 11:37 ` [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Ehrenberg @ 2011-07-20 21:11 UTC (permalink / raw)
  To: fio@vger.kernel.org, Jens Axboe; +Cc: Dan Ehrenberg

Previously, even if iodepth_batch_complete=0, the libaio engine
passed in non-zero values for the min_nr value for io_getevents.
This patch makes min_nr always 0 if iodepth_batch_complete == 0,
and if multiple events are required at a higher level, then
we poll io_getevents multiple times for the events.

Signed-off-by: Dan Ehrenberg <dehrenberg@google.com>
---
 engines/libaio.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/engines/libaio.c b/engines/libaio.c
index 439cd24..c837ab6 100644
--- a/engines/libaio.c
+++ b/engines/libaio.c
@@ -62,22 +62,18 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
 				unsigned int max, struct timespec *t)
 {
 	struct libaio_data *ld = td->io_ops->data;
-	int r;
+	unsigned actual_min = td->o.iodepth_batch_complete == 0 ? 0 : min;
+	int r, events = 0;
 
 	do {
-		r = io_getevents(ld->aio_ctx, min, max, ld->aio_events, t);
-		if (r >= (int) min)
-			break;
-		else if (r == -EAGAIN) {
+		r = io_getevents(ld->aio_ctx, actual_min, max, ld->aio_events + events, t);
+		if (r >= 0)
+			events += r;
+		else if (r == -EAGAIN)
 			usleep(100);
-			continue;
-		} else if (r == -EINTR)
-			continue;
-		else if (r != 0)
-			break;
-	} while (1);
+	} while (events < min);
 
-	return r;
+	return r < 0 ? r : events;
 }
 
 static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
-- 
1.7.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop
  2011-07-20 21:11 [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop Dan Ehrenberg
  2011-07-20 21:11 ` [PATCH 2/2] Libaio engine support for iodepth_batch_complete=0 Dan Ehrenberg
@ 2011-07-23 11:37 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2011-07-23 11:37 UTC (permalink / raw)
  To: Dan Ehrenberg; +Cc: fio

On 2011-07-20 23:11, Dan Ehrenberg wrote:
> If the iodepth_batch_complete is 0, then even if the queue is full,
> we still don't make min_events be 1 in the main loop. Instead, poll
> in a non-blocking way until a result is found.

Thanks, applied 1+2.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-23 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20 21:11 [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop Dan Ehrenberg
2011-07-20 21:11 ` [PATCH 2/2] Libaio engine support for iodepth_batch_complete=0 Dan Ehrenberg
2011-07-23 11:37 ` [PATCH 1/2] Respect iodepth_batch_complete=0 in main loop Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.