[patch v2 8/8]block: fiops sync preempts async

From: Shaohua Li
Date: Mon Jan 30 2012 - 02:08:49 EST


Debug patch only.

This implements CFQ like sync preempts async. But like CFQ, this
will starve async.

---
block/fiops-iosched.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Index: linux/block/fiops-iosched.c
===================================================================
--- linux.orig/block/fiops-iosched.c 2012-01-21 10:35:04.000000000 +0800
+++ linux/block/fiops-iosched.c 2012-01-21 10:48:52.000000000 +0800
@@ -408,6 +408,21 @@ static struct fiops_ioc *fiops_select_io
return NULL;
}

+ /* Let sync request preempt async queue */
+ if (!rq_is_sync(rq) && service_tree->count > 1) {
+ struct rb_node *tmp = rb_next(&ioc->rb_node);
+ struct fiops_ioc *sync_ioc = NULL;
+ while (tmp) {
+ sync_ioc = rb_entry(tmp, struct fiops_ioc, rb_node);
+ rq = rq_entry_fifo(sync_ioc->fifo.next);
+ if (rq_is_sync(rq))
+ break;
+ tmp = rb_next(&sync_ioc->rb_node);
+ }
+ if (sync_ioc)
+ ioc = sync_ioc;
+ }
+
return ioc;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/