diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 13:52:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 14:10:35 -0400 |
commit | c9059598ea8981d02356eead3188bf7fa4d717b8 (patch) | |
tree | 03e73b20a30e988da7c6a3e0ad93b2dc5843274d /drivers/scsi | |
parent | 0a33f80a8373eca7f4bea3961d1346c3815fa5ed (diff) | |
parent | b0fd271d5fba0b2d00888363f3869e3f9b26caa9 (diff) |
Merge branch 'for-2.6.31' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.31' of git://git.kernel.dk/linux-2.6-block: (153 commits)
block: add request clone interface (v2)
floppy: fix hibernation
ramdisk: remove long-deprecated "ramdisk=" boot-time parameter
fs/bio.c: add missing __user annotation
block: prevent possible io_context->refcount overflow
Add serial number support for virtio_blk, V4a
block: Add missing bounce_pfn stacking and fix comments
Revert "block: Fix bounce limit setting in DM"
cciss: decode unit attention in SCSI error handling code
cciss: Remove no longer needed sendcmd reject processing code
cciss: change SCSI error handling routines to work with interrupts enabled.
cciss: separate error processing and command retrying code in sendcmd_withirq_core()
cciss: factor out fix target status processing code from sendcmd functions
cciss: simplify interface of sendcmd() and sendcmd_withirq()
cciss: factor out core of sendcmd_withirq() for use by SCSI error handling code
cciss: Use schedule_timeout_uninterruptible in SCSI error handling code
block: needs to set the residual length of a bidi request
Revert "block: implement blkdev_readpages"
block: Fix bounce limit setting in DM
Removed reference to non-existing file Documentation/PCI/PCI-DMA-mapping.txt
...
Manually fix conflicts with tracing updates in:
block/blk-sysfs.c
drivers/ide/ide-atapi.c
drivers/ide/ide-cd.c
drivers/ide/ide-floppy.c
drivers/ide/ide-tape.c
include/trace/events/block.h
kernel/trace/blktrace.c
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/eata.c | 24 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 16 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_host_smp.c | 49 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 22 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 23 | ||||
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 72 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 87 | ||||
-rw-r--r-- | drivers/scsi/scsi_tgt_lib.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 26 | ||||
-rw-r--r-- | drivers/scsi/sd_dif.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 17 | ||||
-rw-r--r-- | drivers/scsi/sr.c | 17 | ||||
-rw-r--r-- | drivers/scsi/st.c | 6 | ||||
-rw-r--r-- | drivers/scsi/u14-34f.c | 22 |
15 files changed, 169 insertions, 220 deletions
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index be5099dd94b..c7076ce25e2 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c | |||
@@ -1825,7 +1825,7 @@ static int eata2x_queuecommand(struct scsi_cmnd *SCpnt, | |||
1825 | if (linked_comm && SCpnt->device->queue_depth > 2 | 1825 | if (linked_comm && SCpnt->device->queue_depth > 2 |
1826 | && TLDEV(SCpnt->device->type)) { | 1826 | && TLDEV(SCpnt->device->type)) { |
1827 | ha->cp_stat[i] = READY; | 1827 | ha->cp_stat[i] = READY; |
1828 | flush_dev(SCpnt->device, SCpnt->request->sector, ha, 0); | 1828 | flush_dev(SCpnt->device, blk_rq_pos(SCpnt->request), ha, 0); |
1829 | return 0; | 1829 | return 0; |
1830 | } | 1830 | } |
1831 | 1831 | ||
@@ -2144,13 +2144,13 @@ static int reorder(struct hostdata *ha, unsigned long cursec, | |||
2144 | if (!cpp->din) | 2144 | if (!cpp->din) |
2145 | input_only = 0; | 2145 | input_only = 0; |
2146 | 2146 | ||
2147 | if (SCpnt->request->sector < minsec) | 2147 | if (blk_rq_pos(SCpnt->request) < minsec) |
2148 | minsec = SCpnt->request->sector; | 2148 | minsec = blk_rq_pos(SCpnt->request); |
2149 | if (SCpnt->request->sector > maxsec) | 2149 | if (blk_rq_pos(SCpnt->request) > maxsec) |
2150 | maxsec = SCpnt->request->sector; | 2150 | maxsec = blk_rq_pos(SCpnt->request); |
2151 | 2151 | ||
2152 | sl[n] = SCpnt->request->sector; | 2152 | sl[n] = blk_rq_pos(SCpnt->request); |
2153 | ioseek += SCpnt->request->nr_sectors; | 2153 | ioseek += blk_rq_sectors(SCpnt->request); |
2154 | 2154 | ||
2155 | if (!n) | 2155 | if (!n) |
2156 | continue; | 2156 | continue; |
@@ -2190,7 +2190,7 @@ static int reorder(struct hostdata *ha, unsigned long cursec, | |||
2190 | k = il[n]; | 2190 | k = il[n]; |
2191 | cpp = &ha->cp[k]; | 2191 | cpp = &ha->cp[k]; |
2192 | SCpnt = cpp->SCpnt; | 2192 | SCpnt = cpp->SCpnt; |
2193 | ll[n] = SCpnt->request->nr_sectors; | 2193 | ll[n] = blk_rq_sectors(SCpnt->request); |
2194 | pl[n] = SCpnt->serial_number; | 2194 | pl[n] = SCpnt->serial_number; |
2195 | 2195 | ||
2196 | if (!n) | 2196 | if (!n) |
@@ -2236,12 +2236,12 @@ static int reorder(struct hostdata *ha, unsigned long cursec, | |||
2236 | cpp = &ha->cp[k]; | 2236 | cpp = &ha->cp[k]; |
2237 | SCpnt = cpp->SCpnt; | 2237 | SCpnt = cpp->SCpnt; |
2238 | scmd_printk(KERN_INFO, SCpnt, | 2238 | scmd_printk(KERN_INFO, SCpnt, |
2239 | "%s pid %ld mb %d fc %d nr %d sec %ld ns %ld" | 2239 | "%s pid %ld mb %d fc %d nr %d sec %ld ns %u" |
2240 | " cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n", | 2240 | " cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n", |
2241 | (ihdlr ? "ihdlr" : "qcomm"), | 2241 | (ihdlr ? "ihdlr" : "qcomm"), |
2242 | SCpnt->serial_number, k, flushcount, | 2242 | SCpnt->serial_number, k, flushcount, |
2243 | n_ready, SCpnt->request->sector, | 2243 | n_ready, blk_rq_pos(SCpnt->request), |
2244 | SCpnt->request->nr_sectors, cursec, YESNO(s), | 2244 | blk_rq_sectors(SCpnt->request), cursec, YESNO(s), |
2245 | YESNO(r), YESNO(rev), YESNO(input_only), | 2245 | YESNO(r), YESNO(rev), YESNO(input_only), |
2246 | YESNO(overlap), cpp->din); | 2246 | YESNO(overlap), cpp->din); |
2247 | } | 2247 | } |
@@ -2408,7 +2408,7 @@ static irqreturn_t ihdlr(struct Scsi_Host *shost) | |||
2408 | 2408 | ||
2409 | if (linked_comm && SCpnt->device->queue_depth > 2 | 2409 | if (linked_comm && SCpnt->device->queue_depth > 2 |
2410 | && TLDEV(SCpnt->device->type)) | 2410 | && TLDEV(SCpnt->device->type)) |
2411 | flush_dev(SCpnt->device, SCpnt->request->sector, ha, 1); | 2411 | flush_dev(SCpnt->device, blk_rq_pos(SCpnt->request), ha, 1); |
2412 | 2412 | ||
2413 | tstatus = status_byte(spp->target_status); | 2413 | tstatus = status_byte(spp->target_status); |
2414 | 2414 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 3da02e43678..54fa1e42dc4 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -1927,21 +1927,21 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1927 | /* do we need to support multiple segments? */ | 1927 | /* do we need to support multiple segments? */ |
1928 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | 1928 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { |
1929 | printk("%s: multiple segments req %u %u, rsp %u %u\n", | 1929 | printk("%s: multiple segments req %u %u, rsp %u %u\n", |
1930 | __func__, req->bio->bi_vcnt, req->data_len, | 1930 | __func__, req->bio->bi_vcnt, blk_rq_bytes(req), |
1931 | rsp->bio->bi_vcnt, rsp->data_len); | 1931 | rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); |
1932 | return -EINVAL; | 1932 | return -EINVAL; |
1933 | } | 1933 | } |
1934 | 1934 | ||
1935 | ret = smp_execute_task(dev, bio_data(req->bio), req->data_len, | 1935 | ret = smp_execute_task(dev, bio_data(req->bio), blk_rq_bytes(req), |
1936 | bio_data(rsp->bio), rsp->data_len); | 1936 | bio_data(rsp->bio), blk_rq_bytes(rsp)); |
1937 | if (ret > 0) { | 1937 | if (ret > 0) { |
1938 | /* positive number is the untransferred residual */ | 1938 | /* positive number is the untransferred residual */ |
1939 | rsp->data_len = ret; | 1939 | rsp->resid_len = ret; |
1940 | req->data_len = 0; | 1940 | req->resid_len = 0; |
1941 | ret = 0; | 1941 | ret = 0; |
1942 | } else if (ret == 0) { | 1942 | } else if (ret == 0) { |
1943 | rsp->data_len = 0; | 1943 | rsp->resid_len = 0; |
1944 | req->data_len = 0; | 1944 | req->resid_len = 0; |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | return ret; | 1947 | return ret; |
diff --git a/drivers/scsi/libsas/sas_host_smp.c b/drivers/scsi/libsas/sas_host_smp.c index d110a366c48..1bc3b756799 100644 --- a/drivers/scsi/libsas/sas_host_smp.c +++ b/drivers/scsi/libsas/sas_host_smp.c | |||
@@ -134,24 +134,24 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
134 | { | 134 | { |
135 | u8 *req_data = NULL, *resp_data = NULL, *buf; | 135 | u8 *req_data = NULL, *resp_data = NULL, *buf; |
136 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 136 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
137 | int error = -EINVAL, resp_data_len = rsp->data_len; | 137 | int error = -EINVAL; |
138 | 138 | ||
139 | /* eight is the minimum size for request and response frames */ | 139 | /* eight is the minimum size for request and response frames */ |
140 | if (req->data_len < 8 || rsp->data_len < 8) | 140 | if (blk_rq_bytes(req) < 8 || blk_rq_bytes(rsp) < 8) |
141 | goto out; | 141 | goto out; |
142 | 142 | ||
143 | if (bio_offset(req->bio) + req->data_len > PAGE_SIZE || | 143 | if (bio_offset(req->bio) + blk_rq_bytes(req) > PAGE_SIZE || |
144 | bio_offset(rsp->bio) + rsp->data_len > PAGE_SIZE) { | 144 | bio_offset(rsp->bio) + blk_rq_bytes(rsp) > PAGE_SIZE) { |
145 | shost_printk(KERN_ERR, shost, | 145 | shost_printk(KERN_ERR, shost, |
146 | "SMP request/response frame crosses page boundary"); | 146 | "SMP request/response frame crosses page boundary"); |
147 | goto out; | 147 | goto out; |
148 | } | 148 | } |
149 | 149 | ||
150 | req_data = kzalloc(req->data_len, GFP_KERNEL); | 150 | req_data = kzalloc(blk_rq_bytes(req), GFP_KERNEL); |
151 | 151 | ||
152 | /* make sure frame can always be built ... we copy | 152 | /* make sure frame can always be built ... we copy |
153 | * back only the requested length */ | 153 | * back only the requested length */ |
154 | resp_data = kzalloc(max(rsp->data_len, 128U), GFP_KERNEL); | 154 | resp_data = kzalloc(max(blk_rq_bytes(rsp), 128U), GFP_KERNEL); |
155 | 155 | ||
156 | if (!req_data || !resp_data) { | 156 | if (!req_data || !resp_data) { |
157 | error = -ENOMEM; | 157 | error = -ENOMEM; |
@@ -160,7 +160,7 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
160 | 160 | ||
161 | local_irq_disable(); | 161 | local_irq_disable(); |
162 | buf = kmap_atomic(bio_page(req->bio), KM_USER0) + bio_offset(req->bio); | 162 | buf = kmap_atomic(bio_page(req->bio), KM_USER0) + bio_offset(req->bio); |
163 | memcpy(req_data, buf, req->data_len); | 163 | memcpy(req_data, buf, blk_rq_bytes(req)); |
164 | kunmap_atomic(buf - bio_offset(req->bio), KM_USER0); | 164 | kunmap_atomic(buf - bio_offset(req->bio), KM_USER0); |
165 | local_irq_enable(); | 165 | local_irq_enable(); |
166 | 166 | ||
@@ -178,15 +178,15 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
178 | 178 | ||
179 | switch (req_data[1]) { | 179 | switch (req_data[1]) { |
180 | case SMP_REPORT_GENERAL: | 180 | case SMP_REPORT_GENERAL: |
181 | req->data_len -= 8; | 181 | req->resid_len -= 8; |
182 | resp_data_len -= 32; | 182 | rsp->resid_len -= 32; |
183 | resp_data[2] = SMP_RESP_FUNC_ACC; | 183 | resp_data[2] = SMP_RESP_FUNC_ACC; |
184 | resp_data[9] = sas_ha->num_phys; | 184 | resp_data[9] = sas_ha->num_phys; |
185 | break; | 185 | break; |
186 | 186 | ||
187 | case SMP_REPORT_MANUF_INFO: | 187 | case SMP_REPORT_MANUF_INFO: |
188 | req->data_len -= 8; | 188 | req->resid_len -= 8; |
189 | resp_data_len -= 64; | 189 | rsp->resid_len -= 64; |
190 | resp_data[2] = SMP_RESP_FUNC_ACC; | 190 | resp_data[2] = SMP_RESP_FUNC_ACC; |
191 | memcpy(resp_data + 12, shost->hostt->name, | 191 | memcpy(resp_data + 12, shost->hostt->name, |
192 | SAS_EXPANDER_VENDOR_ID_LEN); | 192 | SAS_EXPANDER_VENDOR_ID_LEN); |
@@ -199,13 +199,13 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
199 | break; | 199 | break; |
200 | 200 | ||
201 | case SMP_DISCOVER: | 201 | case SMP_DISCOVER: |
202 | req->data_len -= 16; | 202 | req->resid_len -= 16; |
203 | if ((int)req->data_len < 0) { | 203 | if ((int)req->resid_len < 0) { |
204 | req->data_len = 0; | 204 | req->resid_len = 0; |
205 | error = -EINVAL; | 205 | error = -EINVAL; |
206 | goto out; | 206 | goto out; |
207 | } | 207 | } |
208 | resp_data_len -= 56; | 208 | rsp->resid_len -= 56; |
209 | sas_host_smp_discover(sas_ha, resp_data, req_data[9]); | 209 | sas_host_smp_discover(sas_ha, resp_data, req_data[9]); |
210 | break; | 210 | break; |
211 | 211 | ||
@@ -215,13 +215,13 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
215 | break; | 215 | break; |
216 | 216 | ||
217 | case SMP_REPORT_PHY_SATA: | 217 | case SMP_REPORT_PHY_SATA: |
218 | req->data_len -= 16; | 218 | req->resid_len -= 16; |
219 | if ((int)req->data_len < 0) { | 219 | if ((int)req->resid_len < 0) { |
220 | req->data_len = 0; | 220 | req->resid_len = 0; |
221 | error = -EINVAL; | 221 | error = -EINVAL; |
222 | goto out; | 222 | goto out; |
223 | } | 223 | } |
224 | resp_data_len -= 60; | 224 | rsp->resid_len -= 60; |
225 | sas_report_phy_sata(sas_ha, resp_data, req_data[9]); | 225 | sas_report_phy_sata(sas_ha, resp_data, req_data[9]); |
226 | break; | 226 | break; |
227 | 227 | ||
@@ -238,13 +238,13 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
238 | break; | 238 | break; |
239 | 239 | ||
240 | case SMP_PHY_CONTROL: | 240 | case SMP_PHY_CONTROL: |
241 | req->data_len -= 44; | 241 | req->resid_len -= 44; |
242 | if ((int)req->data_len < 0) { | 242 | if ((int)req->resid_len < 0) { |
243 | req->data_len = 0; | 243 | req->resid_len = 0; |
244 | error = -EINVAL; | 244 | error = -EINVAL; |
245 | goto out; | 245 | goto out; |
246 | } | 246 | } |
247 | resp_data_len -= 8; | 247 | rsp->resid_len -= 8; |
248 | sas_phy_control(sas_ha, req_data[9], req_data[10], | 248 | sas_phy_control(sas_ha, req_data[9], req_data[10], |
249 | req_data[32] >> 4, req_data[33] >> 4, | 249 | req_data[32] >> 4, req_data[33] >> 4, |
250 | resp_data); | 250 | resp_data); |
@@ -261,11 +261,10 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
261 | 261 | ||
262 | local_irq_disable(); | 262 | local_irq_disable(); |
263 | buf = kmap_atomic(bio_page(rsp->bio), KM_USER0) + bio_offset(rsp->bio); | 263 | buf = kmap_atomic(bio_page(rsp->bio), KM_USER0) + bio_offset(rsp->bio); |
264 | memcpy(buf, resp_data, rsp->data_len); | 264 | memcpy(buf, resp_data, blk_rq_bytes(rsp)); |
265 | flush_kernel_dcache_page(bio_page(rsp->bio)); | 265 | flush_kernel_dcache_page(bio_page(rsp->bio)); |
266 | kunmap_atomic(buf - bio_offset(rsp->bio), KM_USER0); | 266 | kunmap_atomic(buf - bio_offset(rsp->bio), KM_USER0); |
267 | local_irq_enable(); | 267 | local_irq_enable(); |
268 | rsp->data_len = resp_data_len; | ||
269 | 268 | ||
270 | out: | 269 | out: |
271 | kfree(req_data); | 270 | kfree(req_data); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 167b66dd34c..8032c5adb6a 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1312,10 +1312,10 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1312 | uint32_t bgstat = bgf->bgstat; | 1312 | uint32_t bgstat = bgf->bgstat; |
1313 | uint64_t failing_sector = 0; | 1313 | uint64_t failing_sector = 0; |
1314 | 1314 | ||
1315 | printk(KERN_ERR "BG ERROR in cmd 0x%x lba 0x%llx blk cnt 0x%lx " | 1315 | printk(KERN_ERR "BG ERROR in cmd 0x%x lba 0x%llx blk cnt 0x%x " |
1316 | "bgstat=0x%x bghm=0x%x\n", | 1316 | "bgstat=0x%x bghm=0x%x\n", |
1317 | cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), | 1317 | cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), |
1318 | cmd->request->nr_sectors, bgstat, bghm); | 1318 | blk_rq_sectors(cmd->request), bgstat, bghm); |
1319 | 1319 | ||
1320 | spin_lock(&_dump_buf_lock); | 1320 | spin_lock(&_dump_buf_lock); |
1321 | if (!_dump_buf_done) { | 1321 | if (!_dump_buf_done) { |
@@ -2378,15 +2378,15 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2378 | if (cmnd->cmnd[0] == READ_10) | 2378 | if (cmnd->cmnd[0] == READ_10) |
2379 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2379 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2380 | "9035 BLKGRD: READ @ sector %llu, " | 2380 | "9035 BLKGRD: READ @ sector %llu, " |
2381 | "count %lu\n", | 2381 | "count %u\n", |
2382 | (unsigned long long)scsi_get_lba(cmnd), | 2382 | (unsigned long long)scsi_get_lba(cmnd), |
2383 | cmnd->request->nr_sectors); | 2383 | blk_rq_sectors(cmnd->request)); |
2384 | else if (cmnd->cmnd[0] == WRITE_10) | 2384 | else if (cmnd->cmnd[0] == WRITE_10) |
2385 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2385 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2386 | "9036 BLKGRD: WRITE @ sector %llu, " | 2386 | "9036 BLKGRD: WRITE @ sector %llu, " |
2387 | "count %lu cmd=%p\n", | 2387 | "count %u cmd=%p\n", |
2388 | (unsigned long long)scsi_get_lba(cmnd), | 2388 | (unsigned long long)scsi_get_lba(cmnd), |
2389 | cmnd->request->nr_sectors, | 2389 | blk_rq_sectors(cmnd->request), |
2390 | cmnd); | 2390 | cmnd); |
2391 | 2391 | ||
2392 | err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); | 2392 | err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); |
@@ -2406,15 +2406,15 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2406 | if (cmnd->cmnd[0] == READ_10) | 2406 | if (cmnd->cmnd[0] == READ_10) |
2407 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2407 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2408 | "9040 dbg: READ @ sector %llu, " | 2408 | "9040 dbg: READ @ sector %llu, " |
2409 | "count %lu\n", | 2409 | "count %u\n", |
2410 | (unsigned long long)scsi_get_lba(cmnd), | 2410 | (unsigned long long)scsi_get_lba(cmnd), |
2411 | cmnd->request->nr_sectors); | 2411 | blk_rq_sectors(cmnd->request)); |
2412 | else if (cmnd->cmnd[0] == WRITE_10) | 2412 | else if (cmnd->cmnd[0] == WRITE_10) |
2413 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2413 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2414 | "9041 dbg: WRITE @ sector %llu, " | 2414 | "9041 dbg: WRITE @ sector %llu, " |
2415 | "count %lu cmd=%p\n", | 2415 | "count %u cmd=%p\n", |
2416 | (unsigned long long)scsi_get_lba(cmnd), | 2416 | (unsigned long long)scsi_get_lba(cmnd), |
2417 | cmnd->request->nr_sectors, cmnd); | 2417 | blk_rq_sectors(cmnd->request), cmnd); |
2418 | else | 2418 | else |
2419 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2419 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2420 | "9042 dbg: parser not implemented\n"); | 2420 | "9042 dbg: parser not implemented\n"); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index e03dc0b1e1a..5c65da519e3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -1041,7 +1041,7 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1041 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | 1041 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { |
1042 | printk(MPT2SAS_ERR_FMT "%s: multiple segments req %u %u, " | 1042 | printk(MPT2SAS_ERR_FMT "%s: multiple segments req %u %u, " |
1043 | "rsp %u %u\n", ioc->name, __func__, req->bio->bi_vcnt, | 1043 | "rsp %u %u\n", ioc->name, __func__, req->bio->bi_vcnt, |
1044 | req->data_len, rsp->bio->bi_vcnt, rsp->data_len); | 1044 | blk_rq_bytes(req), rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); |
1045 | return -EINVAL; | 1045 | return -EINVAL; |
1046 | } | 1046 | } |
1047 | 1047 | ||
@@ -1104,7 +1104,7 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1104 | *((u64 *)&mpi_request->SASAddress) = (rphy) ? | 1104 | *((u64 *)&mpi_request->SASAddress) = (rphy) ? |
1105 | cpu_to_le64(rphy->identify.sas_address) : | 1105 | cpu_to_le64(rphy->identify.sas_address) : |
1106 | cpu_to_le64(ioc->sas_hba.sas_address); | 1106 | cpu_to_le64(ioc->sas_hba.sas_address); |
1107 | mpi_request->RequestDataLength = cpu_to_le16(req->data_len - 4); | 1107 | mpi_request->RequestDataLength = cpu_to_le16(blk_rq_bytes(req) - 4); |
1108 | psge = &mpi_request->SGL; | 1108 | psge = &mpi_request->SGL; |
1109 | 1109 | ||
1110 | /* WRITE sgel first */ | 1110 | /* WRITE sgel first */ |
@@ -1112,13 +1112,13 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1112 | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); | 1112 | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); |
1113 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; | 1113 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; |
1114 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), | 1114 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), |
1115 | req->data_len, PCI_DMA_BIDIRECTIONAL); | 1115 | blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); |
1116 | if (!dma_addr_out) { | 1116 | if (!dma_addr_out) { |
1117 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); | 1117 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); |
1118 | goto unmap; | 1118 | goto unmap; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | ioc->base_add_sg_single(psge, sgl_flags | (req->data_len - 4), | 1121 | ioc->base_add_sg_single(psge, sgl_flags | (blk_rq_bytes(req) - 4), |
1122 | dma_addr_out); | 1122 | dma_addr_out); |
1123 | 1123 | ||
1124 | /* incr sgel */ | 1124 | /* incr sgel */ |
@@ -1129,14 +1129,14 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1129 | MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | | 1129 | MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | |
1130 | MPI2_SGE_FLAGS_END_OF_LIST); | 1130 | MPI2_SGE_FLAGS_END_OF_LIST); |
1131 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; | 1131 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; |
1132 | dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), | 1132 | dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), |
1133 | rsp->data_len, PCI_DMA_BIDIRECTIONAL); | 1133 | blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); |
1134 | if (!dma_addr_in) { | 1134 | if (!dma_addr_in) { |
1135 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); | 1135 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); |
1136 | goto unmap; | 1136 | goto unmap; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | ioc->base_add_sg_single(psge, sgl_flags | (rsp->data_len + 4), | 1139 | ioc->base_add_sg_single(psge, sgl_flags | (blk_rq_bytes(rsp) + 4), |
1140 | dma_addr_in); | 1140 | dma_addr_in); |
1141 | 1141 | ||
1142 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s - " | 1142 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s - " |
@@ -1170,9 +1170,8 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1170 | 1170 | ||
1171 | memcpy(req->sense, mpi_reply, sizeof(*mpi_reply)); | 1171 | memcpy(req->sense, mpi_reply, sizeof(*mpi_reply)); |
1172 | req->sense_len = sizeof(*mpi_reply); | 1172 | req->sense_len = sizeof(*mpi_reply); |
1173 | req->data_len = 0; | 1173 | req->resid_len = 0; |
1174 | rsp->data_len -= mpi_reply->ResponseDataLength; | 1174 | rsp->resid_len -= mpi_reply->ResponseDataLength; |
1175 | |||
1176 | } else { | 1175 | } else { |
1177 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT | 1176 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT |
1178 | "%s - no reply\n", ioc->name, __func__)); | 1177 | "%s - no reply\n", ioc->name, __func__)); |
@@ -1188,10 +1187,10 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1188 | 1187 | ||
1189 | unmap: | 1188 | unmap: |
1190 | if (dma_addr_out) | 1189 | if (dma_addr_out) |
1191 | pci_unmap_single(ioc->pdev, dma_addr_out, req->data_len, | 1190 | pci_unmap_single(ioc->pdev, dma_addr_out, blk_rq_bytes(req), |
1192 | PCI_DMA_BIDIRECTIONAL); | 1191 | PCI_DMA_BIDIRECTIONAL); |
1193 | if (dma_addr_in) | 1192 | if (dma_addr_in) |
1194 | pci_unmap_single(ioc->pdev, dma_addr_in, rsp->data_len, | 1193 | pci_unmap_single(ioc->pdev, dma_addr_in, blk_rq_bytes(rsp), |
1195 | PCI_DMA_BIDIRECTIONAL); | 1194 | PCI_DMA_BIDIRECTIONAL); |
1196 | 1195 | ||
1197 | out: | 1196 | out: |
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index 1ce6b24abab..5776b2ab6b1 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -889,26 +889,6 @@ int osd_req_add_set_attr_list(struct osd_request *or, | |||
889 | } | 889 | } |
890 | EXPORT_SYMBOL(osd_req_add_set_attr_list); | 890 | EXPORT_SYMBOL(osd_req_add_set_attr_list); |
891 | 891 | ||
892 | static int _append_map_kern(struct request *req, | ||
893 | void *buff, unsigned len, gfp_t flags) | ||
894 | { | ||
895 | struct bio *bio; | ||
896 | int ret; | ||
897 | |||
898 | bio = bio_map_kern(req->q, buff, len, flags); | ||
899 | if (IS_ERR(bio)) { | ||
900 | OSD_ERR("Failed bio_map_kern(%p, %d) => %ld\n", buff, len, | ||
901 | PTR_ERR(bio)); | ||
902 | return PTR_ERR(bio); | ||
903 | } | ||
904 | ret = blk_rq_append_bio(req->q, req, bio); | ||
905 | if (ret) { | ||
906 | OSD_ERR("Failed blk_rq_append_bio(%p) => %d\n", bio, ret); | ||
907 | bio_put(bio); | ||
908 | } | ||
909 | return ret; | ||
910 | } | ||
911 | |||
912 | static int _req_append_segment(struct osd_request *or, | 892 | static int _req_append_segment(struct osd_request *or, |
913 | unsigned padding, struct _osd_req_data_segment *seg, | 893 | unsigned padding, struct _osd_req_data_segment *seg, |
914 | struct _osd_req_data_segment *last_seg, struct _osd_io_info *io) | 894 | struct _osd_req_data_segment *last_seg, struct _osd_io_info *io) |
@@ -924,14 +904,14 @@ static int _req_append_segment(struct osd_request *or, | |||
924 | else | 904 | else |
925 | pad_buff = io->pad_buff; | 905 | pad_buff = io->pad_buff; |
926 | 906 | ||
927 | ret = _append_map_kern(io->req, pad_buff, padding, | 907 | ret = blk_rq_map_kern(io->req->q, io->req, pad_buff, padding, |
928 | or->alloc_flags); | 908 | or->alloc_flags); |
929 | if (ret) | 909 | if (ret) |
930 | return ret; | 910 | return ret; |
931 | io->total_bytes += padding; | 911 | io->total_bytes += padding; |
932 | } | 912 | } |
933 | 913 | ||
934 | ret = _append_map_kern(io->req, seg->buff, seg->total_bytes, | 914 | ret = blk_rq_map_kern(io->req->q, io->req, seg->buff, seg->total_bytes, |
935 | or->alloc_flags); | 915 | or->alloc_flags); |
936 | if (ret) | 916 | if (ret) |
937 | return ret; | 917 | return ret; |
@@ -1293,6 +1273,21 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or, | |||
1293 | /* | 1273 | /* |
1294 | * osd_finalize_request and helpers | 1274 | * osd_finalize_request and helpers |
1295 | */ | 1275 | */ |
1276 | static struct request *_make_request(struct request_queue *q, bool has_write, | ||
1277 | struct _osd_io_info *oii, gfp_t flags) | ||
1278 | { | ||
1279 | if (oii->bio) | ||
1280 | return blk_make_request(q, oii->bio, flags); | ||
1281 | else { | ||
1282 | struct request *req; | ||
1283 | |||
1284 | req = blk_get_request(q, has_write ? WRITE : READ, flags); | ||
1285 | if (unlikely(!req)) | ||
1286 | return ERR_PTR(-ENOMEM); | ||
1287 | |||
1288 | return req; | ||
1289 | } | ||
1290 | } | ||
1296 | 1291 | ||
1297 | static int _init_blk_request(struct osd_request *or, | 1292 | static int _init_blk_request(struct osd_request *or, |
1298 | bool has_in, bool has_out) | 1293 | bool has_in, bool has_out) |
@@ -1301,11 +1296,13 @@ static int _init_blk_request(struct osd_request *or, | |||
1301 | struct scsi_device *scsi_device = or->osd_dev->scsi_device; | 1296 | struct scsi_device *scsi_device = or->osd_dev->scsi_device; |
1302 | struct request_queue *q = scsi_device->request_queue; | 1297 | struct request_queue *q = scsi_device->request_queue; |
1303 | struct request *req; | 1298 | struct request *req; |
1304 | int ret = -ENOMEM; | 1299 | int ret; |
1305 | 1300 | ||
1306 | req = blk_get_request(q, has_out, flags); | 1301 | req = _make_request(q, has_out, has_out ? &or->out : &or->in, flags); |
1307 | if (!req) | 1302 | if (IS_ERR(req)) { |
1303 | ret = PTR_ERR(req); | ||
1308 | goto out; | 1304 | goto out; |
1305 | } | ||
1309 | 1306 | ||
1310 | or->request = req; | 1307 | or->request = req; |
1311 | req->cmd_type = REQ_TYPE_BLOCK_PC; | 1308 | req->cmd_type = REQ_TYPE_BLOCK_PC; |
@@ -1318,9 +1315,10 @@ static int _init_blk_request(struct osd_request *or, | |||
1318 | or->out.req = req; | 1315 | or->out.req = req; |
1319 | if (has_in) { | 1316 | if (has_in) { |
1320 | /* allocate bidi request */ | 1317 | /* allocate bidi request */ |
1321 | req = blk_get_request(q, READ, flags); | 1318 | req = _make_request(q, false, &or->in, flags); |
1322 | if (!req) { | 1319 | if (IS_ERR(req)) { |
1323 | OSD_DEBUG("blk_get_request for bidi failed\n"); | 1320 | OSD_DEBUG("blk_get_request for bidi failed\n"); |
1321 | ret = PTR_ERR(req); | ||
1324 | goto out; | 1322 | goto out; |
1325 | } | 1323 | } |
1326 | req->cmd_type = REQ_TYPE_BLOCK_PC; | 1324 | req->cmd_type = REQ_TYPE_BLOCK_PC; |
@@ -1364,26 +1362,6 @@ int osd_finalize_request(struct osd_request *or, | |||
1364 | return ret; | 1362 | return ret; |
1365 | } | 1363 | } |
1366 | 1364 | ||
1367 | if (or->out.bio) { | ||
1368 | ret = blk_rq_append_bio(or->request->q, or->out.req, | ||
1369 | or->out.bio); | ||
1370 | if (ret) { | ||
1371 | OSD_DEBUG("blk_rq_append_bio out failed\n"); | ||
1372 | return ret; | ||
1373 | } | ||
1374 | OSD_DEBUG("out bytes=%llu (bytes_req=%u)\n", | ||
1375 | _LLU(or->out.total_bytes), or->out.req->data_len); | ||
1376 | } | ||
1377 | if (or->in.bio) { | ||
1378 | ret = blk_rq_append_bio(or->request->q, or->in.req, or->in.bio); | ||
1379 | if (ret) { | ||
1380 | OSD_DEBUG("blk_rq_append_bio in failed\n"); | ||
1381 | return ret; | ||
1382 | } | ||
1383 | OSD_DEBUG("in bytes=%llu (bytes_req=%u)\n", | ||
1384 | _LLU(or->in.total_bytes), or->in.req->data_len); | ||
1385 | } | ||
1386 | |||
1387 | or->out.pad_buff = sg_out_pad_buffer; | 1365 | or->out.pad_buff = sg_out_pad_buffer; |
1388 | or->in.pad_buff = sg_in_pad_buffer; | 1366 | or->in.pad_buff = sg_in_pad_buffer; |
1389 | 1367 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index bb218c8b6e9..dd3f9d2b99f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -240,11 +240,11 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, | |||
240 | * is invalid. Prevent the garbage from being misinterpreted | 240 | * is invalid. Prevent the garbage from being misinterpreted |
241 | * and prevent security leaks by zeroing out the excess data. | 241 | * and prevent security leaks by zeroing out the excess data. |
242 | */ | 242 | */ |
243 | if (unlikely(req->data_len > 0 && req->data_len <= bufflen)) | 243 | if (unlikely(req->resid_len > 0 && req->resid_len <= bufflen)) |
244 | memset(buffer + (bufflen - req->data_len), 0, req->data_len); | 244 | memset(buffer + (bufflen - req->resid_len), 0, req->resid_len); |
245 | 245 | ||
246 | if (resid) | 246 | if (resid) |
247 | *resid = req->data_len; | 247 | *resid = req->resid_len; |
248 | ret = req->errors; | 248 | ret = req->errors; |
249 | out: | 249 | out: |
250 | blk_put_request(req); | 250 | blk_put_request(req); |
@@ -546,14 +546,9 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, | |||
546 | * to queue the remainder of them. | 546 | * to queue the remainder of them. |
547 | */ | 547 | */ |
548 | if (blk_end_request(req, error, bytes)) { | 548 | if (blk_end_request(req, error, bytes)) { |
549 | int leftover = (req->hard_nr_sectors << 9); | ||
550 | |||
551 | if (blk_pc_request(req)) | ||
552 | leftover = req->data_len; | ||
553 | |||
554 | /* kill remainder if no retrys */ | 549 | /* kill remainder if no retrys */ |
555 | if (error && scsi_noretry_cmd(cmd)) | 550 | if (error && scsi_noretry_cmd(cmd)) |
556 | blk_end_request(req, error, leftover); | 551 | blk_end_request_all(req, error); |
557 | else { | 552 | else { |
558 | if (requeue) { | 553 | if (requeue) { |
559 | /* | 554 | /* |
@@ -673,34 +668,6 @@ void scsi_release_buffers(struct scsi_cmnd *cmd) | |||
673 | EXPORT_SYMBOL(scsi_release_buffers); | 668 | EXPORT_SYMBOL(scsi_release_buffers); |
674 | 669 | ||
675 | /* | 670 | /* |
676 | * Bidi commands Must be complete as a whole, both sides at once. | ||
677 | * If part of the bytes were written and lld returned | ||
678 | * scsi_in()->resid and/or scsi_out()->resid this information will be left | ||
679 | * in req->data_len and req->next_rq->data_len. The upper-layer driver can | ||
680 | * decide what to do with this information. | ||
681 | */ | ||
682 | static void scsi_end_bidi_request(struct scsi_cmnd *cmd) | ||
683 | { | ||
684 | struct request *req = cmd->request; | ||
685 | unsigned int dlen = req->data_len; | ||
686 | unsigned int next_dlen = req->next_rq->data_len; | ||
687 | |||
688 | req->data_len = scsi_out(cmd)->resid; | ||
689 | req->next_rq->data_len = scsi_in(cmd)->resid; | ||
690 | |||
691 | /* The req and req->next_rq have not been completed */ | ||
692 | BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen)); | ||
693 | |||
694 | scsi_release_buffers(cmd); | ||
695 | |||
696 | /* | ||
697 | * This will goose the queue request function at the end, so we don't | ||
698 | * need to worry about launching another command. | ||
699 | */ | ||
700 | scsi_next_command(cmd); | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | * Function: scsi_io_completion() | 671 | * Function: scsi_io_completion() |
705 | * | 672 | * |
706 | * Purpose: Completion processing for block device I/O requests. | 673 | * Purpose: Completion processing for block device I/O requests. |
@@ -739,7 +706,6 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd) | |||
739 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | 706 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) |
740 | { | 707 | { |
741 | int result = cmd->result; | 708 | int result = cmd->result; |
742 | int this_count; | ||
743 | struct request_queue *q = cmd->device->request_queue; | 709 | struct request_queue *q = cmd->device->request_queue; |
744 | struct request *req = cmd->request; | 710 | struct request *req = cmd->request; |
745 | int error = 0; | 711 | int error = 0; |
@@ -773,12 +739,22 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
773 | if (!sense_deferred) | 739 | if (!sense_deferred) |
774 | error = -EIO; | 740 | error = -EIO; |
775 | } | 741 | } |
742 | |||
743 | req->resid_len = scsi_get_resid(cmd); | ||
744 | |||
776 | if (scsi_bidi_cmnd(cmd)) { | 745 | if (scsi_bidi_cmnd(cmd)) { |
777 | /* will also release_buffers */ | 746 | /* |
778 | scsi_end_bidi_request(cmd); | 747 | * Bidi commands Must be complete as a whole, |
748 | * both sides at once. | ||
749 | */ | ||
750 | req->next_rq->resid_len = scsi_in(cmd)->resid; | ||
751 | |||
752 | blk_end_request_all(req, 0); | ||
753 | |||
754 | scsi_release_buffers(cmd); | ||
755 | scsi_next_command(cmd); | ||
779 | return; | 756 | return; |
780 | } | 757 | } |
781 | req->data_len = scsi_get_resid(cmd); | ||
782 | } | 758 | } |
783 | 759 | ||
784 | BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */ | 760 | BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */ |
@@ -787,9 +763,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
787 | * Next deal with any sectors which we were able to correctly | 763 | * Next deal with any sectors which we were able to correctly |
788 | * handle. | 764 | * handle. |
789 | */ | 765 | */ |
790 | SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, " | 766 | SCSI_LOG_HLCOMPLETE(1, printk("%u sectors total, " |
791 | "%d bytes done.\n", | 767 | "%d bytes done.\n", |
792 | req->nr_sectors, good_bytes)); | 768 | blk_rq_sectors(req), good_bytes)); |
793 | 769 | ||
794 | /* | 770 | /* |
795 | * Recovered errors need reporting, but they're always treated | 771 | * Recovered errors need reporting, but they're always treated |
@@ -812,7 +788,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
812 | */ | 788 | */ |
813 | if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) | 789 | if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) |
814 | return; | 790 | return; |
815 | this_count = blk_rq_bytes(req); | ||
816 | 791 | ||
817 | error = -EIO; | 792 | error = -EIO; |
818 | 793 | ||
@@ -922,7 +897,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
922 | if (driver_byte(result) & DRIVER_SENSE) | 897 | if (driver_byte(result) & DRIVER_SENSE) |
923 | scsi_print_sense("", cmd); | 898 | scsi_print_sense("", cmd); |
924 | } | 899 | } |
925 | blk_end_request(req, -EIO, blk_rq_bytes(req)); | 900 | blk_end_request_all(req, -EIO); |
926 | scsi_next_command(cmd); | 901 | scsi_next_command(cmd); |
927 | break; | 902 | break; |
928 | case ACTION_REPREP: | 903 | case ACTION_REPREP: |
@@ -965,10 +940,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
965 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); | 940 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); |
966 | BUG_ON(count > sdb->table.nents); | 941 | BUG_ON(count > sdb->table.nents); |
967 | sdb->table.nents = count; | 942 | sdb->table.nents = count; |
968 | if (blk_pc_request(req)) | 943 | sdb->length = blk_rq_bytes(req); |
969 | sdb->length = req->data_len; | ||
970 | else | ||
971 | sdb->length = req->nr_sectors << 9; | ||
972 | return BLKPREP_OK; | 944 | return BLKPREP_OK; |
973 | } | 945 | } |
974 | 946 | ||
@@ -1087,22 +1059,21 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1087 | if (unlikely(ret)) | 1059 | if (unlikely(ret)) |
1088 | return ret; | 1060 | return ret; |
1089 | } else { | 1061 | } else { |
1090 | BUG_ON(req->data_len); | 1062 | BUG_ON(blk_rq_bytes(req)); |
1091 | BUG_ON(req->data); | ||
1092 | 1063 | ||
1093 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); | 1064 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); |
1094 | req->buffer = NULL; | 1065 | req->buffer = NULL; |
1095 | } | 1066 | } |
1096 | 1067 | ||
1097 | cmd->cmd_len = req->cmd_len; | 1068 | cmd->cmd_len = req->cmd_len; |
1098 | if (!req->data_len) | 1069 | if (!blk_rq_bytes(req)) |
1099 | cmd->sc_data_direction = DMA_NONE; | 1070 | cmd->sc_data_direction = DMA_NONE; |
1100 | else if (rq_data_dir(req) == WRITE) | 1071 | else if (rq_data_dir(req) == WRITE) |
1101 | cmd->sc_data_direction = DMA_TO_DEVICE; | 1072 | cmd->sc_data_direction = DMA_TO_DEVICE; |
1102 | else | 1073 | else |
1103 | cmd->sc_data_direction = DMA_FROM_DEVICE; | 1074 | cmd->sc_data_direction = DMA_FROM_DEVICE; |
1104 | 1075 | ||
1105 | cmd->transfersize = req->data_len; | 1076 | cmd->transfersize = blk_rq_bytes(req); |
1106 | cmd->allowed = req->retries; | 1077 | cmd->allowed = req->retries; |
1107 | return BLKPREP_OK; | 1078 | return BLKPREP_OK; |
1108 | } | 1079 | } |
@@ -1212,7 +1183,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret) | |||
1212 | break; | 1183 | break; |
1213 | case BLKPREP_DEFER: | 1184 | case BLKPREP_DEFER: |
1214 | /* | 1185 | /* |
1215 | * If we defer, the elv_next_request() returns NULL, but the | 1186 | * If we defer, the blk_peek_request() returns NULL, but the |
1216 | * queue must be restarted, so we plug here if no returning | 1187 | * queue must be restarted, so we plug here if no returning |
1217 | * command will automatically do that. | 1188 | * command will automatically do that. |
1218 | */ | 1189 | */ |
@@ -1388,7 +1359,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) | |||
1388 | struct scsi_target *starget = scsi_target(sdev); | 1359 | struct scsi_target *starget = scsi_target(sdev); |
1389 | struct Scsi_Host *shost = sdev->host; | 1360 | struct Scsi_Host *shost = sdev->host; |
1390 | 1361 | ||
1391 | blkdev_dequeue_request(req); | 1362 | blk_start_request(req); |
1392 | 1363 | ||
1393 | if (unlikely(cmd == NULL)) { | 1364 | if (unlikely(cmd == NULL)) { |
1394 | printk(KERN_CRIT "impossible request in %s.\n", | 1365 | printk(KERN_CRIT "impossible request in %s.\n", |
@@ -1480,7 +1451,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1480 | 1451 | ||
1481 | if (!sdev) { | 1452 | if (!sdev) { |
1482 | printk("scsi: killing requests for dead queue\n"); | 1453 | printk("scsi: killing requests for dead queue\n"); |
1483 | while ((req = elv_next_request(q)) != NULL) | 1454 | while ((req = blk_peek_request(q)) != NULL) |
1484 | scsi_kill_request(req, q); | 1455 | scsi_kill_request(req, q); |
1485 | return; | 1456 | return; |
1486 | } | 1457 | } |
@@ -1501,7 +1472,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1501 | * that the request is fully prepared even if we cannot | 1472 | * that the request is fully prepared even if we cannot |
1502 | * accept it. | 1473 | * accept it. |
1503 | */ | 1474 | */ |
1504 | req = elv_next_request(q); | 1475 | req = blk_peek_request(q); |
1505 | if (!req || !scsi_dev_queue_ready(q, sdev)) | 1476 | if (!req || !scsi_dev_queue_ready(q, sdev)) |
1506 | break; | 1477 | break; |
1507 | 1478 | ||
@@ -1517,7 +1488,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1517 | * Remove the request from the request list. | 1488 | * Remove the request from the request list. |
1518 | */ | 1489 | */ |
1519 | if (!(blk_queue_tagged(q) && !blk_queue_start_tag(q, req))) | 1490 | if (!(blk_queue_tagged(q) && !blk_queue_start_tag(q, req))) |
1520 | blkdev_dequeue_request(req); | 1491 | blk_start_request(req); |
1521 | sdev->device_busy++; | 1492 | sdev->device_busy++; |
1522 | 1493 | ||
1523 | spin_unlock(q->queue_lock); | 1494 | spin_unlock(q->queue_lock); |
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index 48ba413f7f6..10303272ba4 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c | |||
@@ -387,7 +387,7 @@ static int scsi_map_user_pages(struct scsi_tgt_cmd *tcmd, struct scsi_cmnd *cmd, | |||
387 | * we use REQ_TYPE_BLOCK_PC so scsi_init_io doesn't set the | 387 | * we use REQ_TYPE_BLOCK_PC so scsi_init_io doesn't set the |
388 | * length for us. | 388 | * length for us. |
389 | */ | 389 | */ |
390 | cmd->sdb.length = rq->data_len; | 390 | cmd->sdb.length = blk_rq_bytes(rq); |
391 | 391 | ||
392 | return 0; | 392 | return 0; |
393 | 393 | ||
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 50988cbf7b2..d606452297c 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -163,12 +163,10 @@ static void sas_smp_request(struct request_queue *q, struct Scsi_Host *shost, | |||
163 | int (*handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); | 163 | int (*handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); |
164 | 164 | ||
165 | while (!blk_queue_plugged(q)) { | 165 | while (!blk_queue_plugged(q)) { |
166 | req = elv_next_request(q); | 166 | req = blk_fetch_request(q); |
167 | if (!req) | 167 | if (!req) |
168 | break; | 168 | break; |
169 | 169 | ||
170 | blkdev_dequeue_request(req); | ||
171 | |||
172 | spin_unlock_irq(q->queue_lock); | 170 | spin_unlock_irq(q->queue_lock); |
173 | 171 | ||
174 | handler = to_sas_internal(shost->transportt)->f->smp_handler; | 172 | handler = to_sas_internal(shost->transportt)->f->smp_handler; |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 84044233b63..bcf3bd40bbd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -384,9 +384,9 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
384 | struct scsi_device *sdp = q->queuedata; | 384 | struct scsi_device *sdp = q->queuedata; |
385 | struct gendisk *disk = rq->rq_disk; | 385 | struct gendisk *disk = rq->rq_disk; |
386 | struct scsi_disk *sdkp; | 386 | struct scsi_disk *sdkp; |
387 | sector_t block = rq->sector; | 387 | sector_t block = blk_rq_pos(rq); |
388 | sector_t threshold; | 388 | sector_t threshold; |
389 | unsigned int this_count = rq->nr_sectors; | 389 | unsigned int this_count = blk_rq_sectors(rq); |
390 | int ret, host_dif; | 390 | int ret, host_dif; |
391 | 391 | ||
392 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | 392 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
@@ -413,10 +413,10 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
413 | this_count)); | 413 | this_count)); |
414 | 414 | ||
415 | if (!sdp || !scsi_device_online(sdp) || | 415 | if (!sdp || !scsi_device_online(sdp) || |
416 | block + rq->nr_sectors > get_capacity(disk)) { | 416 | block + blk_rq_sectors(rq) > get_capacity(disk)) { |
417 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, | 417 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, |
418 | "Finishing %ld sectors\n", | 418 | "Finishing %u sectors\n", |
419 | rq->nr_sectors)); | 419 | blk_rq_sectors(rq))); |
420 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, | 420 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, |
421 | "Retry with 0x%p\n", SCpnt)); | 421 | "Retry with 0x%p\n", SCpnt)); |
422 | goto out; | 422 | goto out; |
@@ -463,7 +463,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
463 | * for this. | 463 | * for this. |
464 | */ | 464 | */ |
465 | if (sdp->sector_size == 1024) { | 465 | if (sdp->sector_size == 1024) { |
466 | if ((block & 1) || (rq->nr_sectors & 1)) { | 466 | if ((block & 1) || (blk_rq_sectors(rq) & 1)) { |
467 | scmd_printk(KERN_ERR, SCpnt, | 467 | scmd_printk(KERN_ERR, SCpnt, |
468 | "Bad block number requested\n"); | 468 | "Bad block number requested\n"); |
469 | goto out; | 469 | goto out; |
@@ -473,7 +473,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
473 | } | 473 | } |
474 | } | 474 | } |
475 | if (sdp->sector_size == 2048) { | 475 | if (sdp->sector_size == 2048) { |
476 | if ((block & 3) || (rq->nr_sectors & 3)) { | 476 | if ((block & 3) || (blk_rq_sectors(rq) & 3)) { |
477 | scmd_printk(KERN_ERR, SCpnt, | 477 | scmd_printk(KERN_ERR, SCpnt, |
478 | "Bad block number requested\n"); | 478 | "Bad block number requested\n"); |
479 | goto out; | 479 | goto out; |
@@ -483,7 +483,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
483 | } | 483 | } |
484 | } | 484 | } |
485 | if (sdp->sector_size == 4096) { | 485 | if (sdp->sector_size == 4096) { |
486 | if ((block & 7) || (rq->nr_sectors & 7)) { | 486 | if ((block & 7) || (blk_rq_sectors(rq) & 7)) { |
487 | scmd_printk(KERN_ERR, SCpnt, | 487 | scmd_printk(KERN_ERR, SCpnt, |
488 | "Bad block number requested\n"); | 488 | "Bad block number requested\n"); |
489 | goto out; | 489 | goto out; |
@@ -512,10 +512,10 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
512 | } | 512 | } |
513 | 513 | ||
514 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, | 514 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, |
515 | "%s %d/%ld 512 byte blocks.\n", | 515 | "%s %d/%u 512 byte blocks.\n", |
516 | (rq_data_dir(rq) == WRITE) ? | 516 | (rq_data_dir(rq) == WRITE) ? |
517 | "writing" : "reading", this_count, | 517 | "writing" : "reading", this_count, |
518 | rq->nr_sectors)); | 518 | blk_rq_sectors(rq))); |
519 | 519 | ||
520 | /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */ | 520 | /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */ |
521 | host_dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); | 521 | host_dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); |
@@ -971,8 +971,8 @@ static struct block_device_operations sd_fops = { | |||
971 | 971 | ||
972 | static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | 972 | static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) |
973 | { | 973 | { |
974 | u64 start_lba = scmd->request->sector; | 974 | u64 start_lba = blk_rq_pos(scmd->request); |
975 | u64 end_lba = scmd->request->sector + (scsi_bufflen(scmd) / 512); | 975 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); |
976 | u64 bad_lba; | 976 | u64 bad_lba; |
977 | int info_valid; | 977 | int info_valid; |
978 | 978 | ||
@@ -1510,7 +1510,7 @@ got_data: | |||
1510 | */ | 1510 | */ |
1511 | sector_size = 512; | 1511 | sector_size = 512; |
1512 | } | 1512 | } |
1513 | blk_queue_hardsect_size(sdp->request_queue, sector_size); | 1513 | blk_queue_logical_block_size(sdp->request_queue, sector_size); |
1514 | 1514 | ||
1515 | { | 1515 | { |
1516 | char cap_str_2[10], cap_str_10[10]; | 1516 | char cap_str_2[10], cap_str_10[10]; |
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c index 184dff49279..82f14a9482d 100644 --- a/drivers/scsi/sd_dif.c +++ b/drivers/scsi/sd_dif.c | |||
@@ -507,7 +507,7 @@ void sd_dif_complete(struct scsi_cmnd *scmd, unsigned int good_bytes) | |||
507 | sector_sz = scmd->device->sector_size; | 507 | sector_sz = scmd->device->sector_size; |
508 | sectors = good_bytes / sector_sz; | 508 | sectors = good_bytes / sector_sz; |
509 | 509 | ||
510 | phys = scmd->request->sector & 0xffffffff; | 510 | phys = blk_rq_pos(scmd->request) & 0xffffffff; |
511 | if (sector_sz == 4096) | 511 | if (sector_sz == 4096) |
512 | phys >>= 3; | 512 | phys >>= 3; |
513 | 513 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 91e316fe652..8201387b4da 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -289,8 +289,8 @@ sg_open(struct inode *inode, struct file *filp) | |||
289 | if (list_empty(&sdp->sfds)) { /* no existing opens on this device */ | 289 | if (list_empty(&sdp->sfds)) { /* no existing opens on this device */ |
290 | sdp->sgdebug = 0; | 290 | sdp->sgdebug = 0; |
291 | q = sdp->device->request_queue; | 291 | q = sdp->device->request_queue; |
292 | sdp->sg_tablesize = min(q->max_hw_segments, | 292 | sdp->sg_tablesize = min(queue_max_hw_segments(q), |
293 | q->max_phys_segments); | 293 | queue_max_phys_segments(q)); |
294 | } | 294 | } |
295 | if ((sfp = sg_add_sfp(sdp, dev))) | 295 | if ((sfp = sg_add_sfp(sdp, dev))) |
296 | filp->private_data = sfp; | 296 | filp->private_data = sfp; |
@@ -909,7 +909,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
909 | if (val < 0) | 909 | if (val < 0) |
910 | return -EINVAL; | 910 | return -EINVAL; |
911 | val = min_t(int, val, | 911 | val = min_t(int, val, |
912 | sdp->device->request_queue->max_sectors * 512); | 912 | queue_max_sectors(sdp->device->request_queue) * 512); |
913 | if (val != sfp->reserve.bufflen) { | 913 | if (val != sfp->reserve.bufflen) { |
914 | if (sg_res_in_use(sfp) || sfp->mmap_called) | 914 | if (sg_res_in_use(sfp) || sfp->mmap_called) |
915 | return -EBUSY; | 915 | return -EBUSY; |
@@ -919,7 +919,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
919 | return 0; | 919 | return 0; |
920 | case SG_GET_RESERVED_SIZE: | 920 | case SG_GET_RESERVED_SIZE: |
921 | val = min_t(int, sfp->reserve.bufflen, | 921 | val = min_t(int, sfp->reserve.bufflen, |
922 | sdp->device->request_queue->max_sectors * 512); | 922 | queue_max_sectors(sdp->device->request_queue) * 512); |
923 | return put_user(val, ip); | 923 | return put_user(val, ip); |
924 | case SG_SET_COMMAND_Q: | 924 | case SG_SET_COMMAND_Q: |
925 | result = get_user(val, ip); | 925 | result = get_user(val, ip); |
@@ -1059,7 +1059,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1059 | return -ENODEV; | 1059 | return -ENODEV; |
1060 | return scsi_ioctl(sdp->device, cmd_in, p); | 1060 | return scsi_ioctl(sdp->device, cmd_in, p); |
1061 | case BLKSECTGET: | 1061 | case BLKSECTGET: |
1062 | return put_user(sdp->device->request_queue->max_sectors * 512, | 1062 | return put_user(queue_max_sectors(sdp->device->request_queue) * 512, |
1063 | ip); | 1063 | ip); |
1064 | case BLKTRACESETUP: | 1064 | case BLKTRACESETUP: |
1065 | return blk_trace_setup(sdp->device->request_queue, | 1065 | return blk_trace_setup(sdp->device->request_queue, |
@@ -1261,7 +1261,7 @@ static void sg_rq_end_io(struct request *rq, int uptodate) | |||
1261 | 1261 | ||
1262 | sense = rq->sense; | 1262 | sense = rq->sense; |
1263 | result = rq->errors; | 1263 | result = rq->errors; |
1264 | resid = rq->data_len; | 1264 | resid = rq->resid_len; |
1265 | 1265 | ||
1266 | SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n", | 1266 | SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n", |
1267 | sdp->disk->disk_name, srp->header.pack_id, result)); | 1267 | sdp->disk->disk_name, srp->header.pack_id, result)); |
@@ -1378,7 +1378,8 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
1378 | sdp->device = scsidp; | 1378 | sdp->device = scsidp; |
1379 | INIT_LIST_HEAD(&sdp->sfds); | 1379 | INIT_LIST_HEAD(&sdp->sfds); |
1380 | init_waitqueue_head(&sdp->o_excl_wait); | 1380 | init_waitqueue_head(&sdp->o_excl_wait); |
1381 | sdp->sg_tablesize = min(q->max_hw_segments, q->max_phys_segments); | 1381 | sdp->sg_tablesize = min(queue_max_hw_segments(q), |
1382 | queue_max_phys_segments(q)); | ||
1382 | sdp->index = k; | 1383 | sdp->index = k; |
1383 | kref_init(&sdp->d_ref); | 1384 | kref_init(&sdp->d_ref); |
1384 | 1385 | ||
@@ -2056,7 +2057,7 @@ sg_add_sfp(Sg_device * sdp, int dev) | |||
2056 | sg_big_buff = def_reserved_size; | 2057 | sg_big_buff = def_reserved_size; |
2057 | 2058 | ||
2058 | bufflen = min_t(int, sg_big_buff, | 2059 | bufflen = min_t(int, sg_big_buff, |
2059 | sdp->device->request_queue->max_sectors * 512); | 2060 | queue_max_sectors(sdp->device->request_queue) * 512); |
2060 | sg_build_reserve(sfp, bufflen); | 2061 | sg_build_reserve(sfp, bufflen); |
2061 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n", | 2062 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n", |
2062 | sfp->reserve.bufflen, sfp->reserve.k_use_sg)); | 2063 | sfp->reserve.bufflen, sfp->reserve.k_use_sg)); |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 0e1a0f2d2ad..cd350dfc121 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -292,7 +292,8 @@ static int sr_done(struct scsi_cmnd *SCpnt) | |||
292 | if (cd->device->sector_size == 2048) | 292 | if (cd->device->sector_size == 2048) |
293 | error_sector <<= 2; | 293 | error_sector <<= 2; |
294 | error_sector &= ~(block_sectors - 1); | 294 | error_sector &= ~(block_sectors - 1); |
295 | good_bytes = (error_sector - SCpnt->request->sector) << 9; | 295 | good_bytes = (error_sector - |
296 | blk_rq_pos(SCpnt->request)) << 9; | ||
296 | if (good_bytes < 0 || good_bytes >= this_count) | 297 | if (good_bytes < 0 || good_bytes >= this_count) |
297 | good_bytes = 0; | 298 | good_bytes = 0; |
298 | /* | 299 | /* |
@@ -349,8 +350,8 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
349 | cd->disk->disk_name, block)); | 350 | cd->disk->disk_name, block)); |
350 | 351 | ||
351 | if (!cd->device || !scsi_device_online(cd->device)) { | 352 | if (!cd->device || !scsi_device_online(cd->device)) { |
352 | SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n", | 353 | SCSI_LOG_HLQUEUE(2, printk("Finishing %u sectors\n", |
353 | rq->nr_sectors)); | 354 | blk_rq_sectors(rq))); |
354 | SCSI_LOG_HLQUEUE(2, printk("Retry with 0x%p\n", SCpnt)); | 355 | SCSI_LOG_HLQUEUE(2, printk("Retry with 0x%p\n", SCpnt)); |
355 | goto out; | 356 | goto out; |
356 | } | 357 | } |
@@ -413,7 +414,7 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
413 | /* | 414 | /* |
414 | * request doesn't start on hw block boundary, add scatter pads | 415 | * request doesn't start on hw block boundary, add scatter pads |
415 | */ | 416 | */ |
416 | if (((unsigned int)rq->sector % (s_size >> 9)) || | 417 | if (((unsigned int)blk_rq_pos(rq) % (s_size >> 9)) || |
417 | (scsi_bufflen(SCpnt) % s_size)) { | 418 | (scsi_bufflen(SCpnt) % s_size)) { |
418 | scmd_printk(KERN_NOTICE, SCpnt, "unaligned transfer\n"); | 419 | scmd_printk(KERN_NOTICE, SCpnt, "unaligned transfer\n"); |
419 | goto out; | 420 | goto out; |
@@ -422,14 +423,14 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
422 | this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9); | 423 | this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9); |
423 | 424 | ||
424 | 425 | ||
425 | SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n", | 426 | SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%u 512 byte blocks.\n", |
426 | cd->cdi.name, | 427 | cd->cdi.name, |
427 | (rq_data_dir(rq) == WRITE) ? | 428 | (rq_data_dir(rq) == WRITE) ? |
428 | "writing" : "reading", | 429 | "writing" : "reading", |
429 | this_count, rq->nr_sectors)); | 430 | this_count, blk_rq_sectors(rq))); |
430 | 431 | ||
431 | SCpnt->cmnd[1] = 0; | 432 | SCpnt->cmnd[1] = 0; |
432 | block = (unsigned int)rq->sector / (s_size >> 9); | 433 | block = (unsigned int)blk_rq_pos(rq) / (s_size >> 9); |
433 | 434 | ||
434 | if (this_count > 0xffff) { | 435 | if (this_count > 0xffff) { |
435 | this_count = 0xffff; | 436 | this_count = 0xffff; |
@@ -726,7 +727,7 @@ static void get_sectorsize(struct scsi_cd *cd) | |||
726 | } | 727 | } |
727 | 728 | ||
728 | queue = cd->device->request_queue; | 729 | queue = cd->device->request_queue; |
729 | blk_queue_hardsect_size(queue, sector_size); | 730 | blk_queue_logical_block_size(queue, sector_size); |
730 | 731 | ||
731 | return; | 732 | return; |
732 | } | 733 | } |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index eb24efea8f1..89bd438e1fe 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -463,7 +463,7 @@ static void st_scsi_execute_end(struct request *req, int uptodate) | |||
463 | struct scsi_tape *STp = SRpnt->stp; | 463 | struct scsi_tape *STp = SRpnt->stp; |
464 | 464 | ||
465 | STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors; | 465 | STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors; |
466 | STp->buffer->cmdstat.residual = req->data_len; | 466 | STp->buffer->cmdstat.residual = req->resid_len; |
467 | 467 | ||
468 | if (SRpnt->waiting) | 468 | if (SRpnt->waiting) |
469 | complete(SRpnt->waiting); | 469 | complete(SRpnt->waiting); |
@@ -3983,8 +3983,8 @@ static int st_probe(struct device *dev) | |||
3983 | return -ENODEV; | 3983 | return -ENODEV; |
3984 | } | 3984 | } |
3985 | 3985 | ||
3986 | i = min(SDp->request_queue->max_hw_segments, | 3986 | i = min(queue_max_hw_segments(SDp->request_queue), |
3987 | SDp->request_queue->max_phys_segments); | 3987 | queue_max_phys_segments(SDp->request_queue)); |
3988 | if (st_max_sg_segs < i) | 3988 | if (st_max_sg_segs < i) |
3989 | i = st_max_sg_segs; | 3989 | i = st_max_sg_segs; |
3990 | buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i); | 3990 | buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i); |
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 601e95141cb..54023d41fd1 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c | |||
@@ -1306,7 +1306,7 @@ static int u14_34f_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scs | |||
1306 | if (linked_comm && SCpnt->device->queue_depth > 2 | 1306 | if (linked_comm && SCpnt->device->queue_depth > 2 |
1307 | && TLDEV(SCpnt->device->type)) { | 1307 | && TLDEV(SCpnt->device->type)) { |
1308 | HD(j)->cp_stat[i] = READY; | 1308 | HD(j)->cp_stat[i] = READY; |
1309 | flush_dev(SCpnt->device, SCpnt->request->sector, j, FALSE); | 1309 | flush_dev(SCpnt->device, blk_rq_pos(SCpnt->request), j, FALSE); |
1310 | return 0; | 1310 | return 0; |
1311 | } | 1311 | } |
1312 | 1312 | ||
@@ -1610,11 +1610,13 @@ static int reorder(unsigned int j, unsigned long cursec, | |||
1610 | 1610 | ||
1611 | if (!(cpp->xdir == DTD_IN)) input_only = FALSE; | 1611 | if (!(cpp->xdir == DTD_IN)) input_only = FALSE; |
1612 | 1612 | ||
1613 | if (SCpnt->request->sector < minsec) minsec = SCpnt->request->sector; | 1613 | if (blk_rq_pos(SCpnt->request) < minsec) |
1614 | if (SCpnt->request->sector > maxsec) maxsec = SCpnt->request->sector; | 1614 | minsec = blk_rq_pos(SCpnt->request); |
1615 | if (blk_rq_pos(SCpnt->request) > maxsec) | ||
1616 | maxsec = blk_rq_pos(SCpnt->request); | ||
1615 | 1617 | ||
1616 | sl[n] = SCpnt->request->sector; | 1618 | sl[n] = blk_rq_pos(SCpnt->request); |
1617 | ioseek += SCpnt->request->nr_sectors; | 1619 | ioseek += blk_rq_sectors(SCpnt->request); |
1618 | 1620 | ||
1619 | if (!n) continue; | 1621 | if (!n) continue; |
1620 | 1622 | ||
@@ -1642,7 +1644,7 @@ static int reorder(unsigned int j, unsigned long cursec, | |||
1642 | 1644 | ||
1643 | if (!input_only) for (n = 0; n < n_ready; n++) { | 1645 | if (!input_only) for (n = 0; n < n_ready; n++) { |
1644 | k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; | 1646 | k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; |
1645 | ll[n] = SCpnt->request->nr_sectors; pl[n] = SCpnt->serial_number; | 1647 | ll[n] = blk_rq_sectors(SCpnt->request); pl[n] = SCpnt->serial_number; |
1646 | 1648 | ||
1647 | if (!n) continue; | 1649 | if (!n) continue; |
1648 | 1650 | ||
@@ -1666,12 +1668,12 @@ static int reorder(unsigned int j, unsigned long cursec, | |||
1666 | if (link_statistics && (overlap || !(flushcount % link_statistics))) | 1668 | if (link_statistics && (overlap || !(flushcount % link_statistics))) |
1667 | for (n = 0; n < n_ready; n++) { | 1669 | for (n = 0; n < n_ready; n++) { |
1668 | k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; | 1670 | k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; |
1669 | printk("%s %d.%d:%d pid %ld mb %d fc %d nr %d sec %ld ns %ld"\ | 1671 | printk("%s %d.%d:%d pid %ld mb %d fc %d nr %d sec %ld ns %u"\ |
1670 | " cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n", | 1672 | " cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n", |
1671 | (ihdlr ? "ihdlr" : "qcomm"), SCpnt->channel, SCpnt->target, | 1673 | (ihdlr ? "ihdlr" : "qcomm"), SCpnt->channel, SCpnt->target, |
1672 | SCpnt->lun, SCpnt->serial_number, k, flushcount, n_ready, | 1674 | SCpnt->lun, SCpnt->serial_number, k, flushcount, n_ready, |
1673 | SCpnt->request->sector, SCpnt->request->nr_sectors, cursec, | 1675 | blk_rq_pos(SCpnt->request), blk_rq_sectors(SCpnt->request), |
1674 | YESNO(s), YESNO(r), YESNO(rev), YESNO(input_only), | 1676 | cursec, YESNO(s), YESNO(r), YESNO(rev), YESNO(input_only), |
1675 | YESNO(overlap), cpp->xdir); | 1677 | YESNO(overlap), cpp->xdir); |
1676 | } | 1678 | } |
1677 | #endif | 1679 | #endif |
@@ -1799,7 +1801,7 @@ static irqreturn_t ihdlr(unsigned int j) | |||
1799 | 1801 | ||
1800 | if (linked_comm && SCpnt->device->queue_depth > 2 | 1802 | if (linked_comm && SCpnt->device->queue_depth > 2 |
1801 | && TLDEV(SCpnt->device->type)) | 1803 | && TLDEV(SCpnt->device->type)) |
1802 | flush_dev(SCpnt->device, SCpnt->request->sector, j, TRUE); | 1804 | flush_dev(SCpnt->device, blk_rq_pos(SCpnt->request), j, TRUE); |
1803 | 1805 | ||
1804 | tstatus = status_byte(spp->target_status); | 1806 | tstatus = status_byte(spp->target_status); |
1805 | 1807 | ||