diff options
| -rw-r--r-- | block/cfq-iosched.c | 4 | ||||
| -rw-r--r-- | include/linux/ioprio.h | 14 | 
2 files changed, 16 insertions, 2 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 7f909d2f488..b399c62936e 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c  | |||
| @@ -1303,10 +1303,10 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc) | |||
| 1303 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); | 1303 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); | 
| 1304 | case IOPRIO_CLASS_NONE: | 1304 | case IOPRIO_CLASS_NONE: | 
| 1305 | /* | 1305 | /* | 
| 1306 | * no prio set, place us in the middle of the BE classes | 1306 | * no prio set, inherit CPU scheduling settings | 
| 1307 | */ | 1307 | */ | 
| 1308 | cfqq->ioprio = task_nice_ioprio(tsk); | 1308 | cfqq->ioprio = task_nice_ioprio(tsk); | 
| 1309 | cfqq->ioprio_class = IOPRIO_CLASS_BE; | 1309 | cfqq->ioprio_class = task_nice_ioclass(tsk); | 
| 1310 | break; | 1310 | break; | 
| 1311 | case IOPRIO_CLASS_RT: | 1311 | case IOPRIO_CLASS_RT: | 
| 1312 | cfqq->ioprio = task_ioprio(ioc); | 1312 | cfqq->ioprio = task_ioprio(ioc); | 
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 2a3bb1bb743..f98a656b17e 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h  | |||
| @@ -68,6 +68,20 @@ static inline int task_nice_ioprio(struct task_struct *task) | |||
| 68 | } | 68 | } | 
| 69 | 69 | ||
| 70 | /* | 70 | /* | 
| 71 | * This is for the case where the task hasn't asked for a specific IO class. | ||
| 72 | * Check for idle and rt task process, and return appropriate IO class. | ||
| 73 | */ | ||
| 74 | static inline int task_nice_ioclass(struct task_struct *task) | ||
| 75 | { | ||
| 76 | if (task->policy == SCHED_IDLE) | ||
| 77 | return IOPRIO_CLASS_IDLE; | ||
| 78 | else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR) | ||
| 79 | return IOPRIO_CLASS_RT; | ||
| 80 | else | ||
| 81 | return IOPRIO_CLASS_BE; | ||
| 82 | } | ||
| 83 | |||
| 84 | /* | ||
| 71 | * For inheritance, return the highest of the two given priorities | 85 | * For inheritance, return the highest of the two given priorities | 
| 72 | */ | 86 | */ | 
| 73 | extern int ioprio_best(unsigned short aprio, unsigned short bprio); | 87 | extern int ioprio_best(unsigned short aprio, unsigned short bprio); | 
