diff options
-rw-r--r-- | drivers/message/i2o/i2o_scsi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/constants.c | 12 | ||||
-rw-r--r-- | drivers/scsi/gdth.c | 8 | ||||
-rw-r--r-- | drivers/scsi/ipr.c | 1 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 2 | ||||
-rw-r--r-- | drivers/scsi/qlogicpti.c | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi.c | 157 | ||||
-rw-r--r-- | drivers/scsi/scsi.h | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi_error.c | 12 | ||||
-rw-r--r-- | drivers/scsi/scsi_ioctl.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 80 | ||||
-rw-r--r-- | drivers/scsi/scsi_priv.h | 10 | ||||
-rw-r--r-- | drivers/scsi/scsi_scan.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_typedefs.h | 1 | ||||
-rw-r--r-- | include/scsi/scsi_cmnd.h | 6 | ||||
-rw-r--r-- | include/scsi/scsi_dbg.h | 2 | ||||
-rw-r--r-- | include/scsi/scsi_eh.h | 3 | ||||
-rw-r--r-- | include/scsi/scsi_request.h | 54 | ||||
-rw-r--r-- | include/scsi/sg_request.h | 26 |
19 files changed, 14 insertions, 370 deletions
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index c08ddac3717d..6ebf38213f9f 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c | |||
@@ -65,9 +65,7 @@ | |||
65 | #include <scsi/scsi_host.h> | 65 | #include <scsi/scsi_host.h> |
66 | #include <scsi/scsi_device.h> | 66 | #include <scsi/scsi_device.h> |
67 | #include <scsi/scsi_cmnd.h> | 67 | #include <scsi/scsi_cmnd.h> |
68 | #include <scsi/scsi_request.h> | ||
69 | #include <scsi/sg.h> | 68 | #include <scsi/sg.h> |
70 | #include <scsi/sg_request.h> | ||
71 | 69 | ||
72 | #define OSM_NAME "scsi-osm" | 70 | #define OSM_NAME "scsi-osm" |
73 | #define OSM_VERSION "1.316" | 71 | #define OSM_VERSION "1.316" |
@@ -588,6 +586,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
588 | 586 | ||
589 | mptr = &msg->body[0]; | 587 | mptr = &msg->body[0]; |
590 | 588 | ||
589 | #if 0 /* this code can't work */ | ||
591 | #ifdef CONFIG_I2O_EXT_ADAPTEC | 590 | #ifdef CONFIG_I2O_EXT_ADAPTEC |
592 | if (c->adaptec) { | 591 | if (c->adaptec) { |
593 | u32 adpt_flags = 0; | 592 | u32 adpt_flags = 0; |
@@ -625,6 +624,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
625 | *mptr++ = cpu_to_le32(adpt_flags | tid); | 624 | *mptr++ = cpu_to_le32(adpt_flags | tid); |
626 | } | 625 | } |
627 | #endif | 626 | #endif |
627 | #endif | ||
628 | 628 | ||
629 | msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid); | 629 | msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid); |
630 | msg->u.s.icntxt = cpu_to_le32(i2o_scsi_driver.context); | 630 | msg->u.s.icntxt = cpu_to_le32(i2o_scsi_driver.context); |
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index e24835b38b54..d92d5040a9fe 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c | |||
@@ -13,9 +13,9 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | 14 | ||
15 | #include <scsi/scsi.h> | 15 | #include <scsi/scsi.h> |
16 | #include <scsi/scsi_cmnd.h> | ||
16 | #include <scsi/scsi_device.h> | 17 | #include <scsi/scsi_device.h> |
17 | #include <scsi/scsi_host.h> | 18 | #include <scsi/scsi_host.h> |
18 | #include <scsi/scsi_request.h> | ||
19 | #include <scsi/scsi_eh.h> | 19 | #include <scsi/scsi_eh.h> |
20 | #include <scsi/scsi_dbg.h> | 20 | #include <scsi/scsi_dbg.h> |
21 | 21 | ||
@@ -1261,16 +1261,6 @@ void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd) | |||
1261 | } | 1261 | } |
1262 | EXPORT_SYMBOL(scsi_print_sense); | 1262 | EXPORT_SYMBOL(scsi_print_sense); |
1263 | 1263 | ||
1264 | void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) | ||
1265 | { | ||
1266 | const char *name = devclass; | ||
1267 | |||
1268 | if (sreq->sr_request->rq_disk) | ||
1269 | name = sreq->sr_request->rq_disk->disk_name; | ||
1270 | __scsi_print_sense(name, sreq->sr_sense_buffer, SCSI_SENSE_BUFFERSIZE); | ||
1271 | } | ||
1272 | EXPORT_SYMBOL(scsi_print_req_sense); | ||
1273 | |||
1274 | void scsi_print_command(struct scsi_cmnd *cmd) | 1264 | void scsi_print_command(struct scsi_cmnd *cmd) |
1275 | { | 1265 | { |
1276 | /* Assume appended output (i.e. not at start of line) */ | 1266 | /* Assume appended output (i.e. not at start of line) */ |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index fc4d9f61cf3d..76071a158306 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -716,8 +716,8 @@ static void gdth_scsi_done(struct scsi_cmnd *scp) | |||
716 | { | 716 | { |
717 | TRACE2(("gdth_scsi_done()\n")); | 717 | TRACE2(("gdth_scsi_done()\n")); |
718 | 718 | ||
719 | if (scp->sc_request) | 719 | if (scp->request) |
720 | complete((struct completion *)scp->sc_request); | 720 | complete((struct completion *)scp->request); |
721 | } | 721 | } |
722 | 722 | ||
723 | int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | 723 | int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, |
@@ -732,8 +732,8 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
732 | return -ENOMEM; | 732 | return -ENOMEM; |
733 | memset(scp, 0, sizeof(*scp)); | 733 | memset(scp, 0, sizeof(*scp)); |
734 | scp->device = sdev; | 734 | scp->device = sdev; |
735 | /* use sc_request field to save the ptr. to completion struct. */ | 735 | /* use request field to save the ptr. to completion struct. */ |
736 | scp->sc_request = (struct scsi_request *)&wait; | 736 | scp->request = (struct request *)&wait; |
737 | scp->timeout_per_command = timeout*HZ; | 737 | scp->timeout_per_command = timeout*HZ; |
738 | scp->request_buffer = gdtcmd; | 738 | scp->request_buffer = gdtcmd; |
739 | scp->cmd_len = 12; | 739 | scp->cmd_len = 12; |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 8b80e59c8c52..96b65b307dd0 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -79,7 +79,6 @@ | |||
79 | #include <scsi/scsi_tcq.h> | 79 | #include <scsi/scsi_tcq.h> |
80 | #include <scsi/scsi_eh.h> | 80 | #include <scsi/scsi_eh.h> |
81 | #include <scsi/scsi_cmnd.h> | 81 | #include <scsi/scsi_cmnd.h> |
82 | #include <scsi/scsi_request.h> | ||
83 | #include "ipr.h" | 82 | #include "ipr.h" |
84 | 83 | ||
85 | /* | 84 | /* |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 994015726ec8..f1e129b7c972 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -38,9 +38,9 @@ | |||
38 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
39 | #include <scsi/scsi.h> | 39 | #include <scsi/scsi.h> |
40 | #include <scsi/scsi_host.h> | 40 | #include <scsi/scsi_host.h> |
41 | #include <scsi/scsi_cmnd.h> | ||
41 | #include <scsi/scsi_eh.h> | 42 | #include <scsi/scsi_eh.h> |
42 | #include <scsi/scsi_device.h> | 43 | #include <scsi/scsi_device.h> |
43 | #include <scsi/scsi_request.h> | ||
44 | #include <scsi/scsi_transport.h> | 44 | #include <scsi/scsi_transport.h> |
45 | #include <linux/libata.h> | 45 | #include <linux/libata.h> |
46 | #include <linux/hdreg.h> | 46 | #include <linux/hdreg.h> |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 00f4b846360e..417a121fcd42 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <scsi/scsi_cmnd.h> | 43 | #include <scsi/scsi_cmnd.h> |
44 | #include <scsi/scsi_device.h> | 44 | #include <scsi/scsi_device.h> |
45 | #include <scsi/scsi_eh.h> | 45 | #include <scsi/scsi_eh.h> |
46 | #include <scsi/scsi_request.h> | ||
47 | #include <scsi/scsi_tcq.h> | 46 | #include <scsi/scsi_tcq.h> |
48 | #include <scsi/scsi_host.h> | 47 | #include <scsi/scsi_host.h> |
49 | 48 | ||
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 73994e2ac2cb..3e90ba797df2 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <scsi/scsi_eh.h> | 63 | #include <scsi/scsi_eh.h> |
64 | #include <scsi/scsi_host.h> | 64 | #include <scsi/scsi_host.h> |
65 | #include <scsi/scsi_tcq.h> | 65 | #include <scsi/scsi_tcq.h> |
66 | #include <scsi/scsi_request.h> | ||
67 | 66 | ||
68 | #include "scsi_priv.h" | 67 | #include "scsi_priv.h" |
69 | #include "scsi_logging.h" | 68 | #include "scsi_logging.h" |
@@ -116,79 +115,6 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = { | |||
116 | }; | 115 | }; |
117 | EXPORT_SYMBOL(scsi_device_types); | 116 | EXPORT_SYMBOL(scsi_device_types); |
118 | 117 | ||
119 | /* | ||
120 | * Function: scsi_allocate_request | ||
121 | * | ||
122 | * Purpose: Allocate a request descriptor. | ||
123 | * | ||
124 | * Arguments: device - device for which we want a request | ||
125 | * gfp_mask - allocation flags passed to kmalloc | ||
126 | * | ||
127 | * Lock status: No locks assumed to be held. This function is SMP-safe. | ||
128 | * | ||
129 | * Returns: Pointer to request block. | ||
130 | */ | ||
131 | struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, | ||
132 | gfp_t gfp_mask) | ||
133 | { | ||
134 | const int offset = ALIGN(sizeof(struct scsi_request), 4); | ||
135 | const int size = offset + sizeof(struct request); | ||
136 | struct scsi_request *sreq; | ||
137 | |||
138 | sreq = kzalloc(size, gfp_mask); | ||
139 | if (likely(sreq != NULL)) { | ||
140 | sreq->sr_request = (struct request *)(((char *)sreq) + offset); | ||
141 | sreq->sr_device = sdev; | ||
142 | sreq->sr_host = sdev->host; | ||
143 | sreq->sr_magic = SCSI_REQ_MAGIC; | ||
144 | sreq->sr_data_direction = DMA_BIDIRECTIONAL; | ||
145 | } | ||
146 | |||
147 | return sreq; | ||
148 | } | ||
149 | EXPORT_SYMBOL(scsi_allocate_request); | ||
150 | |||
151 | void __scsi_release_request(struct scsi_request *sreq) | ||
152 | { | ||
153 | struct request *req = sreq->sr_request; | ||
154 | |||
155 | /* unlikely because the tag was usually ended earlier by the | ||
156 | * mid-layer. However, for layering reasons ULD's don't end | ||
157 | * the tag of commands they generate. */ | ||
158 | if (unlikely(blk_rq_tagged(req))) { | ||
159 | unsigned long flags; | ||
160 | struct request_queue *q = req->q; | ||
161 | |||
162 | spin_lock_irqsave(q->queue_lock, flags); | ||
163 | blk_queue_end_tag(q, req); | ||
164 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
165 | } | ||
166 | |||
167 | |||
168 | if (likely(sreq->sr_command != NULL)) { | ||
169 | struct scsi_cmnd *cmd = sreq->sr_command; | ||
170 | |||
171 | sreq->sr_command = NULL; | ||
172 | scsi_next_command(cmd); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * Function: scsi_release_request | ||
178 | * | ||
179 | * Purpose: Release a request descriptor. | ||
180 | * | ||
181 | * Arguments: sreq - request to release | ||
182 | * | ||
183 | * Lock status: No locks assumed to be held. This function is SMP-safe. | ||
184 | */ | ||
185 | void scsi_release_request(struct scsi_request *sreq) | ||
186 | { | ||
187 | __scsi_release_request(sreq); | ||
188 | kfree(sreq); | ||
189 | } | ||
190 | EXPORT_SYMBOL(scsi_release_request); | ||
191 | |||
192 | struct scsi_host_cmd_pool { | 118 | struct scsi_host_cmd_pool { |
193 | kmem_cache_t *slab; | 119 | kmem_cache_t *slab; |
194 | unsigned int users; | 120 | unsigned int users; |
@@ -646,73 +572,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | |||
646 | return rtn; | 572 | return rtn; |
647 | } | 573 | } |
648 | 574 | ||
649 | /* | ||
650 | * Function: scsi_init_cmd_from_req | ||
651 | * | ||
652 | * Purpose: Queue a SCSI command | ||
653 | * Purpose: Initialize a struct scsi_cmnd from a struct scsi_request | ||
654 | * | ||
655 | * Arguments: cmd - command descriptor. | ||
656 | * sreq - Request from the queue. | ||
657 | * | ||
658 | * Lock status: None needed. | ||
659 | * | ||
660 | * Returns: Nothing. | ||
661 | * | ||
662 | * Notes: Mainly transfer data from the request structure to the | ||
663 | * command structure. The request structure is allocated | ||
664 | * using the normal memory allocator, and requests can pile | ||
665 | * up to more or less any depth. The command structure represents | ||
666 | * a consumable resource, as these are allocated into a pool | ||
667 | * when the SCSI subsystem initializes. The preallocation is | ||
668 | * required so that in low-memory situations a disk I/O request | ||
669 | * won't cause the memory manager to try and write out a page. | ||
670 | * The request structure is generally used by ioctls and character | ||
671 | * devices. | ||
672 | */ | ||
673 | void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq) | ||
674 | { | ||
675 | sreq->sr_command = cmd; | ||
676 | |||
677 | cmd->cmd_len = sreq->sr_cmd_len; | ||
678 | cmd->use_sg = sreq->sr_use_sg; | ||
679 | |||
680 | cmd->request = sreq->sr_request; | ||
681 | memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd)); | ||
682 | cmd->serial_number = 0; | ||
683 | cmd->bufflen = sreq->sr_bufflen; | ||
684 | cmd->buffer = sreq->sr_buffer; | ||
685 | cmd->retries = 0; | ||
686 | cmd->allowed = sreq->sr_allowed; | ||
687 | cmd->done = sreq->sr_done; | ||
688 | cmd->timeout_per_command = sreq->sr_timeout_per_command; | ||
689 | cmd->sc_data_direction = sreq->sr_data_direction; | ||
690 | cmd->sglist_len = sreq->sr_sglist_len; | ||
691 | cmd->underflow = sreq->sr_underflow; | ||
692 | cmd->sc_request = sreq; | ||
693 | memcpy(cmd->cmnd, sreq->sr_cmnd, sizeof(sreq->sr_cmnd)); | ||
694 | |||
695 | /* | ||
696 | * Zero the sense buffer. Some host adapters automatically request | ||
697 | * sense on error. 0 is not a valid sense code. | ||
698 | */ | ||
699 | memset(cmd->sense_buffer, 0, sizeof(sreq->sr_sense_buffer)); | ||
700 | cmd->request_buffer = sreq->sr_buffer; | ||
701 | cmd->request_bufflen = sreq->sr_bufflen; | ||
702 | cmd->old_use_sg = cmd->use_sg; | ||
703 | if (cmd->cmd_len == 0) | ||
704 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); | ||
705 | cmd->old_cmd_len = cmd->cmd_len; | ||
706 | cmd->sc_old_data_direction = cmd->sc_data_direction; | ||
707 | cmd->old_underflow = cmd->underflow; | ||
708 | |||
709 | /* | ||
710 | * Start the timer ticking. | ||
711 | */ | ||
712 | cmd->result = 0; | ||
713 | |||
714 | SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n")); | ||
715 | } | ||
716 | 575 | ||
717 | /* | 576 | /* |
718 | * Per-CPU I/O completion queue. | 577 | * Per-CPU I/O completion queue. |
@@ -809,7 +668,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
809 | { | 668 | { |
810 | struct scsi_device *sdev = cmd->device; | 669 | struct scsi_device *sdev = cmd->device; |
811 | struct Scsi_Host *shost = sdev->host; | 670 | struct Scsi_Host *shost = sdev->host; |
812 | struct scsi_request *sreq; | ||
813 | 671 | ||
814 | scsi_device_unbusy(sdev); | 672 | scsi_device_unbusy(sdev); |
815 | 673 | ||
@@ -839,21 +697,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
839 | * We can get here with use_sg=0, causing a panic in the upper level | 697 | * We can get here with use_sg=0, causing a panic in the upper level |
840 | */ | 698 | */ |
841 | cmd->use_sg = cmd->old_use_sg; | 699 | cmd->use_sg = cmd->old_use_sg; |
842 | |||
843 | /* | ||
844 | * If there is an associated request structure, copy the data over | ||
845 | * before we call the completion function. | ||
846 | */ | ||
847 | sreq = cmd->sc_request; | ||
848 | if (sreq) { | ||
849 | sreq->sr_result = sreq->sr_command->result; | ||
850 | if (sreq->sr_result) { | ||
851 | memcpy(sreq->sr_sense_buffer, | ||
852 | sreq->sr_command->sense_buffer, | ||
853 | sizeof(sreq->sr_sense_buffer)); | ||
854 | } | ||
855 | } | ||
856 | |||
857 | cmd->done(cmd); | 700 | cmd->done(cmd); |
858 | } | 701 | } |
859 | EXPORT_SYMBOL(scsi_finish_command); | 702 | EXPORT_SYMBOL(scsi_finish_command); |
diff --git a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h index 5ee5d80a9931..f51e466893e7 100644 --- a/drivers/scsi/scsi.h +++ b/drivers/scsi/scsi.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <scsi/scsi_cmnd.h> | 25 | #include <scsi/scsi_cmnd.h> |
26 | #include <scsi/scsi_device.h> | 26 | #include <scsi/scsi_device.h> |
27 | #include <scsi/scsi_eh.h> | 27 | #include <scsi/scsi_eh.h> |
28 | #include <scsi/scsi_request.h> | ||
29 | #include <scsi/scsi_tcq.h> | 28 | #include <scsi/scsi_tcq.h> |
30 | #include <scsi/scsi.h> | 29 | #include <scsi/scsi.h> |
31 | 30 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 1c75646f9689..471a43102923 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -26,13 +26,13 @@ | |||
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | 27 | ||
28 | #include <scsi/scsi.h> | 28 | #include <scsi/scsi.h> |
29 | #include <scsi/scsi_cmnd.h> | ||
29 | #include <scsi/scsi_dbg.h> | 30 | #include <scsi/scsi_dbg.h> |
30 | #include <scsi/scsi_device.h> | 31 | #include <scsi/scsi_device.h> |
31 | #include <scsi/scsi_eh.h> | 32 | #include <scsi/scsi_eh.h> |
32 | #include <scsi/scsi_transport.h> | 33 | #include <scsi/scsi_transport.h> |
33 | #include <scsi/scsi_host.h> | 34 | #include <scsi/scsi_host.h> |
34 | #include <scsi/scsi_ioctl.h> | 35 | #include <scsi/scsi_ioctl.h> |
35 | #include <scsi/scsi_request.h> | ||
36 | 36 | ||
37 | #include "scsi_priv.h" | 37 | #include "scsi_priv.h" |
38 | #include "scsi_logging.h" | 38 | #include "scsi_logging.h" |
@@ -1671,8 +1671,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
1671 | scmd->cmd_len = 0; | 1671 | scmd->cmd_len = 0; |
1672 | 1672 | ||
1673 | scmd->sc_data_direction = DMA_BIDIRECTIONAL; | 1673 | scmd->sc_data_direction = DMA_BIDIRECTIONAL; |
1674 | scmd->sc_request = NULL; | ||
1675 | scmd->sc_magic = SCSI_CMND_MAGIC; | ||
1676 | 1674 | ||
1677 | init_timer(&scmd->eh_timeout); | 1675 | init_timer(&scmd->eh_timeout); |
1678 | 1676 | ||
@@ -1769,14 +1767,6 @@ int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, | |||
1769 | } | 1767 | } |
1770 | EXPORT_SYMBOL(scsi_normalize_sense); | 1768 | EXPORT_SYMBOL(scsi_normalize_sense); |
1771 | 1769 | ||
1772 | int scsi_request_normalize_sense(struct scsi_request *sreq, | ||
1773 | struct scsi_sense_hdr *sshdr) | ||
1774 | { | ||
1775 | return scsi_normalize_sense(sreq->sr_sense_buffer, | ||
1776 | sizeof(sreq->sr_sense_buffer), sshdr); | ||
1777 | } | ||
1778 | EXPORT_SYMBOL(scsi_request_normalize_sense); | ||
1779 | |||
1780 | int scsi_command_normalize_sense(struct scsi_cmnd *cmd, | 1770 | int scsi_command_normalize_sense(struct scsi_cmnd *cmd, |
1781 | struct scsi_sense_hdr *sshdr) | 1771 | struct scsi_sense_hdr *sshdr) |
1782 | { | 1772 | { |
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index a89aff61d3d8..a89c4115cfba 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c | |||
@@ -15,11 +15,11 @@ | |||
15 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
16 | 16 | ||
17 | #include <scsi/scsi.h> | 17 | #include <scsi/scsi.h> |
18 | #include <scsi/scsi_cmnd.h> | ||
18 | #include <scsi/scsi_device.h> | 19 | #include <scsi/scsi_device.h> |
19 | #include <scsi/scsi_eh.h> | 20 | #include <scsi/scsi_eh.h> |
20 | #include <scsi/scsi_host.h> | 21 | #include <scsi/scsi_host.h> |
21 | #include <scsi/scsi_ioctl.h> | 22 | #include <scsi/scsi_ioctl.h> |
22 | #include <scsi/scsi_request.h> | ||
23 | #include <scsi/sg.h> | 23 | #include <scsi/sg.h> |
24 | #include <scsi/scsi_dbg.h> | 24 | #include <scsi/scsi_dbg.h> |
25 | 25 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index bdce9d1f5b71..3302d8068c41 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -19,12 +19,12 @@ | |||
19 | #include <linux/hardirq.h> | 19 | #include <linux/hardirq.h> |
20 | 20 | ||
21 | #include <scsi/scsi.h> | 21 | #include <scsi/scsi.h> |
22 | #include <scsi/scsi_cmnd.h> | ||
22 | #include <scsi/scsi_dbg.h> | 23 | #include <scsi/scsi_dbg.h> |
23 | #include <scsi/scsi_device.h> | 24 | #include <scsi/scsi_device.h> |
24 | #include <scsi/scsi_driver.h> | 25 | #include <scsi/scsi_driver.h> |
25 | #include <scsi/scsi_eh.h> | 26 | #include <scsi/scsi_eh.h> |
26 | #include <scsi/scsi_host.h> | 27 | #include <scsi/scsi_host.h> |
27 | #include <scsi/scsi_request.h> | ||
28 | 28 | ||
29 | #include "scsi_priv.h" | 29 | #include "scsi_priv.h" |
30 | #include "scsi_logging.h" | 30 | #include "scsi_logging.h" |
@@ -83,7 +83,7 @@ static void scsi_unprep_request(struct request *req) | |||
83 | struct scsi_cmnd *cmd = req->special; | 83 | struct scsi_cmnd *cmd = req->special; |
84 | 84 | ||
85 | req->flags &= ~REQ_DONTPREP; | 85 | req->flags &= ~REQ_DONTPREP; |
86 | req->special = (req->flags & REQ_SPECIAL) ? cmd->sc_request : NULL; | 86 | req->special = NULL; |
87 | 87 | ||
88 | scsi_put_command(cmd); | 88 | scsi_put_command(cmd); |
89 | } | 89 | } |
@@ -161,72 +161,6 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) | |||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* | ||
165 | * Function: scsi_do_req | ||
166 | * | ||
167 | * Purpose: Queue a SCSI request | ||
168 | * | ||
169 | * Arguments: sreq - command descriptor. | ||
170 | * cmnd - actual SCSI command to be performed. | ||
171 | * buffer - data buffer. | ||
172 | * bufflen - size of data buffer. | ||
173 | * done - completion function to be run. | ||
174 | * timeout - how long to let it run before timeout. | ||
175 | * retries - number of retries we allow. | ||
176 | * | ||
177 | * Lock status: No locks held upon entry. | ||
178 | * | ||
179 | * Returns: Nothing. | ||
180 | * | ||
181 | * Notes: This function is only used for queueing requests for things | ||
182 | * like ioctls and character device requests - this is because | ||
183 | * we essentially just inject a request into the queue for the | ||
184 | * device. | ||
185 | * | ||
186 | * In order to support the scsi_device_quiesce function, we | ||
187 | * now inject requests on the *head* of the device queue | ||
188 | * rather than the tail. | ||
189 | */ | ||
190 | void scsi_do_req(struct scsi_request *sreq, const void *cmnd, | ||
191 | void *buffer, unsigned bufflen, | ||
192 | void (*done)(struct scsi_cmnd *), | ||
193 | int timeout, int retries) | ||
194 | { | ||
195 | /* | ||
196 | * If the upper level driver is reusing these things, then | ||
197 | * we should release the low-level block now. Another one will | ||
198 | * be allocated later when this request is getting queued. | ||
199 | */ | ||
200 | __scsi_release_request(sreq); | ||
201 | |||
202 | /* | ||
203 | * Our own function scsi_done (which marks the host as not busy, | ||
204 | * disables the timeout counter, etc) will be called by us or by the | ||
205 | * scsi_hosts[host].queuecommand() function needs to also call | ||
206 | * the completion function for the high level driver. | ||
207 | */ | ||
208 | memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd)); | ||
209 | sreq->sr_bufflen = bufflen; | ||
210 | sreq->sr_buffer = buffer; | ||
211 | sreq->sr_allowed = retries; | ||
212 | sreq->sr_done = done; | ||
213 | sreq->sr_timeout_per_command = timeout; | ||
214 | |||
215 | if (sreq->sr_cmd_len == 0) | ||
216 | sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]); | ||
217 | |||
218 | /* | ||
219 | * head injection *required* here otherwise quiesce won't work | ||
220 | * | ||
221 | * Because users of this function are apt to reuse requests with no | ||
222 | * modification, we have to sanitise the request flags here | ||
223 | */ | ||
224 | sreq->sr_request->flags &= ~REQ_DONTPREP; | ||
225 | blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request, | ||
226 | 1, sreq); | ||
227 | } | ||
228 | EXPORT_SYMBOL(scsi_do_req); | ||
229 | |||
230 | /** | 164 | /** |
231 | * scsi_execute - insert request and wait for the result | 165 | * scsi_execute - insert request and wait for the result |
232 | * @sdev: scsi device | 166 | * @sdev: scsi device |
@@ -1300,15 +1234,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) | |||
1300 | * at request->cmd, as this tells us the real story. | 1234 | * at request->cmd, as this tells us the real story. |
1301 | */ | 1235 | */ |
1302 | if (req->flags & REQ_SPECIAL && req->special) { | 1236 | if (req->flags & REQ_SPECIAL && req->special) { |
1303 | struct scsi_request *sreq = req->special; | 1237 | cmd = req->special; |
1304 | |||
1305 | if (sreq->sr_magic == SCSI_REQ_MAGIC) { | ||
1306 | cmd = scsi_get_command(sreq->sr_device, GFP_ATOMIC); | ||
1307 | if (unlikely(!cmd)) | ||
1308 | goto defer; | ||
1309 | scsi_init_cmd_from_req(cmd, sreq); | ||
1310 | } else | ||
1311 | cmd = req->special; | ||
1312 | } else if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) { | 1238 | } else if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) { |
1313 | 1239 | ||
1314 | if(unlikely(specials_only) && !(req->flags & REQ_SPECIAL)) { | 1240 | if(unlikely(specials_only) && !(req->flags & REQ_SPECIAL)) { |
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 27c48274e8cb..a1727a0e1bdd 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h | |||
@@ -8,17 +8,10 @@ struct request_queue; | |||
8 | struct scsi_cmnd; | 8 | struct scsi_cmnd; |
9 | struct scsi_device; | 9 | struct scsi_device; |
10 | struct scsi_host_template; | 10 | struct scsi_host_template; |
11 | struct scsi_request; | ||
12 | struct Scsi_Host; | 11 | struct Scsi_Host; |
13 | 12 | ||
14 | 13 | ||
15 | /* | 14 | /* |
16 | * Magic values for certain scsi structs. Shouldn't ever be used. | ||
17 | */ | ||
18 | #define SCSI_CMND_MAGIC 0xE25C23A5 | ||
19 | #define SCSI_REQ_MAGIC 0x75F6D354 | ||
20 | |||
21 | /* | ||
22 | * Scsi Error Handler Flags | 15 | * Scsi Error Handler Flags |
23 | */ | 16 | */ |
24 | #define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */ | 17 | #define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */ |
@@ -34,9 +27,6 @@ extern void scsi_exit_hosts(void); | |||
34 | extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); | 27 | extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); |
35 | extern int scsi_setup_command_freelist(struct Scsi_Host *shost); | 28 | extern int scsi_setup_command_freelist(struct Scsi_Host *shost); |
36 | extern void scsi_destroy_command_freelist(struct Scsi_Host *shost); | 29 | extern void scsi_destroy_command_freelist(struct Scsi_Host *shost); |
37 | extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, | ||
38 | struct scsi_request *sreq); | ||
39 | extern void __scsi_release_request(struct scsi_request *sreq); | ||
40 | extern void __scsi_done(struct scsi_cmnd *cmd); | 30 | extern void __scsi_done(struct scsi_cmnd *cmd); |
41 | extern int scsi_retry_command(struct scsi_cmnd *cmd); | 31 | extern int scsi_retry_command(struct scsi_cmnd *cmd); |
42 | #ifdef CONFIG_SCSI_LOGGING | 32 | #ifdef CONFIG_SCSI_LOGGING |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index fd97d07577ad..0f7e6f94d66b 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -33,11 +33,11 @@ | |||
33 | #include <asm/semaphore.h> | 33 | #include <asm/semaphore.h> |
34 | 34 | ||
35 | #include <scsi/scsi.h> | 35 | #include <scsi/scsi.h> |
36 | #include <scsi/scsi_cmnd.h> | ||
36 | #include <scsi/scsi_device.h> | 37 | #include <scsi/scsi_device.h> |
37 | #include <scsi/scsi_driver.h> | 38 | #include <scsi/scsi_driver.h> |
38 | #include <scsi/scsi_devinfo.h> | 39 | #include <scsi/scsi_devinfo.h> |
39 | #include <scsi/scsi_host.h> | 40 | #include <scsi/scsi_host.h> |
40 | #include <scsi/scsi_request.h> | ||
41 | #include <scsi/scsi_transport.h> | 41 | #include <scsi/scsi_transport.h> |
42 | #include <scsi/scsi_eh.h> | 42 | #include <scsi/scsi_eh.h> |
43 | 43 | ||
diff --git a/drivers/scsi/scsi_typedefs.h b/drivers/scsi/scsi_typedefs.h index 29f038b42f60..2ed4c5cb7088 100644 --- a/drivers/scsi/scsi_typedefs.h +++ b/drivers/scsi/scsi_typedefs.h | |||
@@ -1,3 +1,2 @@ | |||
1 | 1 | ||
2 | typedef struct scsi_cmnd Scsi_Cmnd; | 2 | typedef struct scsi_cmnd Scsi_Cmnd; |
3 | typedef struct scsi_request Scsi_Request; | ||
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 7602b9b15a03..b0caabec1bd1 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -9,7 +9,6 @@ | |||
9 | struct request; | 9 | struct request; |
10 | struct scatterlist; | 10 | struct scatterlist; |
11 | struct scsi_device; | 11 | struct scsi_device; |
12 | struct scsi_request; | ||
13 | 12 | ||
14 | 13 | ||
15 | /* embedded in scsi_cmnd */ | 14 | /* embedded in scsi_cmnd */ |
@@ -29,13 +28,8 @@ struct scsi_pointer { | |||
29 | }; | 28 | }; |
30 | 29 | ||
31 | struct scsi_cmnd { | 30 | struct scsi_cmnd { |
32 | int sc_magic; | ||
33 | |||
34 | struct scsi_device *device; | 31 | struct scsi_device *device; |
35 | struct scsi_request *sc_request; | ||
36 | |||
37 | struct list_head list; /* scsi_cmnd participates in queue lists */ | 32 | struct list_head list; /* scsi_cmnd participates in queue lists */ |
38 | |||
39 | struct list_head eh_entry; /* entry for the host eh_cmd_q */ | 33 | struct list_head eh_entry; /* entry for the host eh_cmd_q */ |
40 | int eh_eflags; /* Used by error handlr */ | 34 | int eh_eflags; /* Used by error handlr */ |
41 | void (*done) (struct scsi_cmnd *); /* Mid-level done function */ | 35 | void (*done) (struct scsi_cmnd *); /* Mid-level done function */ |
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 4d69dee66d4d..3bbbfbe8cbfc 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h | |||
@@ -2,14 +2,12 @@ | |||
2 | #define _SCSI_SCSI_DBG_H | 2 | #define _SCSI_SCSI_DBG_H |
3 | 3 | ||
4 | struct scsi_cmnd; | 4 | struct scsi_cmnd; |
5 | struct scsi_request; | ||
6 | struct scsi_sense_hdr; | 5 | struct scsi_sense_hdr; |
7 | 6 | ||
8 | extern void scsi_print_command(struct scsi_cmnd *); | 7 | extern void scsi_print_command(struct scsi_cmnd *); |
9 | extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); | 8 | extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); |
10 | extern void __scsi_print_command(unsigned char *); | 9 | extern void __scsi_print_command(unsigned char *); |
11 | extern void scsi_print_sense(const char *, struct scsi_cmnd *); | 10 | extern void scsi_print_sense(const char *, struct scsi_cmnd *); |
12 | extern void scsi_print_req_sense(const char *, struct scsi_request *); | ||
13 | extern void __scsi_print_sense(const char *name, | 11 | extern void __scsi_print_sense(const char *name, |
14 | const unsigned char *sense_buffer, | 12 | const unsigned char *sense_buffer, |
15 | int sense_len); | 13 | int sense_len); |
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index d160880b2a87..c5c0f6762a01 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | struct scsi_cmnd; | 4 | struct scsi_cmnd; |
5 | struct scsi_device; | 5 | struct scsi_device; |
6 | struct scsi_request; | ||
7 | struct Scsi_Host; | 6 | struct Scsi_Host; |
8 | 7 | ||
9 | /* | 8 | /* |
@@ -43,8 +42,6 @@ extern void scsi_report_device_reset(struct Scsi_Host *, int, int); | |||
43 | extern int scsi_block_when_processing_errors(struct scsi_device *); | 42 | extern int scsi_block_when_processing_errors(struct scsi_device *); |
44 | extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, | 43 | extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, |
45 | struct scsi_sense_hdr *sshdr); | 44 | struct scsi_sense_hdr *sshdr); |
46 | extern int scsi_request_normalize_sense(struct scsi_request *sreq, | ||
47 | struct scsi_sense_hdr *sshdr); | ||
48 | extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd, | 45 | extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd, |
49 | struct scsi_sense_hdr *sshdr); | 46 | struct scsi_sense_hdr *sshdr); |
50 | 47 | ||
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h deleted file mode 100644 index 98d69fdb851c..000000000000 --- a/include/scsi/scsi_request.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | #ifndef _SCSI_SCSI_REQUEST_H | ||
2 | #define _SCSI_SCSI_REQUEST_H | ||
3 | |||
4 | #include <scsi/scsi_cmnd.h> | ||
5 | |||
6 | struct request; | ||
7 | struct scsi_cmnd; | ||
8 | struct scsi_device; | ||
9 | struct Scsi_Host; | ||
10 | |||
11 | |||
12 | /* | ||
13 | * This is essentially a slimmed down version of Scsi_Cmnd. The point of | ||
14 | * having this is that requests that are injected into the queue as result | ||
15 | * of things like ioctls and character devices shouldn't be using a | ||
16 | * Scsi_Cmnd until such a time that the command is actually at the head | ||
17 | * of the queue and being sent to the driver. | ||
18 | */ | ||
19 | struct scsi_request { | ||
20 | int sr_magic; | ||
21 | int sr_result; /* Status code from lower level driver */ | ||
22 | unsigned char sr_sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE | ||
23 | * when CHECK CONDITION is | ||
24 | * received on original command | ||
25 | * (auto-sense) */ | ||
26 | |||
27 | struct Scsi_Host *sr_host; | ||
28 | struct scsi_device *sr_device; | ||
29 | struct scsi_cmnd *sr_command; | ||
30 | struct request *sr_request; /* A copy of the command we are | ||
31 | working on */ | ||
32 | unsigned sr_bufflen; /* Size of data buffer */ | ||
33 | void *sr_buffer; /* Data buffer */ | ||
34 | int sr_allowed; | ||
35 | enum dma_data_direction sr_data_direction; | ||
36 | unsigned char sr_cmd_len; | ||
37 | unsigned char sr_cmnd[MAX_COMMAND_SIZE]; | ||
38 | void (*sr_done) (struct scsi_cmnd *); /* Mid-level done function */ | ||
39 | int sr_timeout_per_command; | ||
40 | unsigned short sr_use_sg; /* Number of pieces of scatter-gather */ | ||
41 | unsigned short sr_sglist_len; /* size of malloc'd scatter-gather list */ | ||
42 | unsigned sr_underflow; /* Return error if less than | ||
43 | this amount is transferred */ | ||
44 | void *upper_private_data; /* reserved for owner (usually upper | ||
45 | level driver) of this request */ | ||
46 | }; | ||
47 | |||
48 | extern struct scsi_request *scsi_allocate_request(struct scsi_device *, gfp_t); | ||
49 | extern void scsi_release_request(struct scsi_request *); | ||
50 | extern void scsi_do_req(struct scsi_request *, const void *cmnd, | ||
51 | void *buffer, unsigned bufflen, | ||
52 | void (*done) (struct scsi_cmnd *), | ||
53 | int timeout, int retries); | ||
54 | #endif /* _SCSI_SCSI_REQUEST_H */ | ||
diff --git a/include/scsi/sg_request.h b/include/scsi/sg_request.h deleted file mode 100644 index 57ff525bdd3b..000000000000 --- a/include/scsi/sg_request.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | typedef struct scsi_request Scsi_Request; | ||
2 | |||
3 | static Scsi_Request *dummy_cmdp; /* only used for sizeof */ | ||
4 | |||
5 | typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ | ||
6 | unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */ | ||
7 | unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */ | ||
8 | unsigned bufflen; /* Size of (aggregate) data buffer */ | ||
9 | unsigned b_malloc_len; /* actual len malloc'ed in buffer */ | ||
10 | void *buffer; /* Data buffer or scatter list (k_use_sg>0) */ | ||
11 | char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */ | ||
12 | unsigned char cmd_opcode; /* first byte of command */ | ||
13 | } Sg_scatter_hold; | ||
14 | |||
15 | typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ | ||
16 | Scsi_Request *my_cmdp; /* != 0 when request with lower levels */ | ||
17 | struct sg_request *nextrp; /* NULL -> tail request (slist) */ | ||
18 | struct sg_fd *parentfp; /* NULL -> not in use */ | ||
19 | Sg_scatter_hold data; /* hold buffer, perhaps scatter list */ | ||
20 | sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */ | ||
21 | unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)]; | ||
22 | char res_used; /* 1 -> using reserve buffer, 0 -> not ... */ | ||
23 | char orphan; /* 1 -> drop on sight, 0 -> normal */ | ||
24 | char sg_io_owned; /* 1 -> packet belongs to SG_IO */ | ||
25 | volatile char done; /* 0->before bh, 1->before read, 2->read */ | ||
26 | } Sg_request; | ||