diff options
author | Christoph Hellwig <hch@lst.de> | 2014-04-14 04:30:07 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-04-15 16:03:02 -0400 |
commit | 9d74e25737d73e93ccddeb5a61bcd56b7b8eb57b (patch) | |
tree | c36c53290f8b5ed7f1ae9a89b534a9c3155c0491 /drivers/block | |
parent | 742ee69b92d9559e968f70cf0a49157866f8fbef (diff) |
blk-mq: do not initialize req->special
Drivers can reach their private data easily using the blk_mq_rq_to_pdu
helper and don't need req->special. By not initializing it code can
be simplified nicely, and we also shave off a few more instructions from
the I/O path.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/null_blk.c | 4 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 091b9ea14feb..71df69d90900 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -226,7 +226,7 @@ static void null_cmd_end_timer(struct nullb_cmd *cmd) | |||
226 | 226 | ||
227 | static void null_softirq_done_fn(struct request *rq) | 227 | static void null_softirq_done_fn(struct request *rq) |
228 | { | 228 | { |
229 | end_cmd(rq->special); | 229 | end_cmd(blk_mq_rq_to_pdu(rq)); |
230 | } | 230 | } |
231 | 231 | ||
232 | static inline void null_handle_cmd(struct nullb_cmd *cmd) | 232 | static inline void null_handle_cmd(struct nullb_cmd *cmd) |
@@ -311,7 +311,7 @@ static void null_request_fn(struct request_queue *q) | |||
311 | 311 | ||
312 | static int null_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *rq) | 312 | static int null_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *rq) |
313 | { | 313 | { |
314 | struct nullb_cmd *cmd = rq->special; | 314 | struct nullb_cmd *cmd = blk_mq_rq_to_pdu(rq); |
315 | 315 | ||
316 | cmd->rq = rq; | 316 | cmd->rq = rq; |
317 | cmd->nq = hctx->driver_data; | 317 | cmd->nq = hctx->driver_data; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6d8a87f252de..c7d02bc9d945 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -112,7 +112,7 @@ static int __virtblk_add_req(struct virtqueue *vq, | |||
112 | 112 | ||
113 | static inline void virtblk_request_done(struct request *req) | 113 | static inline void virtblk_request_done(struct request *req) |
114 | { | 114 | { |
115 | struct virtblk_req *vbr = req->special; | 115 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); |
116 | int error = virtblk_result(vbr); | 116 | int error = virtblk_result(vbr); |
117 | 117 | ||
118 | if (req->cmd_type == REQ_TYPE_BLOCK_PC) { | 118 | if (req->cmd_type == REQ_TYPE_BLOCK_PC) { |
@@ -154,7 +154,7 @@ static void virtblk_done(struct virtqueue *vq) | |||
154 | static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req) | 154 | static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req) |
155 | { | 155 | { |
156 | struct virtio_blk *vblk = hctx->queue->queuedata; | 156 | struct virtio_blk *vblk = hctx->queue->queuedata; |
157 | struct virtblk_req *vbr = req->special; | 157 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); |
158 | unsigned long flags; | 158 | unsigned long flags; |
159 | unsigned int num; | 159 | unsigned int num; |
160 | const bool last = (req->cmd_flags & REQ_END) != 0; | 160 | const bool last = (req->cmd_flags & REQ_END) != 0; |
@@ -501,7 +501,7 @@ static int virtblk_init_vbr(void *data, struct blk_mq_hw_ctx *hctx, | |||
501 | struct request *rq, unsigned int nr) | 501 | struct request *rq, unsigned int nr) |
502 | { | 502 | { |
503 | struct virtio_blk *vblk = data; | 503 | struct virtio_blk *vblk = data; |
504 | struct virtblk_req *vbr = rq->special; | 504 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(rq); |
505 | 505 | ||
506 | sg_init_table(vbr->sg, vblk->sg_elems); | 506 | sg_init_table(vbr->sg, vblk->sg_elems); |
507 | return 0; | 507 | return 0; |