0001
0002 #ifndef _SCSI_SCSI_TCQ_H
0003 #define _SCSI_SCSI_TCQ_H
0004
0005 #include <linux/blkdev.h>
0006 #include <scsi/scsi_cmnd.h>
0007 #include <scsi/scsi_device.h>
0008 #include <scsi/scsi_host.h>
0009
0010 #define SCSI_NO_TAG (-1)
0011
0012
0013 #ifdef CONFIG_BLOCK
0014
0015
0016
0017
0018
0019
0020
0021
0022 static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
0023 int tag)
0024 {
0025 struct request *req = NULL;
0026 u16 hwq;
0027
0028 if (tag == SCSI_NO_TAG)
0029 return NULL;
0030
0031 hwq = blk_mq_unique_tag_to_hwq(tag);
0032 if (hwq < shost->tag_set.nr_hw_queues) {
0033 req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
0034 blk_mq_unique_tag_to_tag(tag));
0035 }
0036
0037 if (!req || !blk_mq_request_started(req))
0038 return NULL;
0039 return blk_mq_rq_to_pdu(req);
0040 }
0041
0042 #endif
0043 #endif