For SCHED_ISO and SCHED_IDLEPRIO tasks where no ioprio is explicitly set:

Set ioprio to best priority normal class for SCHED_ISO tasks.

Set ioprio to idle class for SCHED_IDLEPRIO tasks. Note this means the
SCHED_IDLEPRIO tasks will also get idle usage of I/O by default meaning
no disk reads will be allowed when there is any I/O wait already occurring.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

---
 block/cfq-iosched.c    |    2 ++
 include/linux/ioprio.h |    6 ++++++
 2 files changed, 8 insertions(+)

Index: linux-2.6.22-rc4-ck1/include/linux/ioprio.h
===================================================================
--- linux-2.6.22-rc4-ck1.orig/include/linux/ioprio.h	2007-06-10 21:59:55.000000000 +1000
+++ linux-2.6.22-rc4-ck1/include/linux/ioprio.h	2007-06-10 21:59:55.000000000 +1000
@@ -56,6 +56,8 @@ static inline enum ioprio_class
 {
 	if (rt_task(task))
 		return IOPRIO_CLASS_RT;
+	if (idleprio_task(task))
+		return IOPRIO_CLASS_IDLE;
 	return IOPRIO_CLASS_BE;
 }
 
@@ -64,6 +66,10 @@ static inline int task_nice_ioprio(struc
 	if (rt_task(task))
 		return (MAX_RT_PRIO - task->rt_priority) * IOPRIO_BE_NR /
 			(MAX_RT_PRIO + 1);
+	if (iso_task(task))
+		return 0;
+	if (idleprio_task(task))
+		return IOPRIO_BE_NR - 1;
 	return (task_nice(task) + 20) / 5;
 }
 
Index: linux-2.6.22-rc4-ck1/block/cfq-iosched.c
===================================================================
--- linux-2.6.22-rc4-ck1.orig/block/cfq-iosched.c	2007-06-10 21:59:55.000000000 +1000
+++ linux-2.6.22-rc4-ck1/block/cfq-iosched.c	2007-06-10 21:59:55.000000000 +1000
@@ -1280,6 +1280,8 @@ static void cfq_init_prio_data(struct cf
 			 */
 			cfqq->ioprio_class = task_policy_ioprio_class(tsk);
 			cfqq->ioprio = task_nice_ioprio(tsk);
+			if (cfqq->ioprio_class == IOPRIO_CLASS_IDLE)
+				cfq_clear_cfqq_idle_window(cfqq);
 			break;
 		case IOPRIO_CLASS_RT:
 			cfqq->ioprio = task_ioprio(tsk);
