Skip to content

Commit

Permalink
blk-mq: cleanup blk_mq_rq_to_pdu()
Browse files Browse the repository at this point in the history
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: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Apr 9, 2015
1 parent c76cbbc commit 2963e3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/blk-mq.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ void blk_mq_freeze_queue_start(struct request_queue *q);

/*
* 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)
{
return pdu - sizeof(struct request);
}
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) \
Expand Down

0 comments on commit 2963e3f

Please sign in to comment.