Commit 2963e3f7 authored by Jens Axboe's avatar Jens Axboe

blk-mq: cleanup blk_mq_rq_to_pdu()

Casting to void and adding the size of the request is "shit code" and
only a "crazy monkey on crack" would write that. So lets clean it up.
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c76cbbcf
...@@ -230,7 +230,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q); ...@@ -230,7 +230,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q);
/* /*
* Driver command data is immediately after the request. So subtract request * Driver command data is immediately after the request. So subtract request
* size to get back to the original request. * size to get back to the original request, add request size to get the PDU.
*/ */
static inline struct request *blk_mq_rq_from_pdu(void *pdu) static inline struct request *blk_mq_rq_from_pdu(void *pdu)
{ {
...@@ -238,7 +238,7 @@ static inline struct request *blk_mq_rq_from_pdu(void *pdu) ...@@ -238,7 +238,7 @@ static inline struct request *blk_mq_rq_from_pdu(void *pdu)
} }
static inline void *blk_mq_rq_to_pdu(struct request *rq) static inline void *blk_mq_rq_to_pdu(struct request *rq)
{ {
return (void *) rq + sizeof(*rq); return rq + 1;
} }
#define queue_for_each_hw_ctx(q, hctx, i) \ #define queue_for_each_hw_ctx(q, hctx, i) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment