diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-06-20 14:15:41 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-20 21:27:14 -0400 |
commit | ca18d6f769d22e931d3ba1e8d1ae81953547a417 (patch) | |
tree | 9ef36b3c1ca48caccbe907d0985a61bd6c86c420 | |
parent | d280bab305431c1836423f3cd6a5ff0e35a601ef (diff) |
block: Make most scsi_req_init() calls implicit
Instead of explicitly calling scsi_req_init() after blk_get_request(),
call that function from inside blk_get_request(). Add an
.initialize_rq_fn() callback function to the block drivers that need
it. Merge the IDE .init_rq_fn() function into .initialize_rq_fn()
because it is too small to keep it as a separate function. Keep the
scsi_req_init() call in ide_prep_sense() because it follows a
blk_rq_init() call.
References: commit 82ed4db499b8 ("block: split scsi_request out of struct request")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/bsg.c | 1 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 3 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 1 | ||||
-rw-r--r-- | drivers/cdrom/cdrom.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-atapi.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-cd_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-devsets.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-ioctls.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-park.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-pm.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 6 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 1 | ||||
-rw-r--r-- | drivers/scsi/osd/osd_initiator.c | 2 | ||||
-rw-r--r-- | drivers/scsi/osst.c | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi_error.c | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 15 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 2 | ||||
-rw-r--r-- | drivers/scsi/st.c | 1 | ||||
-rw-r--r-- | drivers/target/target_core_pscsi.c | 2 | ||||
-rw-r--r-- | fs/nfsd/blocklayout.c | 1 | ||||
-rw-r--r-- | include/scsi/scsi_cmnd.h | 1 |
25 files changed, 20 insertions, 33 deletions
diff --git a/block/bsg.c b/block/bsg.c index 59d02dd31b0c..37663b664666 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -236,7 +236,6 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) | |||
236 | rq = blk_get_request(q, op, GFP_KERNEL); | 236 | rq = blk_get_request(q, op, GFP_KERNEL); |
237 | if (IS_ERR(rq)) | 237 | if (IS_ERR(rq)) |
238 | return rq; | 238 | return rq; |
239 | scsi_req_init(rq); | ||
240 | 239 | ||
241 | ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); | 240 | ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); |
242 | if (ret) | 241 | if (ret) |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 4a294a5f7fab..f96c51f5df40 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -326,7 +326,6 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
326 | if (IS_ERR(rq)) | 326 | if (IS_ERR(rq)) |
327 | return PTR_ERR(rq); | 327 | return PTR_ERR(rq); |
328 | req = scsi_req(rq); | 328 | req = scsi_req(rq); |
329 | scsi_req_init(rq); | ||
330 | 329 | ||
331 | if (hdr->cmd_len > BLK_MAX_CDB) { | 330 | if (hdr->cmd_len > BLK_MAX_CDB) { |
332 | req->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); | 331 | req->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); |
@@ -456,7 +455,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
456 | goto error_free_buffer; | 455 | goto error_free_buffer; |
457 | } | 456 | } |
458 | req = scsi_req(rq); | 457 | req = scsi_req(rq); |
459 | scsi_req_init(rq); | ||
460 | 458 | ||
461 | cmdlen = COMMAND_SIZE(opcode); | 459 | cmdlen = COMMAND_SIZE(opcode); |
462 | 460 | ||
@@ -542,7 +540,6 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, | |||
542 | rq = blk_get_request(q, REQ_OP_SCSI_OUT, __GFP_RECLAIM); | 540 | rq = blk_get_request(q, REQ_OP_SCSI_OUT, __GFP_RECLAIM); |
543 | if (IS_ERR(rq)) | 541 | if (IS_ERR(rq)) |
544 | return PTR_ERR(rq); | 542 | return PTR_ERR(rq); |
545 | scsi_req_init(rq); | ||
546 | rq->timeout = BLK_DEFAULT_SG_TIMEOUT; | 543 | rq->timeout = BLK_DEFAULT_SG_TIMEOUT; |
547 | scsi_req(rq)->cmd[0] = cmd; | 544 | scsi_req(rq)->cmd[0] = cmd; |
548 | scsi_req(rq)->cmd[4] = data; | 545 | scsi_req(rq)->cmd[4] = data; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 26c04baae967..8ef703ccc4b6 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -708,7 +708,6 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command * | |||
708 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); | 708 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); |
709 | if (IS_ERR(rq)) | 709 | if (IS_ERR(rq)) |
710 | return PTR_ERR(rq); | 710 | return PTR_ERR(rq); |
711 | scsi_req_init(rq); | ||
712 | 711 | ||
713 | if (cgc->buflen) { | 712 | if (cgc->buflen) { |
714 | ret = blk_rq_map_kern(q, rq, cgc->buffer, cgc->buflen, | 713 | ret = blk_rq_map_kern(q, rq, cgc->buffer, cgc->buflen, |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index ff19cfc587f0..e36d160c458f 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2201,7 +2201,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2201 | break; | 2201 | break; |
2202 | } | 2202 | } |
2203 | req = scsi_req(rq); | 2203 | req = scsi_req(rq); |
2204 | scsi_req_init(rq); | ||
2205 | 2204 | ||
2206 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); | 2205 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); |
2207 | if (ret) { | 2206 | if (ret) { |
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index d7a49dcfa85e..37f61acf5a35 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -93,7 +93,6 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
93 | int error; | 93 | int error; |
94 | 94 | ||
95 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 95 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
96 | scsi_req_init(rq); | ||
97 | ide_req(rq)->type = ATA_PRIV_MISC; | 96 | ide_req(rq)->type = ATA_PRIV_MISC; |
98 | rq->special = (char *)pc; | 97 | rq->special = (char *)pc; |
99 | 98 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index d55e44ed82b5..81e18f9628d0 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -438,7 +438,6 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
438 | 438 | ||
439 | rq = blk_get_request(drive->queue, | 439 | rq = blk_get_request(drive->queue, |
440 | write ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); | 440 | write ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); |
441 | scsi_req_init(rq); | ||
442 | memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB); | 441 | memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB); |
443 | ide_req(rq)->type = ATA_PRIV_PC; | 442 | ide_req(rq)->type = ATA_PRIV_PC; |
444 | rq->rq_flags |= rq_flags; | 443 | rq->rq_flags |= rq_flags; |
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 55cd736c39c6..9d26c9737e21 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -304,7 +304,6 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi) | |||
304 | int ret; | 304 | int ret; |
305 | 305 | ||
306 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 306 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
307 | scsi_req_init(rq); | ||
308 | ide_req(rq)->type = ATA_PRIV_MISC; | 307 | ide_req(rq)->type = ATA_PRIV_MISC; |
309 | rq->rq_flags = RQF_QUIET; | 308 | rq->rq_flags = RQF_QUIET; |
310 | blk_execute_rq(drive->queue, cd->disk, rq, 0); | 309 | blk_execute_rq(drive->queue, cd->disk, rq, 0); |
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c index 9b69c32ee560..ef7c8c43a380 100644 --- a/drivers/ide/ide-devsets.c +++ b/drivers/ide/ide-devsets.c | |||
@@ -166,7 +166,6 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting, | |||
166 | return setting->set(drive, arg); | 166 | return setting->set(drive, arg); |
167 | 167 | ||
168 | rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM); | 168 | rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM); |
169 | scsi_req_init(rq); | ||
170 | ide_req(rq)->type = ATA_PRIV_MISC; | 169 | ide_req(rq)->type = ATA_PRIV_MISC; |
171 | scsi_req(rq)->cmd_len = 5; | 170 | scsi_req(rq)->cmd_len = 5; |
172 | scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; | 171 | scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 7c06237f3479..241983da5fc4 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -478,7 +478,6 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
478 | return -EBUSY; | 478 | return -EBUSY; |
479 | 479 | ||
480 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 480 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
481 | scsi_req_init(rq); | ||
482 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 481 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
483 | 482 | ||
484 | drive->mult_req = arg; | 483 | drive->mult_req = arg; |
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index 8c0d17297a7a..3661abb16a5f 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -126,7 +126,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
126 | struct request *rq; | 126 | struct request *rq; |
127 | 127 | ||
128 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 128 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
129 | scsi_req_init(rq); | ||
130 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 129 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
131 | blk_execute_rq(drive->queue, NULL, rq, 0); | 130 | blk_execute_rq(drive->queue, NULL, rq, 0); |
132 | err = scsi_req(rq)->result ? -EIO : 0; | 131 | err = scsi_req(rq)->result ? -EIO : 0; |
@@ -224,7 +223,6 @@ static int generic_drive_reset(ide_drive_t *drive) | |||
224 | int ret = 0; | 223 | int ret = 0; |
225 | 224 | ||
226 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 225 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
227 | scsi_req_init(rq); | ||
228 | ide_req(rq)->type = ATA_PRIV_MISC; | 226 | ide_req(rq)->type = ATA_PRIV_MISC; |
229 | scsi_req(rq)->cmd_len = 1; | 227 | scsi_req(rq)->cmd_len = 1; |
230 | scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; | 228 | scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 94e3107f59b9..1f264d5d3f3f 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -32,7 +32,6 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
32 | spin_unlock_irq(&hwif->lock); | 32 | spin_unlock_irq(&hwif->lock); |
33 | 33 | ||
34 | rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM); | 34 | rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM); |
35 | scsi_req_init(rq); | ||
36 | scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; | 35 | scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; |
37 | scsi_req(rq)->cmd_len = 1; | 36 | scsi_req(rq)->cmd_len = 1; |
38 | ide_req(rq)->type = ATA_PRIV_MISC; | 37 | ide_req(rq)->type = ATA_PRIV_MISC; |
@@ -48,7 +47,6 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
48 | * timeout has expired, so power management will be reenabled. | 47 | * timeout has expired, so power management will be reenabled. |
49 | */ | 48 | */ |
50 | rq = blk_get_request(q, REQ_OP_DRV_IN, GFP_NOWAIT); | 49 | rq = blk_get_request(q, REQ_OP_DRV_IN, GFP_NOWAIT); |
51 | scsi_req_init(rq); | ||
52 | if (IS_ERR(rq)) | 50 | if (IS_ERR(rq)) |
53 | goto out; | 51 | goto out; |
54 | 52 | ||
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 08b54bb3b705..544f02d673ca 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -19,7 +19,6 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
19 | 19 | ||
20 | memset(&rqpm, 0, sizeof(rqpm)); | 20 | memset(&rqpm, 0, sizeof(rqpm)); |
21 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 21 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
22 | scsi_req_init(rq); | ||
23 | ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; | 22 | ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; |
24 | rq->special = &rqpm; | 23 | rq->special = &rqpm; |
25 | rqpm.pm_step = IDE_PM_START_SUSPEND; | 24 | rqpm.pm_step = IDE_PM_START_SUSPEND; |
@@ -91,7 +90,6 @@ int generic_ide_resume(struct device *dev) | |||
91 | 90 | ||
92 | memset(&rqpm, 0, sizeof(rqpm)); | 91 | memset(&rqpm, 0, sizeof(rqpm)); |
93 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 92 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
94 | scsi_req_init(rq); | ||
95 | ide_req(rq)->type = ATA_PRIV_PM_RESUME; | 93 | ide_req(rq)->type = ATA_PRIV_PM_RESUME; |
96 | rq->rq_flags |= RQF_PREEMPT; | 94 | rq->rq_flags |= RQF_PREEMPT; |
97 | rq->special = &rqpm; | 95 | rq->special = &rqpm; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index b3f85250dea9..c60e5ffc9231 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -741,12 +741,12 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | static int ide_init_rq(struct request_queue *q, struct request *rq, gfp_t gfp) | 744 | static void ide_initialize_rq(struct request *rq) |
745 | { | 745 | { |
746 | struct ide_request *req = blk_mq_rq_to_pdu(rq); | 746 | struct ide_request *req = blk_mq_rq_to_pdu(rq); |
747 | 747 | ||
748 | scsi_req_init(rq); | ||
748 | req->sreq.sense = req->sense; | 749 | req->sreq.sense = req->sense; |
749 | return 0; | ||
750 | } | 750 | } |
751 | 751 | ||
752 | /* | 752 | /* |
@@ -771,7 +771,7 @@ static int ide_init_queue(ide_drive_t *drive) | |||
771 | return 1; | 771 | return 1; |
772 | 772 | ||
773 | q->request_fn = do_ide_request; | 773 | q->request_fn = do_ide_request; |
774 | q->init_rq_fn = ide_init_rq; | 774 | q->initialize_rq_fn = ide_initialize_rq; |
775 | q->cmd_size = sizeof(struct ide_request); | 775 | q->cmd_size = sizeof(struct ide_request); |
776 | queue_flag_set_unlocked(QUEUE_FLAG_SCSI_PASSTHROUGH, q); | 776 | queue_flag_set_unlocked(QUEUE_FLAG_SCSI_PASSTHROUGH, q); |
777 | if (blk_init_allocated_queue(q) < 0) { | 777 | if (blk_init_allocated_queue(q) < 0) { |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 4d062c568777..fd57e8ccc47a 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -855,7 +855,6 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size) | |||
855 | BUG_ON(size < 0 || size % tape->blk_size); | 855 | BUG_ON(size < 0 || size % tape->blk_size); |
856 | 856 | ||
857 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); | 857 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
858 | scsi_req_init(rq); | ||
859 | ide_req(rq)->type = ATA_PRIV_MISC; | 858 | ide_req(rq)->type = ATA_PRIV_MISC; |
860 | scsi_req(rq)->cmd[13] = cmd; | 859 | scsi_req(rq)->cmd[13] = cmd; |
861 | rq->rq_disk = tape->disk; | 860 | rq->rq_disk = tape->disk; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index ab1a32cdcb0a..4efe4c6e956c 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -433,7 +433,6 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, | |||
433 | rq = blk_get_request(drive->queue, | 433 | rq = blk_get_request(drive->queue, |
434 | (cmd->tf_flags & IDE_TFLAG_WRITE) ? | 434 | (cmd->tf_flags & IDE_TFLAG_WRITE) ? |
435 | REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); | 435 | REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); |
436 | scsi_req_init(rq); | ||
437 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 436 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
438 | 437 | ||
439 | /* | 438 | /* |
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index 1e69a43b279d..ca45bf6d2bdb 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -1574,7 +1574,6 @@ static struct request *_make_request(struct request_queue *q, bool has_write, | |||
1574 | flags); | 1574 | flags); |
1575 | if (IS_ERR(req)) | 1575 | if (IS_ERR(req)) |
1576 | return req; | 1576 | return req; |
1577 | scsi_req_init(req); | ||
1578 | 1577 | ||
1579 | for_each_bio(bio) { | 1578 | for_each_bio(bio) { |
1580 | struct bio *bounce_bio = bio; | 1579 | struct bio *bounce_bio = bio; |
@@ -1619,7 +1618,6 @@ static int _init_blk_request(struct osd_request *or, | |||
1619 | ret = PTR_ERR(req); | 1618 | ret = PTR_ERR(req); |
1620 | goto out; | 1619 | goto out; |
1621 | } | 1620 | } |
1622 | scsi_req_init(req); | ||
1623 | or->in.req = or->request->next_rq = req; | 1621 | or->in.req = or->request->next_rq = req; |
1624 | } | 1622 | } |
1625 | } else if (has_in) | 1623 | } else if (has_in) |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index d54689c9216e..929ee7e88120 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -373,7 +373,6 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd, | |||
373 | return DRIVER_ERROR << 24; | 373 | return DRIVER_ERROR << 24; |
374 | 374 | ||
375 | rq = scsi_req(req); | 375 | rq = scsi_req(req); |
376 | scsi_req_init(req); | ||
377 | req->rq_flags |= RQF_QUIET; | 376 | req->rq_flags |= RQF_QUIET; |
378 | 377 | ||
379 | SRpnt->bio = NULL; | 378 | SRpnt->bio = NULL; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 44904f41924c..304a7158540f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1903,7 +1903,6 @@ static void scsi_eh_lock_door(struct scsi_device *sdev) | |||
1903 | if (IS_ERR(req)) | 1903 | if (IS_ERR(req)) |
1904 | return; | 1904 | return; |
1905 | rq = scsi_req(req); | 1905 | rq = scsi_req(req); |
1906 | scsi_req_init(req); | ||
1907 | 1906 | ||
1908 | rq->cmd[0] = ALLOW_MEDIUM_REMOVAL; | 1907 | rq->cmd[0] = ALLOW_MEDIUM_REMOVAL; |
1909 | rq->cmd[1] = 0; | 1908 | rq->cmd[1] = 0; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index fb18ed284e55..301a7f706c9a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -250,7 +250,6 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, | |||
250 | if (IS_ERR(req)) | 250 | if (IS_ERR(req)) |
251 | return ret; | 251 | return ret; |
252 | rq = scsi_req(req); | 252 | rq = scsi_req(req); |
253 | scsi_req_init(req); | ||
254 | 253 | ||
255 | if (bufflen && blk_rq_map_kern(sdev->request_queue, req, | 254 | if (bufflen && blk_rq_map_kern(sdev->request_queue, req, |
256 | buffer, bufflen, __GFP_RECLAIM)) | 255 | buffer, bufflen, __GFP_RECLAIM)) |
@@ -1117,6 +1116,18 @@ err_exit: | |||
1117 | } | 1116 | } |
1118 | EXPORT_SYMBOL(scsi_init_io); | 1117 | EXPORT_SYMBOL(scsi_init_io); |
1119 | 1118 | ||
1119 | /** | ||
1120 | * scsi_initialize_rq - initialize struct scsi_cmnd.req | ||
1121 | * | ||
1122 | * Called from inside blk_get_request(). | ||
1123 | */ | ||
1124 | void scsi_initialize_rq(struct request *rq) | ||
1125 | { | ||
1126 | scsi_req_init(rq); | ||
1127 | } | ||
1128 | EXPORT_SYMBOL(scsi_initialize_rq); | ||
1129 | |||
1130 | /* Called after a request has been started. */ | ||
1120 | void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) | 1131 | void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) |
1121 | { | 1132 | { |
1122 | void *buf = cmd->sense_buffer; | 1133 | void *buf = cmd->sense_buffer; |
@@ -2124,6 +2135,7 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) | |||
2124 | q->request_fn = scsi_request_fn; | 2135 | q->request_fn = scsi_request_fn; |
2125 | q->init_rq_fn = scsi_init_rq; | 2136 | q->init_rq_fn = scsi_init_rq; |
2126 | q->exit_rq_fn = scsi_exit_rq; | 2137 | q->exit_rq_fn = scsi_exit_rq; |
2138 | q->initialize_rq_fn = scsi_initialize_rq; | ||
2127 | 2139 | ||
2128 | if (blk_init_allocated_queue(q) < 0) { | 2140 | if (blk_init_allocated_queue(q) < 0) { |
2129 | blk_cleanup_queue(q); | 2141 | blk_cleanup_queue(q); |
@@ -2148,6 +2160,7 @@ static const struct blk_mq_ops scsi_mq_ops = { | |||
2148 | #endif | 2160 | #endif |
2149 | .init_request = scsi_init_request, | 2161 | .init_request = scsi_init_request, |
2150 | .exit_request = scsi_exit_request, | 2162 | .exit_request = scsi_exit_request, |
2163 | .initialize_rq_fn = scsi_initialize_rq, | ||
2151 | .map_queues = scsi_map_queues, | 2164 | .map_queues = scsi_map_queues, |
2152 | }; | 2165 | }; |
2153 | 2166 | ||
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index cc970c811bcb..a190c052cd93 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/bsg.h> | 33 | #include <linux/bsg.h> |
34 | 34 | ||
35 | #include <scsi/scsi.h> | 35 | #include <scsi/scsi.h> |
36 | #include <scsi/scsi_cmnd.h> | ||
36 | #include <scsi/scsi_request.h> | 37 | #include <scsi/scsi_request.h> |
37 | #include <scsi/scsi_device.h> | 38 | #include <scsi/scsi_device.h> |
38 | #include <scsi/scsi_host.h> | 39 | #include <scsi/scsi_host.h> |
@@ -230,6 +231,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) | |||
230 | q = blk_alloc_queue(GFP_KERNEL); | 231 | q = blk_alloc_queue(GFP_KERNEL); |
231 | if (!q) | 232 | if (!q) |
232 | return -ENOMEM; | 233 | return -ENOMEM; |
234 | q->initialize_rq_fn = scsi_initialize_rq; | ||
233 | q->cmd_size = sizeof(struct scsi_request); | 235 | q->cmd_size = sizeof(struct scsi_request); |
234 | 236 | ||
235 | if (rphy) { | 237 | if (rphy) { |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f3387c6089c5..21225d62b0c1 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1732,8 +1732,6 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) | |||
1732 | } | 1732 | } |
1733 | req = scsi_req(rq); | 1733 | req = scsi_req(rq); |
1734 | 1734 | ||
1735 | scsi_req_init(rq); | ||
1736 | |||
1737 | if (hp->cmd_len > BLK_MAX_CDB) | 1735 | if (hp->cmd_len > BLK_MAX_CDB) |
1738 | req->cmd = long_cmdp; | 1736 | req->cmd = long_cmdp; |
1739 | memcpy(req->cmd, cmd, hp->cmd_len); | 1737 | memcpy(req->cmd, cmd, hp->cmd_len); |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 6b1c4ac54e66..8e5013d9cad4 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -549,7 +549,6 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd, | |||
549 | if (IS_ERR(req)) | 549 | if (IS_ERR(req)) |
550 | return DRIVER_ERROR << 24; | 550 | return DRIVER_ERROR << 24; |
551 | rq = scsi_req(req); | 551 | rq = scsi_req(req); |
552 | scsi_req_init(req); | ||
553 | req->rq_flags |= RQF_QUIET; | 552 | req->rq_flags |= RQF_QUIET; |
554 | 553 | ||
555 | mdata->null_mapped = 1; | 554 | mdata->null_mapped = 1; |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 323ab47645d0..ceec0211e84e 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -992,8 +992,6 @@ pscsi_execute_cmd(struct se_cmd *cmd) | |||
992 | goto fail; | 992 | goto fail; |
993 | } | 993 | } |
994 | 994 | ||
995 | scsi_req_init(req); | ||
996 | |||
997 | if (sgl) { | 995 | if (sgl) { |
998 | ret = pscsi_map_sg(cmd, sgl, sgl_nents, req); | 996 | ret = pscsi_map_sg(cmd, sgl, sgl_nents, req); |
999 | if (ret) | 997 | if (ret) |
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index 47ed19c53f2e..c862c2489df0 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c | |||
@@ -232,7 +232,6 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev, | |||
232 | goto out_free_buf; | 232 | goto out_free_buf; |
233 | } | 233 | } |
234 | req = scsi_req(rq); | 234 | req = scsi_req(rq); |
235 | scsi_req_init(rq); | ||
236 | 235 | ||
237 | error = blk_rq_map_kern(q, rq, buf, bufflen, GFP_KERNEL); | 236 | error = blk_rq_map_kern(q, rq, buf, bufflen, GFP_KERNEL); |
238 | if (error) | 237 | if (error) |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index b379f93a2c48..da9bf2bcdf1a 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -166,6 +166,7 @@ extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count, | |||
166 | extern void scsi_kunmap_atomic_sg(void *virt); | 166 | extern void scsi_kunmap_atomic_sg(void *virt); |
167 | 167 | ||
168 | extern int scsi_init_io(struct scsi_cmnd *cmd); | 168 | extern int scsi_init_io(struct scsi_cmnd *cmd); |
169 | extern void scsi_initialize_rq(struct request *rq); | ||
169 | 170 | ||
170 | extern int scsi_dma_map(struct scsi_cmnd *cmd); | 171 | extern int scsi_dma_map(struct scsi_cmnd *cmd); |
171 | extern void scsi_dma_unmap(struct scsi_cmnd *cmd); | 172 | extern void scsi_dma_unmap(struct scsi_cmnd *cmd); |