diff options
author | Keith Busch <kbusch@kernel.org> | 2022-01-05 09:05:17 -0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-01-05 12:25:42 -0700 |
commit | d2528be7a8b09af9796a270debd14101a72bb552 (patch) | |
tree | d0066044c0ae1009dde56ba1684ff7b30a723ece /include/linux/blk-mq.h | |
parent | 3764fd05e1f89530e2ee5cbff0b638f2b1141b90 (diff) | |
download | lwn-d2528be7a8b09af9796a270debd14101a72bb552.tar.gz lwn-d2528be7a8b09af9796a270debd14101a72bb552.zip |
block: introduce rq_list_move
When iterating a list, a particular request may need to be moved for
special handling. Provide a helper function to achieve that so drivers
don't need to reimplement rqlist manipulation.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220105170518.3181469-4-kbusch@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blk-mq.h')
-rw-r--r-- | include/linux/blk-mq.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 1467f0fa2142..f40a05ecca4a 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -249,6 +249,23 @@ static inline unsigned short req_get_ioprio(struct request *req) #define rq_list_next(rq) (rq)->rq_next #define rq_list_empty(list) ((list) == (struct request *) NULL) +/** + * rq_list_move() - move a struct request from one list to another + * @src: The source list @rq is currently in + * @dst: The destination list that @rq will be appended to + * @rq: The request to move + * @prev: The request preceding @rq in @src (NULL if @rq is the head) + */ +static void inline rq_list_move(struct request **src, struct request **dst, + struct request *rq, struct request *prev) +{ + if (prev) + prev->rq_next = rq->rq_next; + else + *src = rq->rq_next; + rq_list_add(dst, rq); +} + enum blk_eh_timer_return { BLK_EH_DONE, /* drivers has completed the command */ BLK_EH_RESET_TIMER, /* reset timer and try again */ |