Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15022
b: refs/heads/master
c: b88cb42
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Dec 12, 2005
1 parent 35e2df8 commit 94cbdfc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5650b736ad328f7f3e4120e8790940289b8ac144
refs/heads/master: b88cb42428f14fabdaf947150c00d65891820635
26 changes: 25 additions & 1 deletion trunk/include/linux/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,15 @@ static inline void list_del_rcu(struct list_head *entry)
*
* The old entry will be replaced with the new entry atomically.
*/
static inline void list_replace_rcu(struct list_head *old, struct list_head *new){
static inline void list_replace_rcu(struct list_head *old,
struct list_head *new)
{
new->next = old->next;
new->prev = old->prev;
smp_wmb();
new->next->prev = new;
new->prev->next = new;
old->prev = LIST_POISON2;
}

/**
Expand Down Expand Up @@ -578,6 +581,27 @@ static inline void hlist_del_init(struct hlist_node *n)
}
}

/*
* hlist_replace_rcu - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
*
* The old entry will be replaced with the new entry atomically.
*/
static inline void hlist_replace_rcu(struct hlist_node *old,
struct hlist_node *new)
{
struct hlist_node *next = old->next;

new->next = next;
new->pprev = old->pprev;
smp_wmb();
if (next)
new->next->pprev = &new->next;
*new->pprev = new;
old->pprev = LIST_POISON2;
}

static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
{
struct hlist_node *first = h->first;
Expand Down

0 comments on commit 94cbdfc

Please sign in to comment.