History

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.

Keith Busch committed 4 years ago

Commit d2528be1 parent 3764fd01 file · +17 −0Browse files

Unified · Split

include/linux/blk-mq.h+17−0
@@ -249,6 +249,23 @@ static inline unsigned short req_get_ioprio(struct request *req) · 248 unmodified lines
249249 #define rq_list_next(rq) (rq)->rq_next
250250 #define rq_list_empty(list) ((list) == (struct request *) NULL)
251251
252+/**
253+ * rq_list_move() - move a struct request from one list to another
254+ * @src: The source list @rq is currently in
255+ * @dst: The destination list that @rq will be appended to
256+ * @rq: The request to move
257+ * @prev: The request preceding @rq in @src (NULL if @rq is the head)
258+ */
259+static void inline rq_list_move(struct request **src, struct request **dst,
260+ struct request *rq, struct request *prev)
261+{
262+ if (prev)
263+ prev->rq_next = rq->rq_next;
264+ else
265+ *src = rq->rq_next;
266+ rq_list_add(dst, rq);
267+}
268+
252269 enum blk_eh_timer_return {
253270 BLK_EH_DONE, /* drivers has completed the command */
254271 BLK_EH_RESET_TIMER, /* reset timer and try again */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t