History

block: remove QUEUE_FLAG_SCSI_PASSTHROUGH

Export scsi_device_from_queue for use with pktcdvd and use that instead of the otherwise unused QUEUE_FLAG_SCSI_PASSTHROUGH queue flag.

Christoph Hellwig committed 5 years ago

Commit 48450121 parent 4abafdc5 files · +12 −6Browse files

Unified · Split

5 files
  1. block/blk-mq-debugfs.c +0 −1
  2. drivers/block/pktcdvd.c +4 −1
  3. drivers/scsi/scsi_lib.c +8 −0
  4. drivers/scsi/scsi_scan.c +0 −1
  5. include/linux/blkdev.h +0 −3
block/blk-mq-debugfs.c+0−1
@@ -124,7 +124,6 @@ static const char *const blk_queue_flag_name[] = { · 123 unmodified lines
124124 QUEUE_FLAG_NAME(STATS),
125125 QUEUE_FLAG_NAME(POLL_STATS),
126126 QUEUE_FLAG_NAME(REGISTERED),
127− QUEUE_FLAG_NAME(SCSI_PASSTHROUGH),
128127 QUEUE_FLAG_NAME(QUIESCED),
129128 QUEUE_FLAG_NAME(PCI_P2PDMA),
130129 QUEUE_FLAG_NAME(ZONE_RESETALL),
drivers/block/pktcdvd.c+4−1
@@ -2536,6 +2536,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) · 2535 unmodified lines
25362536 int i;
25372537 char b[BDEVNAME_SIZE];
25382538 struct block_device *bdev;
2539+ struct scsi_device *sdev;
25392540
25402541 if (pd->pkt_dev == dev) {
25412542 pkt_err(pd, "recursive setup not allowed\n");
@@ -2559,10 +2560,12 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) · 17 unmodified lines
25592560 bdev = blkdev_get_by_dev(dev, FMODE_READ | FMODE_NDELAY, NULL);
25602561 if (IS_ERR(bdev))
25612562 return PTR_ERR(bdev);
2562− if (!blk_queue_scsi_passthrough(bdev_get_queue(bdev))) {
2563+ sdev = scsi_device_from_queue(bdev->bd_disk->queue);
2564+ if (!sdev) {
25632565 blkdev_put(bdev, FMODE_READ | FMODE_NDELAY);
25642566 return -EINVAL;
25652567 }
2568+ put_device(&sdev->sdev_gendev);
25662569
25672570 /* This is safe, since we have a reference from open(). */
25682571 __module_get(THIS_MODULE);
drivers/scsi/scsi_lib.c+8−0
@@ -1967,6 +1967,14 @@ struct scsi_device *scsi_device_from_queue(struct request_queue *q) · 1966 unmodified lines
19671967
19681968 return sdev;
19691969 }
1970+/*
1971+ * pktcdvd should have been integrated into the SCSI layers, but for historical
1972+ * reasons like the old IDE driver it isn't. This export allows it to safely
1973+ * probe if a given device is a SCSI one and only attach to that.
1974+ */
1975+#ifdef CONFIG_CDROM_PKTCDVD_MODULE
1976+EXPORT_SYMBOL_GPL(scsi_device_from_queue);
1977+#endif
19701978
19711979 /**
19721980 * scsi_block_requests - Utility function used by low-level drivers to prevent
drivers/scsi/scsi_scan.c+0−1
@@ -280,7 +280,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, · 279 unmodified lines
280280 sdev->request_queue = q;
281281 q->queuedata = sdev;
282282 __scsi_init_queue(sdev->host, q);
283− blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, q);
284283 WARN_ON_ONCE(!blk_get_queue(q));
285284
286285 depth = sdev->host->cmd_per_lun ?: 1;
include/linux/blkdev.h+0−3
@@ -357,7 +357,6 @@ struct request_queue { · 356 unmodified lines
357357 #define QUEUE_FLAG_STATS 20 /* track IO start and completion times */
358358 #define QUEUE_FLAG_POLL_STATS 21 /* collecting stats for hybrid polling */
359359 #define QUEUE_FLAG_REGISTERED 22 /* queue has been registered to a disk */
360−#define QUEUE_FLAG_SCSI_PASSTHROUGH 23 /* queue supports SCSI commands */
361360 #define QUEUE_FLAG_QUIESCED 24 /* queue has been quiesced */
362361 #define QUEUE_FLAG_PCI_P2PDMA 25 /* device supports PCI p2p requests */
363362 #define QUEUE_FLAG_ZONE_RESETALL 26 /* supports Zone Reset All */
@@ -391,8 +390,6 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct request_queue *q); · 27 unmodified lines
391390 #define blk_queue_secure_erase(q) \
392391 (test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags))
393392 #define blk_queue_dax(q) test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags)
394−#define blk_queue_scsi_passthrough(q) \
395− test_bit(QUEUE_FLAG_SCSI_PASSTHROUGH, &(q)->queue_flags)
396393 #define blk_queue_pci_p2pdma(q) \
397394 test_bit(QUEUE_FLAG_PCI_P2PDMA, &(q)->queue_flags)
398395 #ifdef CONFIG_BLK_RQ_ALLOC_TIME