Skip to content

Commit

Permalink
block: introduce rq_list_move
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
keithbusch authored and intel-lab-lkp committed Dec 27, 2021
1 parent dbfa9aa commit 81098ed
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/linux/blk-mq.h
Expand Up @@ -216,6 +216,25 @@ static inline unsigned short req_get_ioprio(struct request *req)
#define rq_dma_dir(rq) \
(op_is_write(req_op(rq)) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)

/**
* 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
* @prv: The request preceding @rq in @src (NULL if @rq is the head)
* @nxt: The request following @rq in @src (NULL if @rq is the tail)
*/
static void inline rq_list_move(struct request **src, struct request **dst,
struct request *rq, struct request *prv,
struct request *nxt)
{
if (prv)
prv->rq_next = nxt;
else
*src = nxt;
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 */
Expand Down

0 comments on commit 81098ed

Please sign in to comment.