[RH7,1/2] list: introduce list_for_each_continue()

Submitted by Pavel Tikhomirov on March 2, 2021, 8:37 a.m.

Details

Message ID 20210302083759.247417-2-ptikhomirov@virtuozzo.com
State New
Series "proc/mounts: fix missing mounts in mountinfo"
Headers show

Commit Message

Pavel Tikhomirov March 2, 2021, 8:37 a.m.
From: Pavel Begunkov <asml.silence@gmail.com>

As other *continue() helpers, this continues iteration from a given
position.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

https://jira.sw.ru/browse/PSBM-125812
(cherry-picked from 28ca0d6d39ab1d01c86762c82a585b7cedd2920c)
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 include/linux/list.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/include/linux/list.h b/include/linux/list.h
index 328d12d9f1566..b59d57843f4f7 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -441,6 +441,16 @@  static inline void list_splice_tail_init(struct list_head *list,
 #define __list_for_each(pos, head) \
 	for (pos = (head)->next; pos != (head); pos = pos->next)
 
+/**
+ * list_for_each_continue - continue iteration over a list
+ * @pos:	the &struct list_head to use as a loop cursor.
+ * @head:	the head for your list.
+ *
+ * Continue to iterate over a list, continuing after the current position.
+ */
+#define list_for_each_continue(pos, head) \
+	for (pos = pos->next; pos != (head); pos = pos->next)
+
 /**
  * list_for_each_prev	-	iterate over a list backwards
  * @pos:	the &struct list_head to use as a loop cursor.