Commit 3764fd05 authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe

block: introduce rq_list_for_each_safe macro

While iterating a list, a particular request may need to be removed for
special handling. Provide an iterator that can safely handle that.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20220105170518.3181469-3-kbusch@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent edce22e1
......@@ -242,6 +242,10 @@ static inline unsigned short req_get_ioprio(struct request *req)
#define rq_list_for_each(listptr, pos) \
for (pos = rq_list_peek((listptr)); pos; pos = rq_list_next(pos))
#define rq_list_for_each_safe(listptr, pos, nxt) \
for (pos = rq_list_peek((listptr)), nxt = rq_list_next(pos); \
pos; pos = nxt, nxt = pos ? rq_list_next(pos) : NULL)
#define rq_list_next(rq) (rq)->rq_next
#define rq_list_empty(list) ((list) == (struct request *) NULL)
......
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