diff options
-rw-r--r-- | include/linux/list.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index fbfca73355a3..8e3388284530 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -202,12 +202,15 @@ static inline void list_del_rcu(struct list_head *entry) | |||
202 | * | 202 | * |
203 | * The old entry will be replaced with the new entry atomically. | 203 | * The old entry will be replaced with the new entry atomically. |
204 | */ | 204 | */ |
205 | static inline void list_replace_rcu(struct list_head *old, struct list_head *new){ | 205 | static inline void list_replace_rcu(struct list_head *old, |
206 | struct list_head *new) | ||
207 | { | ||
206 | new->next = old->next; | 208 | new->next = old->next; |
207 | new->prev = old->prev; | 209 | new->prev = old->prev; |
208 | smp_wmb(); | 210 | smp_wmb(); |
209 | new->next->prev = new; | 211 | new->next->prev = new; |
210 | new->prev->next = new; | 212 | new->prev->next = new; |
213 | old->prev = LIST_POISON2; | ||
211 | } | 214 | } |
212 | 215 | ||
213 | /** | 216 | /** |
@@ -578,6 +581,27 @@ static inline void hlist_del_init(struct hlist_node *n) | |||
578 | } | 581 | } |
579 | } | 582 | } |
580 | 583 | ||
584 | /* | ||
585 | * hlist_replace_rcu - replace old entry by new one | ||
586 | * @old : the element to be replaced | ||
587 | * @new : the new element to insert | ||
588 | * | ||
589 | * The old entry will be replaced with the new entry atomically. | ||
590 | */ | ||
591 | static inline void hlist_replace_rcu(struct hlist_node *old, | ||
592 | struct hlist_node *new) | ||
593 | { | ||
594 | struct hlist_node *next = old->next; | ||
595 | |||
596 | new->next = next; | ||
597 | new->pprev = old->pprev; | ||
598 | smp_wmb(); | ||
599 | if (next) | ||
600 | new->next->pprev = &new->next; | ||
601 | *new->pprev = new; | ||
602 | old->pprev = LIST_POISON2; | ||
603 | } | ||
604 | |||
581 | static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | 605 | static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) |
582 | { | 606 | { |
583 | struct hlist_node *first = h->first; | 607 | struct hlist_node *first = h->first; |