diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ahci.c | 1 | ||||
-rw-r--r-- | drivers/scsi/ata_piix.c | 1 | ||||
-rw-r--r-- | drivers/scsi/hosts.c | 9 | ||||
-rw-r--r-- | drivers/scsi/ide-scsi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 31 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 32 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_mv.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_nv.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_sil.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_sil24.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_sis.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_svw.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_sx4.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_uli.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_via.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sata_vsc.c | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 50 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 85 |
20 files changed, 103 insertions, 125 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 887eaa2a3ebf..d113290b5fc0 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -214,7 +214,6 @@ static struct scsi_host_template ahci_sht = { | |||
214 | .dma_boundary = AHCI_DMA_BOUNDARY, | 214 | .dma_boundary = AHCI_DMA_BOUNDARY, |
215 | .slave_configure = ata_scsi_slave_config, | 215 | .slave_configure = ata_scsi_slave_config, |
216 | .bios_param = ata_std_bios_param, | 216 | .bios_param = ata_std_bios_param, |
217 | .ordered_flush = 1, | ||
218 | }; | 217 | }; |
219 | 218 | ||
220 | static const struct ata_port_operations ahci_ops = { | 219 | static const struct ata_port_operations ahci_ops = { |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index f79630340028..557788ec4eec 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -187,7 +187,6 @@ static struct scsi_host_template piix_sht = { | |||
187 | .dma_boundary = ATA_DMA_BOUNDARY, | 187 | .dma_boundary = ATA_DMA_BOUNDARY, |
188 | .slave_configure = ata_scsi_slave_config, | 188 | .slave_configure = ata_scsi_slave_config, |
189 | .bios_param = ata_std_bios_param, | 189 | .bios_param = ata_std_bios_param, |
190 | .ordered_flush = 1, | ||
191 | .resume = ata_scsi_device_resume, | 190 | .resume = ata_scsi_device_resume, |
192 | .suspend = ata_scsi_device_suspend, | 191 | .suspend = ata_scsi_device_suspend, |
193 | }; | 192 | }; |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5b9c2c5a7f0e..66783c860a19 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -347,17 +347,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
347 | shost->cmd_per_lun = sht->cmd_per_lun; | 347 | shost->cmd_per_lun = sht->cmd_per_lun; |
348 | shost->unchecked_isa_dma = sht->unchecked_isa_dma; | 348 | shost->unchecked_isa_dma = sht->unchecked_isa_dma; |
349 | shost->use_clustering = sht->use_clustering; | 349 | shost->use_clustering = sht->use_clustering; |
350 | shost->ordered_flush = sht->ordered_flush; | ||
351 | shost->ordered_tag = sht->ordered_tag; | 350 | shost->ordered_tag = sht->ordered_tag; |
352 | 351 | ||
353 | /* | ||
354 | * hosts/devices that do queueing must support ordered tags | ||
355 | */ | ||
356 | if (shost->can_queue > 1 && shost->ordered_flush) { | ||
357 | printk(KERN_ERR "scsi: ordered flushes don't support queueing\n"); | ||
358 | shost->ordered_flush = 0; | ||
359 | } | ||
360 | |||
361 | if (sht->max_host_blocked) | 352 | if (sht->max_host_blocked) |
362 | shost->max_host_blocked = sht->max_host_blocked; | 353 | shost->max_host_blocked = sht->max_host_blocked; |
363 | else | 354 | else |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 4cb1f3ed9100..3c688ef54660 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -1046,7 +1046,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1046 | 1046 | ||
1047 | /* kill current request */ | 1047 | /* kill current request */ |
1048 | blkdev_dequeue_request(req); | 1048 | blkdev_dequeue_request(req); |
1049 | end_that_request_last(req); | 1049 | end_that_request_last(req, 0); |
1050 | if (req->flags & REQ_SENSE) | 1050 | if (req->flags & REQ_SENSE) |
1051 | kfree(scsi->pc->buffer); | 1051 | kfree(scsi->pc->buffer); |
1052 | kfree(scsi->pc); | 1052 | kfree(scsi->pc); |
@@ -1056,7 +1056,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
1056 | /* now nuke the drive queue */ | 1056 | /* now nuke the drive queue */ |
1057 | while ((req = elv_next_request(drive->queue))) { | 1057 | while ((req = elv_next_request(drive->queue))) { |
1058 | blkdev_dequeue_request(req); | 1058 | blkdev_dequeue_request(req); |
1059 | end_that_request_last(req); | 1059 | end_that_request_last(req, 0); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | HWGROUP(drive)->rq = NULL; | 1062 | HWGROUP(drive)->rq = NULL; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 9c66d4059399..f55b9b3f7b37 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -562,16 +562,28 @@ static const u8 ata_rw_cmds[] = { | |||
562 | ATA_CMD_WRITE_MULTI, | 562 | ATA_CMD_WRITE_MULTI, |
563 | ATA_CMD_READ_MULTI_EXT, | 563 | ATA_CMD_READ_MULTI_EXT, |
564 | ATA_CMD_WRITE_MULTI_EXT, | 564 | ATA_CMD_WRITE_MULTI_EXT, |
565 | 0, | ||
566 | 0, | ||
567 | 0, | ||
568 | ATA_CMD_WRITE_MULTI_FUA_EXT, | ||
565 | /* pio */ | 569 | /* pio */ |
566 | ATA_CMD_PIO_READ, | 570 | ATA_CMD_PIO_READ, |
567 | ATA_CMD_PIO_WRITE, | 571 | ATA_CMD_PIO_WRITE, |
568 | ATA_CMD_PIO_READ_EXT, | 572 | ATA_CMD_PIO_READ_EXT, |
569 | ATA_CMD_PIO_WRITE_EXT, | 573 | ATA_CMD_PIO_WRITE_EXT, |
574 | 0, | ||
575 | 0, | ||
576 | 0, | ||
577 | 0, | ||
570 | /* dma */ | 578 | /* dma */ |
571 | ATA_CMD_READ, | 579 | ATA_CMD_READ, |
572 | ATA_CMD_WRITE, | 580 | ATA_CMD_WRITE, |
573 | ATA_CMD_READ_EXT, | 581 | ATA_CMD_READ_EXT, |
574 | ATA_CMD_WRITE_EXT | 582 | ATA_CMD_WRITE_EXT, |
583 | 0, | ||
584 | 0, | ||
585 | 0, | ||
586 | ATA_CMD_WRITE_FUA_EXT | ||
575 | }; | 587 | }; |
576 | 588 | ||
577 | /** | 589 | /** |
@@ -584,25 +596,32 @@ static const u8 ata_rw_cmds[] = { | |||
584 | * LOCKING: | 596 | * LOCKING: |
585 | * caller. | 597 | * caller. |
586 | */ | 598 | */ |
587 | void ata_rwcmd_protocol(struct ata_queued_cmd *qc) | 599 | int ata_rwcmd_protocol(struct ata_queued_cmd *qc) |
588 | { | 600 | { |
589 | struct ata_taskfile *tf = &qc->tf; | 601 | struct ata_taskfile *tf = &qc->tf; |
590 | struct ata_device *dev = qc->dev; | 602 | struct ata_device *dev = qc->dev; |
603 | u8 cmd; | ||
591 | 604 | ||
592 | int index, lba48, write; | 605 | int index, fua, lba48, write; |
593 | 606 | ||
607 | fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0; | ||
594 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; | 608 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; |
595 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; | 609 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; |
596 | 610 | ||
597 | if (dev->flags & ATA_DFLAG_PIO) { | 611 | if (dev->flags & ATA_DFLAG_PIO) { |
598 | tf->protocol = ATA_PROT_PIO; | 612 | tf->protocol = ATA_PROT_PIO; |
599 | index = dev->multi_count ? 0 : 4; | 613 | index = dev->multi_count ? 0 : 8; |
600 | } else { | 614 | } else { |
601 | tf->protocol = ATA_PROT_DMA; | 615 | tf->protocol = ATA_PROT_DMA; |
602 | index = 8; | 616 | index = 16; |
603 | } | 617 | } |
604 | 618 | ||
605 | tf->command = ata_rw_cmds[index + lba48 + write]; | 619 | cmd = ata_rw_cmds[index + fua + lba48 + write]; |
620 | if (cmd) { | ||
621 | tf->command = cmd; | ||
622 | return 0; | ||
623 | } | ||
624 | return -1; | ||
606 | } | 625 | } |
607 | 626 | ||
608 | static const char * const xfer_mode_str[] = { | 627 | static const char * const xfer_mode_str[] = { |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index c1ebede14a48..cfbceb504718 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1096,11 +1096,13 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1096 | scsicmd[0] == WRITE_16) | 1096 | scsicmd[0] == WRITE_16) |
1097 | tf->flags |= ATA_TFLAG_WRITE; | 1097 | tf->flags |= ATA_TFLAG_WRITE; |
1098 | 1098 | ||
1099 | /* Calculate the SCSI LBA and transfer length. */ | 1099 | /* Calculate the SCSI LBA, transfer length and FUA. */ |
1100 | switch (scsicmd[0]) { | 1100 | switch (scsicmd[0]) { |
1101 | case READ_10: | 1101 | case READ_10: |
1102 | case WRITE_10: | 1102 | case WRITE_10: |
1103 | scsi_10_lba_len(scsicmd, &block, &n_block); | 1103 | scsi_10_lba_len(scsicmd, &block, &n_block); |
1104 | if (unlikely(scsicmd[1] & (1 << 3))) | ||
1105 | tf->flags |= ATA_TFLAG_FUA; | ||
1104 | break; | 1106 | break; |
1105 | case READ_6: | 1107 | case READ_6: |
1106 | case WRITE_6: | 1108 | case WRITE_6: |
@@ -1115,6 +1117,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1115 | case READ_16: | 1117 | case READ_16: |
1116 | case WRITE_16: | 1118 | case WRITE_16: |
1117 | scsi_16_lba_len(scsicmd, &block, &n_block); | 1119 | scsi_16_lba_len(scsicmd, &block, &n_block); |
1120 | if (unlikely(scsicmd[1] & (1 << 3))) | ||
1121 | tf->flags |= ATA_TFLAG_FUA; | ||
1118 | break; | 1122 | break; |
1119 | default: | 1123 | default: |
1120 | DPRINTK("no-byte command\n"); | 1124 | DPRINTK("no-byte command\n"); |
@@ -1158,7 +1162,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1158 | tf->device |= (block >> 24) & 0xf; | 1162 | tf->device |= (block >> 24) & 0xf; |
1159 | } | 1163 | } |
1160 | 1164 | ||
1161 | ata_rwcmd_protocol(qc); | 1165 | if (unlikely(ata_rwcmd_protocol(qc) < 0)) |
1166 | goto invalid_fld; | ||
1162 | 1167 | ||
1163 | qc->nsect = n_block; | 1168 | qc->nsect = n_block; |
1164 | tf->nsect = n_block & 0xff; | 1169 | tf->nsect = n_block & 0xff; |
@@ -1176,7 +1181,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1176 | if ((block >> 28) || (n_block > 256)) | 1181 | if ((block >> 28) || (n_block > 256)) |
1177 | goto out_of_range; | 1182 | goto out_of_range; |
1178 | 1183 | ||
1179 | ata_rwcmd_protocol(qc); | 1184 | if (unlikely(ata_rwcmd_protocol(qc) < 0)) |
1185 | goto invalid_fld; | ||
1180 | 1186 | ||
1181 | /* Convert LBA to CHS */ | 1187 | /* Convert LBA to CHS */ |
1182 | track = (u32)block / dev->sectors; | 1188 | track = (u32)block / dev->sectors; |
@@ -1711,6 +1717,7 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last) | |||
1711 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | 1717 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, |
1712 | unsigned int buflen) | 1718 | unsigned int buflen) |
1713 | { | 1719 | { |
1720 | struct ata_device *dev = args->dev; | ||
1714 | u8 *scsicmd = args->cmd->cmnd, *p, *last; | 1721 | u8 *scsicmd = args->cmd->cmnd, *p, *last; |
1715 | const u8 sat_blk_desc[] = { | 1722 | const u8 sat_blk_desc[] = { |
1716 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ | 1723 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ |
@@ -1719,6 +1726,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1719 | }; | 1726 | }; |
1720 | u8 pg, spg; | 1727 | u8 pg, spg; |
1721 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; | 1728 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; |
1729 | u8 dpofua; | ||
1722 | 1730 | ||
1723 | VPRINTK("ENTER\n"); | 1731 | VPRINTK("ENTER\n"); |
1724 | 1732 | ||
@@ -1787,9 +1795,17 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1787 | 1795 | ||
1788 | if (minlen < 1) | 1796 | if (minlen < 1) |
1789 | return 0; | 1797 | return 0; |
1798 | |||
1799 | dpofua = 0; | ||
1800 | if (ata_id_has_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && | ||
1801 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) | ||
1802 | dpofua = 1 << 4; | ||
1803 | |||
1790 | if (six_byte) { | 1804 | if (six_byte) { |
1791 | output_len--; | 1805 | output_len--; |
1792 | rbuf[0] = output_len; | 1806 | rbuf[0] = output_len; |
1807 | if (minlen > 2) | ||
1808 | rbuf[2] |= dpofua; | ||
1793 | if (ebd) { | 1809 | if (ebd) { |
1794 | if (minlen > 3) | 1810 | if (minlen > 3) |
1795 | rbuf[3] = sizeof(sat_blk_desc); | 1811 | rbuf[3] = sizeof(sat_blk_desc); |
@@ -1802,6 +1818,8 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1802 | rbuf[0] = output_len >> 8; | 1818 | rbuf[0] = output_len >> 8; |
1803 | if (minlen > 1) | 1819 | if (minlen > 1) |
1804 | rbuf[1] = output_len; | 1820 | rbuf[1] = output_len; |
1821 | if (minlen > 3) | ||
1822 | rbuf[3] |= dpofua; | ||
1805 | if (ebd) { | 1823 | if (ebd) { |
1806 | if (minlen > 7) | 1824 | if (minlen > 7) |
1807 | rbuf[7] = sizeof(sat_blk_desc); | 1825 | rbuf[7] = sizeof(sat_blk_desc); |
@@ -2462,7 +2480,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
2462 | if (xlat_func) | 2480 | if (xlat_func) |
2463 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); | 2481 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); |
2464 | else | 2482 | else |
2465 | ata_scsi_simulate(dev->id, cmd, done); | 2483 | ata_scsi_simulate(ap, dev, cmd, done); |
2466 | } else | 2484 | } else |
2467 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); | 2485 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); |
2468 | 2486 | ||
@@ -2485,14 +2503,16 @@ out_unlock: | |||
2485 | * spin_lock_irqsave(host_set lock) | 2503 | * spin_lock_irqsave(host_set lock) |
2486 | */ | 2504 | */ |
2487 | 2505 | ||
2488 | void ata_scsi_simulate(u16 *id, | 2506 | void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, |
2489 | struct scsi_cmnd *cmd, | 2507 | struct scsi_cmnd *cmd, |
2490 | void (*done)(struct scsi_cmnd *)) | 2508 | void (*done)(struct scsi_cmnd *)) |
2491 | { | 2509 | { |
2492 | struct ata_scsi_args args; | 2510 | struct ata_scsi_args args; |
2493 | const u8 *scsicmd = cmd->cmnd; | 2511 | const u8 *scsicmd = cmd->cmnd; |
2494 | 2512 | ||
2495 | args.id = id; | 2513 | args.ap = ap; |
2514 | args.dev = dev; | ||
2515 | args.id = dev->id; | ||
2496 | args.cmd = cmd; | 2516 | args.cmd = cmd; |
2497 | args.done = done; | 2517 | args.done = done; |
2498 | 2518 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 251e53bdc6e0..e03ce48b7b4b 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #define DRV_VERSION "1.20" /* must be exactly four chars */ | 32 | #define DRV_VERSION "1.20" /* must be exactly four chars */ |
33 | 33 | ||
34 | struct ata_scsi_args { | 34 | struct ata_scsi_args { |
35 | struct ata_port *ap; | ||
36 | struct ata_device *dev; | ||
35 | u16 *id; | 37 | u16 *id; |
36 | struct scsi_cmnd *cmd; | 38 | struct scsi_cmnd *cmd; |
37 | void (*done)(struct scsi_cmnd *); | 39 | void (*done)(struct scsi_cmnd *); |
@@ -41,7 +43,7 @@ struct ata_scsi_args { | |||
41 | extern int atapi_enabled; | 43 | extern int atapi_enabled; |
42 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 44 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
43 | struct ata_device *dev); | 45 | struct ata_device *dev); |
44 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
45 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 47 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
46 | extern int ata_qc_issue(struct ata_queued_cmd *qc); | 48 | extern int ata_qc_issue(struct ata_queued_cmd *qc); |
47 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 49 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index b2bf16a9bf4b..cd54244058b5 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -374,7 +374,6 @@ static struct scsi_host_template mv_sht = { | |||
374 | .dma_boundary = MV_DMA_BOUNDARY, | 374 | .dma_boundary = MV_DMA_BOUNDARY, |
375 | .slave_configure = ata_scsi_slave_config, | 375 | .slave_configure = ata_scsi_slave_config, |
376 | .bios_param = ata_std_bios_param, | 376 | .bios_param = ata_std_bios_param, |
377 | .ordered_flush = 1, | ||
378 | }; | 377 | }; |
379 | 378 | ||
380 | static const struct ata_port_operations mv5_ops = { | 379 | static const struct ata_port_operations mv5_ops = { |
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 4954896dfdb9..c0cf52cb975a 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -235,7 +235,6 @@ static struct scsi_host_template nv_sht = { | |||
235 | .dma_boundary = ATA_DMA_BOUNDARY, | 235 | .dma_boundary = ATA_DMA_BOUNDARY, |
236 | .slave_configure = ata_scsi_slave_config, | 236 | .slave_configure = ata_scsi_slave_config, |
237 | .bios_param = ata_std_bios_param, | 237 | .bios_param = ata_std_bios_param, |
238 | .ordered_flush = 1, | ||
239 | }; | 238 | }; |
240 | 239 | ||
241 | static const struct ata_port_operations nv_ops = { | 240 | static const struct ata_port_operations nv_ops = { |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index da7fa04b8a73..3d1ea09a06a1 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -114,7 +114,6 @@ static struct scsi_host_template pdc_ata_sht = { | |||
114 | .dma_boundary = ATA_DMA_BOUNDARY, | 114 | .dma_boundary = ATA_DMA_BOUNDARY, |
115 | .slave_configure = ata_scsi_slave_config, | 115 | .slave_configure = ata_scsi_slave_config, |
116 | .bios_param = ata_std_bios_param, | 116 | .bios_param = ata_std_bios_param, |
117 | .ordered_flush = 1, | ||
118 | }; | 117 | }; |
119 | 118 | ||
120 | static const struct ata_port_operations pdc_sata_ops = { | 119 | static const struct ata_port_operations pdc_sata_ops = { |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index d2053487c73b..b017f85e6d6a 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -147,7 +147,6 @@ static struct scsi_host_template sil_sht = { | |||
147 | .dma_boundary = ATA_DMA_BOUNDARY, | 147 | .dma_boundary = ATA_DMA_BOUNDARY, |
148 | .slave_configure = ata_scsi_slave_config, | 148 | .slave_configure = ata_scsi_slave_config, |
149 | .bios_param = ata_std_bios_param, | 149 | .bios_param = ata_std_bios_param, |
150 | .ordered_flush = 1, | ||
151 | }; | 150 | }; |
152 | 151 | ||
153 | static const struct ata_port_operations sil_ops = { | 152 | static const struct ata_port_operations sil_ops = { |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index a0ad3ed2200a..923130185a9e 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -292,7 +292,6 @@ static struct scsi_host_template sil24_sht = { | |||
292 | .dma_boundary = ATA_DMA_BOUNDARY, | 292 | .dma_boundary = ATA_DMA_BOUNDARY, |
293 | .slave_configure = ata_scsi_slave_config, | 293 | .slave_configure = ata_scsi_slave_config, |
294 | .bios_param = ata_std_bios_param, | 294 | .bios_param = ata_std_bios_param, |
295 | .ordered_flush = 1, /* NCQ not supported yet */ | ||
296 | }; | 295 | }; |
297 | 296 | ||
298 | static const struct ata_port_operations sil24_ops = { | 297 | static const struct ata_port_operations sil24_ops = { |
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 32e12620b162..2df8c5632ac3 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c | |||
@@ -99,7 +99,6 @@ static struct scsi_host_template sis_sht = { | |||
99 | .dma_boundary = ATA_DMA_BOUNDARY, | 99 | .dma_boundary = ATA_DMA_BOUNDARY, |
100 | .slave_configure = ata_scsi_slave_config, | 100 | .slave_configure = ata_scsi_slave_config, |
101 | .bios_param = ata_std_bios_param, | 101 | .bios_param = ata_std_bios_param, |
102 | .ordered_flush = 1, | ||
103 | }; | 102 | }; |
104 | 103 | ||
105 | static const struct ata_port_operations sis_ops = { | 104 | static const struct ata_port_operations sis_ops = { |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 6e7f7c83a75a..668373590aa4 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -303,7 +303,6 @@ static struct scsi_host_template k2_sata_sht = { | |||
303 | .proc_info = k2_sata_proc_info, | 303 | .proc_info = k2_sata_proc_info, |
304 | #endif | 304 | #endif |
305 | .bios_param = ata_std_bios_param, | 305 | .bios_param = ata_std_bios_param, |
306 | .ordered_flush = 1, | ||
307 | }; | 306 | }; |
308 | 307 | ||
309 | 308 | ||
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 94b253b80da8..bc87c16c80d2 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -194,7 +194,6 @@ static struct scsi_host_template pdc_sata_sht = { | |||
194 | .dma_boundary = ATA_DMA_BOUNDARY, | 194 | .dma_boundary = ATA_DMA_BOUNDARY, |
195 | .slave_configure = ata_scsi_slave_config, | 195 | .slave_configure = ata_scsi_slave_config, |
196 | .bios_param = ata_std_bios_param, | 196 | .bios_param = ata_std_bios_param, |
197 | .ordered_flush = 1, | ||
198 | }; | 197 | }; |
199 | 198 | ||
200 | static const struct ata_port_operations pdc_20621_ops = { | 199 | static const struct ata_port_operations pdc_20621_ops = { |
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index b2422a0f25c8..9635ca700977 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c | |||
@@ -87,7 +87,6 @@ static struct scsi_host_template uli_sht = { | |||
87 | .dma_boundary = ATA_DMA_BOUNDARY, | 87 | .dma_boundary = ATA_DMA_BOUNDARY, |
88 | .slave_configure = ata_scsi_slave_config, | 88 | .slave_configure = ata_scsi_slave_config, |
89 | .bios_param = ata_std_bios_param, | 89 | .bios_param = ata_std_bios_param, |
90 | .ordered_flush = 1, | ||
91 | }; | 90 | }; |
92 | 91 | ||
93 | static const struct ata_port_operations uli_ops = { | 92 | static const struct ata_port_operations uli_ops = { |
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index c76215692da2..6d5b0a794cfd 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c | |||
@@ -106,7 +106,6 @@ static struct scsi_host_template svia_sht = { | |||
106 | .dma_boundary = ATA_DMA_BOUNDARY, | 106 | .dma_boundary = ATA_DMA_BOUNDARY, |
107 | .slave_configure = ata_scsi_slave_config, | 107 | .slave_configure = ata_scsi_slave_config, |
108 | .bios_param = ata_std_bios_param, | 108 | .bios_param = ata_std_bios_param, |
109 | .ordered_flush = 1, | ||
110 | }; | 109 | }; |
111 | 110 | ||
112 | static const struct ata_port_operations svia_sata_ops = { | 111 | static const struct ata_port_operations svia_sata_ops = { |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index fcfa486965b4..2e2c3b7acb0c 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -235,7 +235,6 @@ static struct scsi_host_template vsc_sata_sht = { | |||
235 | .dma_boundary = ATA_DMA_BOUNDARY, | 235 | .dma_boundary = ATA_DMA_BOUNDARY, |
236 | .slave_configure = ata_scsi_slave_config, | 236 | .slave_configure = ata_scsi_slave_config, |
237 | .bios_param = ata_std_bios_param, | 237 | .bios_param = ata_std_bios_param, |
238 | .ordered_flush = 1, | ||
239 | }; | 238 | }; |
240 | 239 | ||
241 | 240 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a7f3f0c84db7..ba93d6e66d48 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -308,7 +308,7 @@ struct scsi_io_context { | |||
308 | 308 | ||
309 | static kmem_cache_t *scsi_io_context_cache; | 309 | static kmem_cache_t *scsi_io_context_cache; |
310 | 310 | ||
311 | static void scsi_end_async(struct request *req) | 311 | static void scsi_end_async(struct request *req, int uptodate) |
312 | { | 312 | { |
313 | struct scsi_io_context *sioc = req->end_io_data; | 313 | struct scsi_io_context *sioc = req->end_io_data; |
314 | 314 | ||
@@ -791,7 +791,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate, | |||
791 | spin_lock_irqsave(q->queue_lock, flags); | 791 | spin_lock_irqsave(q->queue_lock, flags); |
792 | if (blk_rq_tagged(req)) | 792 | if (blk_rq_tagged(req)) |
793 | blk_queue_end_tag(q, req); | 793 | blk_queue_end_tag(q, req); |
794 | end_that_request_last(req); | 794 | end_that_request_last(req, uptodate); |
795 | spin_unlock_irqrestore(q->queue_lock, flags); | 795 | spin_unlock_irqrestore(q->queue_lock, flags); |
796 | 796 | ||
797 | /* | 797 | /* |
@@ -932,9 +932,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes, | |||
932 | int sense_valid = 0; | 932 | int sense_valid = 0; |
933 | int sense_deferred = 0; | 933 | int sense_deferred = 0; |
934 | 934 | ||
935 | if (blk_complete_barrier_rq(q, req, good_bytes >> 9)) | ||
936 | return; | ||
937 | |||
938 | /* | 935 | /* |
939 | * Free up any indirection buffers we allocated for DMA purposes. | 936 | * Free up any indirection buffers we allocated for DMA purposes. |
940 | * For the case of a READ, we need to copy the data out of the | 937 | * For the case of a READ, we need to copy the data out of the |
@@ -1199,38 +1196,6 @@ static int scsi_init_io(struct scsi_cmnd *cmd) | |||
1199 | return BLKPREP_KILL; | 1196 | return BLKPREP_KILL; |
1200 | } | 1197 | } |
1201 | 1198 | ||
1202 | static int scsi_prepare_flush_fn(request_queue_t *q, struct request *rq) | ||
1203 | { | ||
1204 | struct scsi_device *sdev = q->queuedata; | ||
1205 | struct scsi_driver *drv; | ||
1206 | |||
1207 | if (sdev->sdev_state == SDEV_RUNNING) { | ||
1208 | drv = *(struct scsi_driver **) rq->rq_disk->private_data; | ||
1209 | |||
1210 | if (drv->prepare_flush) | ||
1211 | return drv->prepare_flush(q, rq); | ||
1212 | } | ||
1213 | |||
1214 | return 0; | ||
1215 | } | ||
1216 | |||
1217 | static void scsi_end_flush_fn(request_queue_t *q, struct request *rq) | ||
1218 | { | ||
1219 | struct scsi_device *sdev = q->queuedata; | ||
1220 | struct request *flush_rq = rq->end_io_data; | ||
1221 | struct scsi_driver *drv; | ||
1222 | |||
1223 | if (flush_rq->errors) { | ||
1224 | printk("scsi: barrier error, disabling flush support\n"); | ||
1225 | blk_queue_ordered(q, QUEUE_ORDERED_NONE); | ||
1226 | } | ||
1227 | |||
1228 | if (sdev->sdev_state == SDEV_RUNNING) { | ||
1229 | drv = *(struct scsi_driver **) rq->rq_disk->private_data; | ||
1230 | drv->end_flush(q, rq); | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, | 1199 | static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, |
1235 | sector_t *error_sector) | 1200 | sector_t *error_sector) |
1236 | { | 1201 | { |
@@ -1703,17 +1668,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) | |||
1703 | blk_queue_segment_boundary(q, shost->dma_boundary); | 1668 | blk_queue_segment_boundary(q, shost->dma_boundary); |
1704 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); | 1669 | blk_queue_issue_flush_fn(q, scsi_issue_flush_fn); |
1705 | 1670 | ||
1706 | /* | ||
1707 | * ordered tags are superior to flush ordering | ||
1708 | */ | ||
1709 | if (shost->ordered_tag) | ||
1710 | blk_queue_ordered(q, QUEUE_ORDERED_TAG); | ||
1711 | else if (shost->ordered_flush) { | ||
1712 | blk_queue_ordered(q, QUEUE_ORDERED_FLUSH); | ||
1713 | q->prepare_flush_fn = scsi_prepare_flush_fn; | ||
1714 | q->end_flush_fn = scsi_end_flush_fn; | ||
1715 | } | ||
1716 | |||
1717 | if (!shost->use_clustering) | 1671 | if (!shost->use_clustering) |
1718 | clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 1672 | clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); |
1719 | return q; | 1673 | return q; |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3d3ad7d1b779..32d4d8d7b9f3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -102,6 +102,7 @@ struct scsi_disk { | |||
102 | u8 write_prot; | 102 | u8 write_prot; |
103 | unsigned WCE : 1; /* state of disk WCE bit */ | 103 | unsigned WCE : 1; /* state of disk WCE bit */ |
104 | unsigned RCD : 1; /* state of disk RCD bit, unused */ | 104 | unsigned RCD : 1; /* state of disk RCD bit, unused */ |
105 | unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | static DEFINE_IDR(sd_index_idr); | 108 | static DEFINE_IDR(sd_index_idr); |
@@ -121,8 +122,7 @@ static void sd_shutdown(struct device *dev); | |||
121 | static void sd_rescan(struct device *); | 122 | static void sd_rescan(struct device *); |
122 | static int sd_init_command(struct scsi_cmnd *); | 123 | static int sd_init_command(struct scsi_cmnd *); |
123 | static int sd_issue_flush(struct device *, sector_t *); | 124 | static int sd_issue_flush(struct device *, sector_t *); |
124 | static void sd_end_flush(request_queue_t *, struct request *); | 125 | static void sd_prepare_flush(request_queue_t *, struct request *); |
125 | static int sd_prepare_flush(request_queue_t *, struct request *); | ||
126 | static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname, | 126 | static void sd_read_capacity(struct scsi_disk *sdkp, char *diskname, |
127 | unsigned char *buffer); | 127 | unsigned char *buffer); |
128 | 128 | ||
@@ -137,8 +137,6 @@ static struct scsi_driver sd_template = { | |||
137 | .rescan = sd_rescan, | 137 | .rescan = sd_rescan, |
138 | .init_command = sd_init_command, | 138 | .init_command = sd_init_command, |
139 | .issue_flush = sd_issue_flush, | 139 | .issue_flush = sd_issue_flush, |
140 | .prepare_flush = sd_prepare_flush, | ||
141 | .end_flush = sd_end_flush, | ||
142 | }; | 140 | }; |
143 | 141 | ||
144 | /* | 142 | /* |
@@ -346,6 +344,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
346 | 344 | ||
347 | if (block > 0xffffffff) { | 345 | if (block > 0xffffffff) { |
348 | SCpnt->cmnd[0] += READ_16 - READ_6; | 346 | SCpnt->cmnd[0] += READ_16 - READ_6; |
347 | SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0; | ||
349 | SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; | 348 | SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; |
350 | SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; | 349 | SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; |
351 | SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; | 350 | SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; |
@@ -365,6 +364,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
365 | this_count = 0xffff; | 364 | this_count = 0xffff; |
366 | 365 | ||
367 | SCpnt->cmnd[0] += READ_10 - READ_6; | 366 | SCpnt->cmnd[0] += READ_10 - READ_6; |
367 | SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0; | ||
368 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; | 368 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; |
369 | SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; | 369 | SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; |
370 | SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; | 370 | SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; |
@@ -373,6 +373,17 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
373 | SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; | 373 | SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; |
374 | SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; | 374 | SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; |
375 | } else { | 375 | } else { |
376 | if (unlikely(blk_fua_rq(rq))) { | ||
377 | /* | ||
378 | * This happens only if this drive failed | ||
379 | * 10byte rw command with ILLEGAL_REQUEST | ||
380 | * during operation and thus turned off | ||
381 | * use_10_for_rw. | ||
382 | */ | ||
383 | printk(KERN_ERR "sd: FUA write on READ/WRITE(6) drive\n"); | ||
384 | return 0; | ||
385 | } | ||
386 | |||
376 | SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); | 387 | SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); |
377 | SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); | 388 | SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); |
378 | SCpnt->cmnd[3] = (unsigned char) block & 0xff; | 389 | SCpnt->cmnd[3] = (unsigned char) block & 0xff; |
@@ -729,42 +740,13 @@ static int sd_issue_flush(struct device *dev, sector_t *error_sector) | |||
729 | return ret; | 740 | return ret; |
730 | } | 741 | } |
731 | 742 | ||
732 | static void sd_end_flush(request_queue_t *q, struct request *flush_rq) | 743 | static void sd_prepare_flush(request_queue_t *q, struct request *rq) |
733 | { | ||
734 | struct request *rq = flush_rq->end_io_data; | ||
735 | struct scsi_cmnd *cmd = rq->special; | ||
736 | unsigned int bytes = rq->hard_nr_sectors << 9; | ||
737 | |||
738 | if (!flush_rq->errors) { | ||
739 | spin_unlock(q->queue_lock); | ||
740 | scsi_io_completion(cmd, bytes, 0); | ||
741 | spin_lock(q->queue_lock); | ||
742 | } else if (blk_barrier_postflush(rq)) { | ||
743 | spin_unlock(q->queue_lock); | ||
744 | scsi_io_completion(cmd, 0, bytes); | ||
745 | spin_lock(q->queue_lock); | ||
746 | } else { | ||
747 | /* | ||
748 | * force journal abort of barriers | ||
749 | */ | ||
750 | end_that_request_first(rq, -EOPNOTSUPP, rq->hard_nr_sectors); | ||
751 | end_that_request_last(rq); | ||
752 | } | ||
753 | } | ||
754 | |||
755 | static int sd_prepare_flush(request_queue_t *q, struct request *rq) | ||
756 | { | 744 | { |
757 | struct scsi_device *sdev = q->queuedata; | ||
758 | struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev); | ||
759 | |||
760 | if (!sdkp || !sdkp->WCE) | ||
761 | return 0; | ||
762 | |||
763 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 745 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
764 | rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; | 746 | rq->flags |= REQ_BLOCK_PC; |
765 | rq->timeout = SD_TIMEOUT; | 747 | rq->timeout = SD_TIMEOUT; |
766 | rq->cmd[0] = SYNCHRONIZE_CACHE; | 748 | rq->cmd[0] = SYNCHRONIZE_CACHE; |
767 | return 1; | 749 | rq->cmd_len = 10; |
768 | } | 750 | } |
769 | 751 | ||
770 | static void sd_rescan(struct device *dev) | 752 | static void sd_rescan(struct device *dev) |
@@ -1427,10 +1409,18 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, | |||
1427 | sdkp->RCD = 0; | 1409 | sdkp->RCD = 0; |
1428 | } | 1410 | } |
1429 | 1411 | ||
1412 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; | ||
1413 | if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | ||
1414 | printk(KERN_NOTICE "SCSI device %s: uses " | ||
1415 | "READ/WRITE(6), disabling FUA\n", diskname); | ||
1416 | sdkp->DPOFUA = 0; | ||
1417 | } | ||
1418 | |||
1430 | ct = sdkp->RCD + 2*sdkp->WCE; | 1419 | ct = sdkp->RCD + 2*sdkp->WCE; |
1431 | 1420 | ||
1432 | printk(KERN_NOTICE "SCSI device %s: drive cache: %s\n", | 1421 | printk(KERN_NOTICE "SCSI device %s: drive cache: %s%s\n", |
1433 | diskname, types[ct]); | 1422 | diskname, types[ct], |
1423 | sdkp->DPOFUA ? " w/ FUA" : ""); | ||
1434 | 1424 | ||
1435 | return; | 1425 | return; |
1436 | } | 1426 | } |
@@ -1462,6 +1452,7 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1462 | struct scsi_disk *sdkp = scsi_disk(disk); | 1452 | struct scsi_disk *sdkp = scsi_disk(disk); |
1463 | struct scsi_device *sdp = sdkp->device; | 1453 | struct scsi_device *sdp = sdkp->device; |
1464 | unsigned char *buffer; | 1454 | unsigned char *buffer; |
1455 | unsigned ordered; | ||
1465 | 1456 | ||
1466 | SCSI_LOG_HLQUEUE(3, printk("sd_revalidate_disk: disk=%s\n", disk->disk_name)); | 1457 | SCSI_LOG_HLQUEUE(3, printk("sd_revalidate_disk: disk=%s\n", disk->disk_name)); |
1467 | 1458 | ||
@@ -1498,7 +1489,21 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
1498 | sd_read_write_protect_flag(sdkp, disk->disk_name, buffer); | 1489 | sd_read_write_protect_flag(sdkp, disk->disk_name, buffer); |
1499 | sd_read_cache_type(sdkp, disk->disk_name, buffer); | 1490 | sd_read_cache_type(sdkp, disk->disk_name, buffer); |
1500 | } | 1491 | } |
1501 | 1492 | ||
1493 | /* | ||
1494 | * We now have all cache related info, determine how we deal | ||
1495 | * with ordered requests. Note that as the current SCSI | ||
1496 | * dispatch function can alter request order, we cannot use | ||
1497 | * QUEUE_ORDERED_TAG_* even when ordered tag is supported. | ||
1498 | */ | ||
1499 | if (sdkp->WCE) | ||
1500 | ordered = sdkp->DPOFUA | ||
1501 | ? QUEUE_ORDERED_DRAIN_FUA : QUEUE_ORDERED_DRAIN_FLUSH; | ||
1502 | else | ||
1503 | ordered = QUEUE_ORDERED_DRAIN; | ||
1504 | |||
1505 | blk_queue_ordered(sdkp->disk->queue, ordered, sd_prepare_flush); | ||
1506 | |||
1502 | set_capacity(disk, sdkp->capacity); | 1507 | set_capacity(disk, sdkp->capacity); |
1503 | kfree(buffer); | 1508 | kfree(buffer); |
1504 | 1509 | ||
@@ -1598,6 +1603,7 @@ static int sd_probe(struct device *dev) | |||
1598 | strcpy(gd->devfs_name, sdp->devfs_name); | 1603 | strcpy(gd->devfs_name, sdp->devfs_name); |
1599 | 1604 | ||
1600 | gd->private_data = &sdkp->driver; | 1605 | gd->private_data = &sdkp->driver; |
1606 | gd->queue = sdkp->device->request_queue; | ||
1601 | 1607 | ||
1602 | sd_revalidate_disk(gd); | 1608 | sd_revalidate_disk(gd); |
1603 | 1609 | ||
@@ -1605,7 +1611,6 @@ static int sd_probe(struct device *dev) | |||
1605 | gd->flags = GENHD_FL_DRIVERFS; | 1611 | gd->flags = GENHD_FL_DRIVERFS; |
1606 | if (sdp->removable) | 1612 | if (sdp->removable) |
1607 | gd->flags |= GENHD_FL_REMOVABLE; | 1613 | gd->flags |= GENHD_FL_REMOVABLE; |
1608 | gd->queue = sdkp->device->request_queue; | ||
1609 | 1614 | ||
1610 | dev_set_drvdata(dev, sdkp); | 1615 | dev_set_drvdata(dev, sdkp); |
1611 | add_disk(gd); | 1616 | add_disk(gd); |