diff options
author | NeilBrown <neilb@suse.com> | 2018-04-30 14:31:30 +1000 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-05-31 14:59:19 -0400 |
commit | ead9ad7253f4296ba8cd3eb930f06a74924700a9 (patch) | |
tree | d1bdf0e12adde5b85e8633fe6f5959c3a3ed8331 /include/linux/rculist.h | |
parent | 3ca951b618386321d9396e9e26be7f4235b5cdb2 (diff) | |
download | linux-stable-ead9ad7253f4296ba8cd3eb930f06a74924700a9.tar.gz linux-stable-ead9ad7253f4296ba8cd3eb930f06a74924700a9.tar.bz2 linux-stable-ead9ad7253f4296ba8cd3eb930f06a74924700a9.zip |
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: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'include/linux/rculist.h')
-rw-r--r-- | include/linux/rculist.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 127f534fec94..36df6ccbc874 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -404,6 +404,19 @@ static inline void list_splice_tail_init_rcu(struct list_head *list, 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 * @n: the element to delete from the hash list. * |