Skip to content

Commit 7b7ab78

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
block: make request_to_qc_t public
block consumers will need it for polling requests that are sent with blk_execute_rq_nowait. Also, get rid of blk_tag_to_qc_t and open-code it instead. Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 56a77d2 commit 7b7ab78

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

block/blk-mq.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,14 +1749,6 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio)
17491749
blk_account_io_start(rq, true);
17501750
}
17511751

1752-
static blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx, struct request *rq)
1753-
{
1754-
if (rq->tag != -1)
1755-
return blk_tag_to_qc_t(rq->tag, hctx->queue_num, false);
1756-
1757-
return blk_tag_to_qc_t(rq->internal_tag, hctx->queue_num, true);
1758-
}
1759-
17601752
static blk_status_t __blk_mq_issue_directly(struct blk_mq_hw_ctx *hctx,
17611753
struct request *rq,
17621754
blk_qc_t *cookie, bool last)

include/linux/blk-mq.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,14 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq)
357357
for ((i) = 0; (i) < (hctx)->nr_ctx && \
358358
({ ctx = (hctx)->ctxs[(i)]; 1; }); (i)++)
359359

360+
static inline blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx,
361+
struct request *rq)
362+
{
363+
if (rq->tag != -1)
364+
return rq->tag | (hctx->queue_num << BLK_QC_T_SHIFT);
365+
366+
return rq->internal_tag | (hctx->queue_num << BLK_QC_T_SHIFT) |
367+
BLK_QC_T_INTERNAL;
368+
}
369+
360370
#endif

include/linux/blk_types.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,6 @@ static inline bool blk_qc_t_valid(blk_qc_t cookie)
425425
return cookie != BLK_QC_T_NONE;
426426
}
427427

428-
static inline blk_qc_t blk_tag_to_qc_t(unsigned int tag, unsigned int queue_num,
429-
bool internal)
430-
{
431-
blk_qc_t ret = tag | (queue_num << BLK_QC_T_SHIFT);
432-
433-
if (internal)
434-
ret |= BLK_QC_T_INTERNAL;
435-
436-
return ret;
437-
}
438-
439428
static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie)
440429
{
441430
return (cookie & ~BLK_QC_T_INTERNAL) >> BLK_QC_T_SHIFT;

0 commit comments

Comments
 (0)