Commit 1d023284 authored by Ken Helias's avatar Ken Helias Committed by Linus Torvalds

list: fix order of arguments for hlist_add_after(_rcu)

All other add functions for lists have the new item as first argument
and the position where it is added as second argument.  This was changed
for no good reason in this function and makes using it unnecessary
confusing.

The name was changed to hlist_add_behind() to cause unconverted code to
generate a compile error instead of using the wrong parameter order.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarKen Helias <kenhelias@firemail.de>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>	[intel driver bits]
Cc: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bc18dd33
...@@ -818,7 +818,7 @@ RCU pointer/list update: ...@@ -818,7 +818,7 @@ RCU pointer/list update:
list_add_tail_rcu list_add_tail_rcu
list_del_rcu list_del_rcu
list_replace_rcu list_replace_rcu
hlist_add_after_rcu hlist_add_behind_rcu
hlist_add_before_rcu hlist_add_before_rcu
hlist_add_head_rcu hlist_add_head_rcu
hlist_del_rcu hlist_del_rcu
......
...@@ -125,7 +125,7 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item) ...@@ -125,7 +125,7 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
parent = &entry->head; parent = &entry->head;
} }
if (parent) { if (parent) {
hlist_add_after_rcu(parent, &item->head); hlist_add_behind_rcu(&item->head, parent);
} else { } else {
hlist_add_head_rcu(&item->head, h_list); hlist_add_head_rcu(&item->head, h_list);
} }
......
...@@ -1948,7 +1948,7 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi *vsi, ...@@ -1948,7 +1948,7 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi *vsi,
/* add filter to the list */ /* add filter to the list */
if (parent) if (parent)
hlist_add_after(&parent->fdir_node, &input->fdir_node); hlist_add_behind(&input->fdir_node, &parent->fdir_node);
else else
hlist_add_head(&input->fdir_node, hlist_add_head(&input->fdir_node,
&pf->fdir_filter_list); &pf->fdir_filter_list);
......
...@@ -2517,7 +2517,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter, ...@@ -2517,7 +2517,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
/* add filter to the list */ /* add filter to the list */
if (parent) if (parent)
hlist_add_after(&parent->fdir_node, &input->fdir_node); hlist_add_behind(&input->fdir_node, &parent->fdir_node);
else else
hlist_add_head(&input->fdir_node, hlist_add_head(&input->fdir_node,
&adapter->fdir_filter_list); &adapter->fdir_filter_list);
......
...@@ -351,7 +351,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd, ...@@ -351,7 +351,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd,
cfs_hash_dhead_t, dh_head); cfs_hash_dhead_t, dh_head);
if (dh->dh_tail != NULL) /* not empty */ if (dh->dh_tail != NULL) /* not empty */
hlist_add_after(dh->dh_tail, hnode); hlist_add_behind(hnode, dh->dh_tail);
else /* empty list */ else /* empty list */
hlist_add_head(hnode, &dh->dh_head); hlist_add_head(hnode, &dh->dh_head);
dh->dh_tail = hnode; dh->dh_tail = hnode;
...@@ -406,7 +406,7 @@ cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd, ...@@ -406,7 +406,7 @@ cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd,
cfs_hash_dhead_dep_t, dd_head); cfs_hash_dhead_dep_t, dd_head);
if (dh->dd_tail != NULL) /* not empty */ if (dh->dd_tail != NULL) /* not empty */
hlist_add_after(dh->dd_tail, hnode); hlist_add_behind(hnode, dh->dd_tail);
else /* empty list */ else /* empty list */
hlist_add_head(hnode, &dh->dd_head); hlist_add_head(hnode, &dh->dd_head);
dh->dd_tail = hnode; dh->dd_tail = hnode;
......
...@@ -798,7 +798,7 @@ static void commit_tree(struct mount *mnt, struct mount *shadows) ...@@ -798,7 +798,7 @@ static void commit_tree(struct mount *mnt, struct mount *shadows)
list_splice(&head, n->list.prev); list_splice(&head, n->list.prev);
if (shadows) if (shadows)
hlist_add_after_rcu(&shadows->mnt_hash, &mnt->mnt_hash); hlist_add_behind_rcu(&mnt->mnt_hash, &shadows->mnt_hash);
else else
hlist_add_head_rcu(&mnt->mnt_hash, hlist_add_head_rcu(&mnt->mnt_hash,
m_hash(&parent->mnt, mnt->mnt_mountpoint)); m_hash(&parent->mnt, mnt->mnt_mountpoint));
......
...@@ -232,7 +232,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark, ...@@ -232,7 +232,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
BUG_ON(last == NULL); BUG_ON(last == NULL);
/* mark should be the last entry. last is the current last entry */ /* mark should be the last entry. last is the current last entry */
hlist_add_after_rcu(&last->i.i_list, &mark->i.i_list); hlist_add_behind_rcu(&mark->i.i_list, &last->i.i_list);
out: out:
fsnotify_recalc_inode_mask_locked(inode); fsnotify_recalc_inode_mask_locked(inode);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
......
...@@ -191,7 +191,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, ...@@ -191,7 +191,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
BUG_ON(last == NULL); BUG_ON(last == NULL);
/* mark should be the last entry. last is the current last entry */ /* mark should be the last entry. last is the current last entry */
hlist_add_after_rcu(&last->m.m_list, &mark->m.m_list); hlist_add_behind_rcu(&mark->m.m_list, &last->m.m_list);
out: out:
fsnotify_recalc_vfsmount_mask_locked(mnt); fsnotify_recalc_vfsmount_mask_locked(mnt);
spin_unlock(&mnt->mnt_root->d_lock); spin_unlock(&mnt->mnt_root->d_lock);
......
...@@ -654,8 +654,8 @@ static inline void hlist_add_before(struct hlist_node *n, ...@@ -654,8 +654,8 @@ static inline void hlist_add_before(struct hlist_node *n,
*(n->pprev) = n; *(n->pprev) = n;
} }
static inline void hlist_add_after(struct hlist_node *prev, static inline void hlist_add_behind(struct hlist_node *n,
struct hlist_node *n) struct hlist_node *prev)
{ {
n->next = prev->next; n->next = prev->next;
prev->next = n; prev->next = n;
......
...@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n, ...@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
} }
/** /**
* hlist_add_after_rcu * hlist_add_behind_rcu
* @prev: the existing element to add the new element after.
* @n: the new element to add to the hash list. * @n: the new element to add to the hash list.
* @prev: the existing element to add the new element after.
* *
* Description: * Description:
* Adds the specified element to the specified hlist * Adds the specified element to the specified hlist
...@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n, ...@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
* hlist_for_each_entry_rcu(), used to prevent memory-consistency * hlist_for_each_entry_rcu(), used to prevent memory-consistency
* problems on Alpha CPUs. * problems on Alpha CPUs.
*/ */
static inline void hlist_add_after_rcu(struct hlist_node *prev, static inline void hlist_add_behind_rcu(struct hlist_node *n,
struct hlist_node *n) struct hlist_node *prev)
{ {
n->next = prev->next; n->next = prev->next;
n->pprev = &prev->next; n->pprev = &prev->next;
......
...@@ -188,7 +188,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, ...@@ -188,7 +188,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
/* Reached the end of the list, so insert after 'frag_entry_last'. */ /* Reached the end of the list, so insert after 'frag_entry_last'. */
if (likely(frag_entry_last)) { if (likely(frag_entry_last)) {
hlist_add_after(&frag_entry_last->list, &frag_entry_new->list); hlist_add_behind(&frag_entry_last->list, &frag_entry_new->list);
chain->size += skb->len - hdr_size; chain->size += skb->len - hdr_size;
chain->timestamp = jiffies; chain->timestamp = jiffies;
ret = true; ret = true;
......
...@@ -1174,7 +1174,7 @@ static void br_multicast_add_router(struct net_bridge *br, ...@@ -1174,7 +1174,7 @@ static void br_multicast_add_router(struct net_bridge *br,
} }
if (slot) if (slot)
hlist_add_after_rcu(slot, &port->rlist); hlist_add_behind_rcu(&port->rlist, slot);
else else
hlist_add_head_rcu(&port->rlist, &br->router_list); hlist_add_head_rcu(&port->rlist, &br->router_list);
} }
......
...@@ -940,7 +940,7 @@ static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new) ...@@ -940,7 +940,7 @@ static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new)
last = li; last = li;
} }
if (last) if (last)
hlist_add_after_rcu(&last->hlist, &new->hlist); hlist_add_behind_rcu(&new->hlist, &last->hlist);
else else
hlist_add_before_rcu(&new->hlist, &li->hlist); hlist_add_before_rcu(&new->hlist, &li->hlist);
} }
......
...@@ -277,7 +277,7 @@ static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace) ...@@ -277,7 +277,7 @@ static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace)
last = p; last = p;
} }
if (last) if (last)
hlist_add_after_rcu(&last->list, &newp->list); hlist_add_behind_rcu(&newp->list, &last->list);
else else
hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head); hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head);
out: out:
......
...@@ -389,7 +389,7 @@ static void xfrm_dst_hash_transfer(struct hlist_head *list, ...@@ -389,7 +389,7 @@ static void xfrm_dst_hash_transfer(struct hlist_head *list,
if (h != h0) if (h != h0)
continue; continue;
hlist_del(&pol->bydst); hlist_del(&pol->bydst);
hlist_add_after(entry0, &pol->bydst); hlist_add_behind(&pol->bydst, entry0);
} }
entry0 = &pol->bydst; entry0 = &pol->bydst;
} }
...@@ -654,7 +654,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) ...@@ -654,7 +654,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
break; break;
} }
if (newpos) if (newpos)
hlist_add_after(newpos, &policy->bydst); hlist_add_behind(&policy->bydst, newpos);
else else
hlist_add_head(&policy->bydst, chain); hlist_add_head(&policy->bydst, chain);
xfrm_pol_hold(policy); xfrm_pol_hold(policy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment