mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 82ed4db499 ("block: split scsi_request out of struct request")
Signed-off-by: Bart Van Assche <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Omar Sandoval <[email protected]>
Cc: Nicholas Bellinger <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
d280bab305
commit
ca18d6f769
25 changed files with 20 additions and 33 deletions
|
|
@ -1574,7 +1574,6 @@ static struct request *_make_request(struct request_queue *q, bool has_write,
|
|||
flags);
|
||||
if (IS_ERR(req))
|
||||
return req;
|
||||
scsi_req_init(req);
|
||||
|
||||
for_each_bio(bio) {
|
||||
struct bio *bounce_bio = bio;
|
||||
|
|
@ -1619,7 +1618,6 @@ static int _init_blk_request(struct osd_request *or,
|
|||
ret = PTR_ERR(req);
|
||||
goto out;
|
||||
}
|
||||
scsi_req_init(req);
|
||||
or->in.req = or->request->next_rq = req;
|
||||
}
|
||||
} else if (has_in)
|
||||
|
|
|
|||
|
|
@ -373,7 +373,6 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd,
|
|||
return DRIVER_ERROR << 24;
|
||||
|
||||
rq = scsi_req(req);
|
||||
scsi_req_init(req);
|
||||
req->rq_flags |= RQF_QUIET;
|
||||
|
||||
SRpnt->bio = NULL;
|
||||
|
|
|
|||
|
|
@ -1903,7 +1903,6 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)
|
|||
if (IS_ERR(req))
|
||||
return;
|
||||
rq = scsi_req(req);
|
||||
scsi_req_init(req);
|
||||
|
||||
rq->cmd[0] = ALLOW_MEDIUM_REMOVAL;
|
||||
rq->cmd[1] = 0;
|
||||
|
|
|
|||
|
|
@ -250,7 +250,6 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
|
|||
if (IS_ERR(req))
|
||||
return ret;
|
||||
rq = scsi_req(req);
|
||||
scsi_req_init(req);
|
||||
|
||||
if (bufflen && blk_rq_map_kern(sdev->request_queue, req,
|
||||
buffer, bufflen, __GFP_RECLAIM))
|
||||
|
|
@ -1117,6 +1116,18 @@ err_exit:
|
|||
}
|
||||
EXPORT_SYMBOL(scsi_init_io);
|
||||
|
||||
/**
|
||||
* scsi_initialize_rq - initialize struct scsi_cmnd.req
|
||||
*
|
||||
* Called from inside blk_get_request().
|
||||
*/
|
||||
void scsi_initialize_rq(struct request *rq)
|
||||
{
|
||||
scsi_req_init(rq);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_initialize_rq);
|
||||
|
||||
/* Called after a request has been started. */
|
||||
void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
|
||||
{
|
||||
void *buf = cmd->sense_buffer;
|
||||
|
|
@ -2124,6 +2135,7 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
|
|||
q->request_fn = scsi_request_fn;
|
||||
q->init_rq_fn = scsi_init_rq;
|
||||
q->exit_rq_fn = scsi_exit_rq;
|
||||
q->initialize_rq_fn = scsi_initialize_rq;
|
||||
|
||||
if (blk_init_allocated_queue(q) < 0) {
|
||||
blk_cleanup_queue(q);
|
||||
|
|
@ -2148,6 +2160,7 @@ static const struct blk_mq_ops scsi_mq_ops = {
|
|||
#endif
|
||||
.init_request = scsi_init_request,
|
||||
.exit_request = scsi_exit_request,
|
||||
.initialize_rq_fn = scsi_initialize_rq,
|
||||
.map_queues = scsi_map_queues,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <linux/bsg.h>
|
||||
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
#include <scsi/scsi_request.h>
|
||||
#include <scsi/scsi_device.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
|
|
@ -230,6 +231,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
|
|||
q = blk_alloc_queue(GFP_KERNEL);
|
||||
if (!q)
|
||||
return -ENOMEM;
|
||||
q->initialize_rq_fn = scsi_initialize_rq;
|
||||
q->cmd_size = sizeof(struct scsi_request);
|
||||
|
||||
if (rphy) {
|
||||
|
|
|
|||
|
|
@ -1732,8 +1732,6 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
|
|||
}
|
||||
req = scsi_req(rq);
|
||||
|
||||
scsi_req_init(rq);
|
||||
|
||||
if (hp->cmd_len > BLK_MAX_CDB)
|
||||
req->cmd = long_cmdp;
|
||||
memcpy(req->cmd, cmd, hp->cmd_len);
|
||||
|
|
|
|||
|
|
@ -549,7 +549,6 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
|
|||
if (IS_ERR(req))
|
||||
return DRIVER_ERROR << 24;
|
||||
rq = scsi_req(req);
|
||||
scsi_req_init(req);
|
||||
req->rq_flags |= RQF_QUIET;
|
||||
|
||||
mdata->null_mapped = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue