Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ead9ad72 authored by NeilBrown's avatar NeilBrown Committed by Trond Myklebust
Browse files

rculist: add list_for_each_entry_from_rcu()



list_for_each_entry_from_rcu() is an RCU version of
list_for_each_entry_from().  It walks a linked list under rcu
protection, from a given start point.

It is similar to list_for_each_entry_continue_rcu() but starts *at*
the given position rather than *after* it.

Naturally, the start point must be known to be in the list.

Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 3ca951b6
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -403,6 +403,19 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,
	     &pos->member != (head);	\
	     &pos->member != (head);	\
	     pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
	     pos = list_entry_rcu(pos->member.next, typeof(*pos), member))


/**
 * list_for_each_entry_from_rcu - iterate over a list from current point
 * @pos:	the type * to use as a loop cursor.
 * @head:	the head for your list.
 * @member:	the name of the list_node within the struct.
 *
 * Iterate over the tail of a list starting from a given position,
 * which must have been in the list when the RCU read lock was taken.
 */
#define list_for_each_entry_from_rcu(pos, head, member)			\
	for (; &(pos)->member != (head);					\
		pos = list_entry_rcu(pos->member.next, typeof(*(pos)), member))

/**
/**
 * hlist_del_rcu - deletes entry from hash list without re-initialization
 * hlist_del_rcu - deletes entry from hash list without re-initialization
 * @n: the element to delete from the hash list.
 * @n: the element to delete from the hash list.