|
@@ -724,61 +724,28 @@ static void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx,
|
|
|
blk_mq_add_timer(rq);
|
|
|
}
|
|
|
|
|
|
-void blk_mq_insert_request(struct request_queue *q, struct request *rq,
|
|
|
- bool at_head, bool run_queue)
|
|
|
+void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue,
|
|
|
+ bool async)
|
|
|
{
|
|
|
+ struct request_queue *q = rq->q;
|
|
|
struct blk_mq_hw_ctx *hctx;
|
|
|
- struct blk_mq_ctx *ctx, *current_ctx;
|
|
|
+ struct blk_mq_ctx *ctx = rq->mq_ctx, *current_ctx;
|
|
|
+
|
|
|
+ current_ctx = blk_mq_get_ctx(q);
|
|
|
+ if (!cpu_online(ctx->cpu))
|
|
|
+ rq->mq_ctx = ctx = current_ctx;
|
|
|
|
|
|
- ctx = rq->mq_ctx;
|
|
|
hctx = q->mq_ops->map_queue(q, ctx->cpu);
|
|
|
|
|
|
- if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA)) {
|
|
|
+ if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA) &&
|
|
|
+ !(rq->cmd_flags & (REQ_FLUSH_SEQ))) {
|
|
|
blk_insert_flush(rq);
|
|
|
} else {
|
|
|
- current_ctx = blk_mq_get_ctx(q);
|
|
|
-
|
|
|
- if (!cpu_online(ctx->cpu)) {
|
|
|
- ctx = current_ctx;
|
|
|
- hctx = q->mq_ops->map_queue(q, ctx->cpu);
|
|
|
- rq->mq_ctx = ctx;
|
|
|
- }
|
|
|
spin_lock(&ctx->lock);
|
|
|
__blk_mq_insert_request(hctx, rq, at_head);
|
|
|
spin_unlock(&ctx->lock);
|
|
|
-
|
|
|
- blk_mq_put_ctx(current_ctx);
|
|
|
}
|
|
|
|
|
|
- if (run_queue)
|
|
|
- __blk_mq_run_hw_queue(hctx);
|
|
|
-}
|
|
|
-EXPORT_SYMBOL(blk_mq_insert_request);
|
|
|
-
|
|
|
-/*
|
|
|
- * This is a special version of blk_mq_insert_request to bypass FLUSH request
|
|
|
- * check. Should only be used internally.
|
|
|
- */
|
|
|
-void blk_mq_run_request(struct request *rq, bool run_queue, bool async)
|
|
|
-{
|
|
|
- struct request_queue *q = rq->q;
|
|
|
- struct blk_mq_hw_ctx *hctx;
|
|
|
- struct blk_mq_ctx *ctx, *current_ctx;
|
|
|
-
|
|
|
- current_ctx = blk_mq_get_ctx(q);
|
|
|
-
|
|
|
- ctx = rq->mq_ctx;
|
|
|
- if (!cpu_online(ctx->cpu)) {
|
|
|
- ctx = current_ctx;
|
|
|
- rq->mq_ctx = ctx;
|
|
|
- }
|
|
|
- hctx = q->mq_ops->map_queue(q, ctx->cpu);
|
|
|
-
|
|
|
- /* ctx->cpu might be offline */
|
|
|
- spin_lock(&ctx->lock);
|
|
|
- __blk_mq_insert_request(hctx, rq, false);
|
|
|
- spin_unlock(&ctx->lock);
|
|
|
-
|
|
|
blk_mq_put_ctx(current_ctx);
|
|
|
|
|
|
if (run_queue)
|