|
73 | 73 |
|
74 | 74 | #include "blk.h"
|
75 | 75 | #include "blk-mq.h"
|
| 76 | +#include "blk-mq-tag.h" |
76 | 77 |
|
77 | 78 | /* FLUSH/FUA sequences */
|
78 | 79 | enum {
|
@@ -226,7 +227,12 @@ static void flush_end_io(struct request *flush_rq, int error)
|
226 | 227 | struct blk_flush_queue *fq = blk_get_flush_queue(q, flush_rq->mq_ctx);
|
227 | 228 |
|
228 | 229 | if (q->mq_ops) {
|
| 230 | + struct blk_mq_hw_ctx *hctx; |
| 231 | + |
| 232 | + /* release the tag's ownership to the req cloned from */ |
229 | 233 | spin_lock_irqsave(&fq->mq_flush_lock, flags);
|
| 234 | + hctx = q->mq_ops->map_queue(q, flush_rq->mq_ctx->cpu); |
| 235 | + blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq); |
230 | 236 | flush_rq->tag = -1;
|
231 | 237 | }
|
232 | 238 |
|
@@ -308,11 +314,18 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq)
|
308 | 314 |
|
309 | 315 | /*
|
310 | 316 | * Borrow tag from the first request since they can't
|
311 |
| - * be in flight at the same time. |
| 317 | + * be in flight at the same time. And acquire the tag's |
| 318 | + * ownership for flush req. |
312 | 319 | */
|
313 | 320 | if (q->mq_ops) {
|
| 321 | + struct blk_mq_hw_ctx *hctx; |
| 322 | + |
314 | 323 | flush_rq->mq_ctx = first_rq->mq_ctx;
|
315 | 324 | flush_rq->tag = first_rq->tag;
|
| 325 | + fq->orig_rq = first_rq; |
| 326 | + |
| 327 | + hctx = q->mq_ops->map_queue(q, first_rq->mq_ctx->cpu); |
| 328 | + blk_mq_tag_set_rq(hctx, first_rq->tag, flush_rq); |
316 | 329 | }
|
317 | 330 |
|
318 | 331 | flush_rq->cmd_type = REQ_TYPE_FS;
|
|
0 commit comments