@@ -146,7 +146,7 @@ struct cfq_queue {
146
146
147
147
/* io prio of this group */
148
148
unsigned short ioprio , org_ioprio ;
149
- unsigned short ioprio_class ;
149
+ unsigned short ioprio_class , org_ioprio_class ;
150
150
151
151
pid_t pid ;
152
152
@@ -3692,6 +3692,7 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct cfq_io_cq *cic)
3692
3692
* elevate the priority of this queue
3693
3693
*/
3694
3694
cfqq -> org_ioprio = cfqq -> ioprio ;
3695
+ cfqq -> org_ioprio_class = cfqq -> ioprio_class ;
3695
3696
cfq_clear_cfqq_prio_changed (cfqq );
3696
3697
}
3697
3698
@@ -4298,6 +4299,24 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
4298
4299
cfq_schedule_dispatch (cfqd );
4299
4300
}
4300
4301
4302
+ static void cfqq_boost_on_prio (struct cfq_queue * cfqq , int rw )
4303
+ {
4304
+ /*
4305
+ * If REQ_PRIO is set, boost class and prio level, if it's below
4306
+ * BE/NORM. If prio is not set, restore the potentially boosted
4307
+ * class/prio level.
4308
+ */
4309
+ if (!(rw & REQ_PRIO )) {
4310
+ cfqq -> ioprio_class = cfqq -> org_ioprio_class ;
4311
+ cfqq -> ioprio = cfqq -> org_ioprio ;
4312
+ } else {
4313
+ if (cfq_class_idle (cfqq ))
4314
+ cfqq -> ioprio_class = IOPRIO_CLASS_BE ;
4315
+ if (cfqq -> ioprio > IOPRIO_NORM )
4316
+ cfqq -> ioprio = IOPRIO_NORM ;
4317
+ }
4318
+ }
4319
+
4301
4320
static inline int __cfq_may_queue (struct cfq_queue * cfqq )
4302
4321
{
4303
4322
if (cfq_cfqq_wait_request (cfqq ) && !cfq_cfqq_must_alloc_slice (cfqq )) {
@@ -4328,6 +4347,7 @@ static int cfq_may_queue(struct request_queue *q, int rw)
4328
4347
cfqq = cic_to_cfqq (cic , rw_is_sync (rw ));
4329
4348
if (cfqq ) {
4330
4349
cfq_init_prio_data (cfqq , cic );
4350
+ cfqq_boost_on_prio (cfqq , rw );
4331
4351
4332
4352
return __cfq_may_queue (cfqq );
4333
4353
}
0 commit comments