Skip to content

Commit b1dd2aa

Browse files
author
Christoph Hellwig
committed
scsi: set REQ_QUEUE for the blk-mq case
To generate the right SPI tag messages we need to properly set QUEUE_FLAG_QUEUED in the request_queue and mirror it to the request. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Jens Axboe <axboe@kernel.dk> Reported-by: Meelis Roos <mroos@linux.ee> Tested-by: Meelis Roos <mroos@linux.ee> Cc: stable@vger.kernel.org
1 parent e999dbc commit b1dd2aa

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎drivers/scsi/scsi_lib.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,11 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req,
18931893
blk_mq_start_request(req);
18941894
}
18951895

1896+
if (blk_queue_tagged(q))
1897+
req->cmd_flags |= REQ_QUEUED;
1898+
else
1899+
req->cmd_flags &= ~REQ_QUEUED;
1900+
18961901
scsi_init_cmd_errh(cmd);
18971902
cmd->scsi_done = scsi_mq_done;
18981903

‎include/scsi/scsi_tcq.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
6767
if (!sdev->tagged_supported)
6868
return;
6969

70-
if (!shost_use_blk_mq(sdev->host) &&
71-
!blk_queue_tagged(sdev->request_queue))
70+
if (shost_use_blk_mq(sdev->host))
71+
queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
72+
else if (!blk_queue_tagged(sdev->request_queue))
7273
blk_queue_init_tags(sdev->request_queue, depth,
7374
sdev->host->bqt);
7475

@@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
8182
**/
8283
static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
8384
{
84-
if (!shost_use_blk_mq(sdev->host) &&
85-
blk_queue_tagged(sdev->request_queue))
85+
if (blk_queue_tagged(sdev->request_queue))
8686
blk_queue_free_tags(sdev->request_queue);
8787
scsi_adjust_queue_depth(sdev, 0, depth);
8888
}

0 commit comments

Comments
 (0)