Fix problem with iodepth_batch_complete=0 and accounting
authorJens Axboe <axboe@kernel.dk>
Fri, 16 Mar 2012 12:55:50 +0000 (13:55 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 16 Mar 2012 12:55:50 +0000 (13:55 +0100)
If the queue is full, we always need to reap at least one event.
Otherwise we end up failing get_io_u() and restarting the file.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
io_u.c

index 7343286d53219b0c8d4e8a44ec586f1cd66ac6b8..a9885c6042f75e93a40bb073f2c215999c0d5eb6 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -494,7 +494,10 @@ sync_done:
                if (full || !td->o.iodepth_batch_complete) {
                        min_events = min(td->o.iodepth_batch_complete,
                                         td->cur_depth);
                if (full || !td->o.iodepth_batch_complete) {
                        min_events = min(td->o.iodepth_batch_complete,
                                         td->cur_depth);
-                       if (full && !min_events && td->o.iodepth_batch_complete != 0)
+                       /*
+                        * if the queue is full, we MUST reap at least 1 event
+                        */
+                       if (full && !min_events)
                                min_events = 1;
 
                        do {
                                min_events = 1;
 
                        do {
@@ -676,7 +679,10 @@ sync_done:
                if (full || !td->o.iodepth_batch_complete) {
                        min_evts = min(td->o.iodepth_batch_complete,
                                        td->cur_depth);
                if (full || !td->o.iodepth_batch_complete) {
                        min_evts = min(td->o.iodepth_batch_complete,
                                        td->cur_depth);
-                       if (full && !min_evts && td->o.iodepth_batch_complete != 0)
+                       /*
+                        * if the queue is full, we MUST reap at least 1 event
+                        */
+                       if (full && !min_evts)
                                min_evts = 1;
 
                        if (__should_check_rate(td, 0) ||
                                min_evts = 1;
 
                        if (__should_check_rate(td, 0) ||
diff --git a/io_u.c b/io_u.c
index 20794c38a88c5d9bea08d50f8865fe398576a235..ba6757993a403ee34b11a222317460c4818a9dd7 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -13,7 +13,6 @@
 
 struct io_completion_data {
        int nr;                         /* input */
 
 struct io_completion_data {
        int nr;                         /* input */
-       int account;                    /* input */
 
        int error;                      /* output */
        unsigned long bytes_done[2];    /* output */
 
        int error;                      /* output */
        unsigned long bytes_done[2];    /* output */
@@ -1293,9 +1292,6 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
 {
        unsigned long uninitialized_var(lusec);
 
 {
        unsigned long uninitialized_var(lusec);
 
-       if (!icd->account)
-               return;
-
        if (!td->o.disable_clat || !td->o.disable_bw)
                lusec = utime_since(&io_u->issue_time, &icd->time);
 
        if (!td->o.disable_clat || !td->o.disable_bw)
                lusec = utime_since(&io_u->issue_time, &icd->time);
 
@@ -1431,7 +1427,6 @@ static void init_icd(struct thread_data *td, struct io_completion_data *icd,
                fio_gettime(&icd->time, NULL);
 
        icd->nr = nr;
                fio_gettime(&icd->time, NULL);
 
        icd->nr = nr;
-       icd->account = 1;
 
        icd->error = 0;
        icd->bytes_done[0] = icd->bytes_done[1] = 0;
 
        icd->error = 0;
        icd->bytes_done[0] = icd->bytes_done[1] = 0;
@@ -1450,8 +1445,6 @@ static void ios_completed(struct thread_data *td,
 
                if (!(io_u->flags & IO_U_F_FREE_DEF))
                        put_io_u(td, io_u);
 
                if (!(io_u->flags & IO_U_F_FREE_DEF))
                        put_io_u(td, io_u);
-
-               icd->account = 0;
        }
 }
 
        }
 }