Skip to content

Commit

Permalink
scsi: set REQ_QUEUE for the blk-mq case
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Christoph Hellwig committed Oct 28, 2014
1 parent e999dbc commit b1dd2aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,11 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req,
blk_mq_start_request(req);
}

if (blk_queue_tagged(q))
req->cmd_flags |= REQ_QUEUED;
else
req->cmd_flags &= ~REQ_QUEUED;

scsi_init_cmd_errh(cmd);
cmd->scsi_done = scsi_mq_done;

Expand Down
8 changes: 4 additions & 4 deletions include/scsi/scsi_tcq.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
if (!sdev->tagged_supported)
return;

if (!shost_use_blk_mq(sdev->host) &&
!blk_queue_tagged(sdev->request_queue))
if (shost_use_blk_mq(sdev->host))
queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
else if (!blk_queue_tagged(sdev->request_queue))
blk_queue_init_tags(sdev->request_queue, depth,
sdev->host->bqt);

Expand All @@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
**/
static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
{
if (!shost_use_blk_mq(sdev->host) &&
blk_queue_tagged(sdev->request_queue))
if (blk_queue_tagged(sdev->request_queue))
blk_queue_free_tags(sdev->request_queue);
scsi_adjust_queue_depth(sdev, 0, depth);
}
Expand Down

0 comments on commit b1dd2aa

Please sign in to comment.