提交 e4f36b24 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

block: fix peeking requests during PM

We need to look for an active PM request until the next softbarrier
instead of looking for the first non-PM request.  Otherwise any cause
of request reordering might starve the PM request(s).
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 21e768b4
...@@ -2511,20 +2511,22 @@ void blk_account_io_done(struct request *req) ...@@ -2511,20 +2511,22 @@ void blk_account_io_done(struct request *req)
* Don't process normal requests when queue is suspended * Don't process normal requests when queue is suspended
* or in the process of suspending/resuming * or in the process of suspending/resuming
*/ */
static struct request *blk_pm_peek_request(struct request_queue *q, static bool blk_pm_allow_request(struct request *rq)
struct request *rq)
{ {
if (q->dev && (q->rpm_status == RPM_SUSPENDED || switch (rq->q->rpm_status) {
(q->rpm_status != RPM_ACTIVE && !(rq->rq_flags & RQF_PM)))) case RPM_RESUMING:
return NULL; case RPM_SUSPENDING:
else return rq->rq_flags & RQF_PM;
return rq; case RPM_SUSPENDED:
return false;
}
return true;
} }
#else #else
static inline struct request *blk_pm_peek_request(struct request_queue *q, static bool blk_pm_allow_request(struct request *rq)
struct request *rq)
{ {
return rq; return true;
} }
#endif #endif
...@@ -2572,9 +2574,12 @@ static struct request *elv_next_request(struct request_queue *q) ...@@ -2572,9 +2574,12 @@ static struct request *elv_next_request(struct request_queue *q)
WARN_ON_ONCE(q->mq_ops); WARN_ON_ONCE(q->mq_ops);
while (1) { while (1) {
if (!list_empty(&q->queue_head)) { list_for_each_entry(rq, &q->queue_head, queuelist) {
rq = list_entry_rq(q->queue_head.next); if (blk_pm_allow_request(rq))
return rq; return rq;
if (rq->rq_flags & RQF_SOFTBARRIER)
break;
} }
/* /*
...@@ -2625,10 +2630,6 @@ struct request *blk_peek_request(struct request_queue *q) ...@@ -2625,10 +2630,6 @@ struct request *blk_peek_request(struct request_queue *q)
WARN_ON_ONCE(q->mq_ops); WARN_ON_ONCE(q->mq_ops);
while ((rq = elv_next_request(q)) != NULL) { while ((rq = elv_next_request(q)) != NULL) {
rq = blk_pm_peek_request(q, rq);
if (!rq)
break;
if (!(rq->rq_flags & RQF_STARTED)) { if (!(rq->rq_flags & RQF_STARTED)) {
/* /*
* This is the first time the device driver * This is the first time the device driver
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册