Skip to content

Commit b5fa0e9

Browse files
Christoph Hellwigaxboe
authored andcommitted
mtip32xx: move the blk_rq_map_sg call to mtip_hw_submit_io
We have all arguments at hand in mtip_hw_submit_io, so keep the rq to sg mapping close to the dma_map_sg call. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 72d7ce8 commit b5fa0e9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,6 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd,
21712171
* @dd Pointer to the driver data structure.
21722172
* @start First sector to read.
21732173
* @nsect Number of sectors to read.
2174-
* @nents Number of entries in scatter list for the read command.
21752174
* @tag The tag of this read command.
21762175
* @callback Pointer to the function that should be called
21772176
* when the read completes.
@@ -2183,16 +2182,18 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd,
21832182
* None
21842183
*/
21852184
static void mtip_hw_submit_io(struct driver_data *dd, struct request *rq,
2186-
struct mtip_cmd *command, int nents,
2185+
struct mtip_cmd *command,
21872186
struct blk_mq_hw_ctx *hctx)
21882187
{
21892188
struct host_to_dev_fis *fis;
21902189
struct mtip_port *port = dd->port;
21912190
int dma_dir = rq_data_dir(rq) == READ ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
21922191
u64 start = blk_rq_pos(rq);
21932192
unsigned int nsect = blk_rq_sectors(rq);
2193+
unsigned int nents;
21942194

21952195
/* Map the scatter list for DMA access */
2196+
nents = blk_rq_map_sg(hctx->queue, rq, command->sg);
21962197
nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir);
21972198

21982199
prefetch(&port->flags);
@@ -3548,7 +3549,6 @@ static int mtip_submit_request(struct blk_mq_hw_ctx *hctx, struct request *rq)
35483549
{
35493550
struct driver_data *dd = hctx->queue->queuedata;
35503551
struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq);
3551-
unsigned int nents;
35523552

35533553
if (is_se_active(dd))
35543554
return -ENODATA;
@@ -3579,11 +3579,8 @@ static int mtip_submit_request(struct blk_mq_hw_ctx *hctx, struct request *rq)
35793579
return 0;
35803580
}
35813581

3582-
/* Create the scatter list for this request. */
3583-
nents = blk_rq_map_sg(hctx->queue, rq, cmd->sg);
3584-
35853582
/* Issue the read/write. */
3586-
mtip_hw_submit_io(dd, rq, cmd, nents, hctx);
3583+
mtip_hw_submit_io(dd, rq, cmd, hctx);
35873584
return 0;
35883585
}
35893586

0 commit comments

Comments
 (0)