提交 67818d25 编写于 作者: T Tejun Heo 提交者: Jens Axboe

blk-mq: use blk_mq_rq_state() instead of testing REQ_ATOM_COMPLETE

blk_mq_check_inflight() and blk_mq_poll_hybrid_sleep() test
REQ_ATOM_COMPLETE to determine the request state.  Both uses are
speculative and we can test REQ_ATOM_STARTED and blk_mq_rq_state() for
equivalent results.  Replace the tests.  This will allow removing
REQ_ATOM_COMPLETE usages from blk-mq.
Signed-off-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 1d9bd516
...@@ -95,8 +95,7 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, ...@@ -95,8 +95,7 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx,
{ {
struct mq_inflight *mi = priv; struct mq_inflight *mi = priv;
if (test_bit(REQ_ATOM_STARTED, &rq->atomic_flags) && if (blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) {
!test_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags)) {
/* /*
* index[0] counts the specific partition that was asked * index[0] counts the specific partition that was asked
* for. index[1] counts the ones that are active on the * for. index[1] counts the ones that are active on the
...@@ -3024,7 +3023,8 @@ static bool blk_mq_poll_hybrid_sleep(struct request_queue *q, ...@@ -3024,7 +3023,8 @@ static bool blk_mq_poll_hybrid_sleep(struct request_queue *q,
hrtimer_init_sleeper(&hs, current); hrtimer_init_sleeper(&hs, current);
do { do {
if (test_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags)) if (test_bit(REQ_ATOM_STARTED, &rq->atomic_flags) &&
blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT)
break; break;
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
hrtimer_start_expires(&hs.timer, mode); hrtimer_start_expires(&hs.timer, mode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册