list: fix order of arguments for hlist_add_after(_rcu)
authorKen Helias <kenhelias@firemail.de>
Wed, 6 Aug 2014 23:09:16 +0000 (16:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Aug 2014 01:01:24 +0000 (18:01 -0700)
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: Ken 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 files changed:
Documentation/RCU/whatisRCU.txt
drivers/gpu/drm/drm_hashtab.c
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/staging/lustre/lustre/libcfs/hash.c
fs/namespace.c
fs/notify/inode_mark.c
fs/notify/vfsmount_mark.c
include/linux/list.h
include/linux/rculist.h
net/batman-adv/fragmentation.c
net/bridge/br_multicast.c
net/ipv4/fib_trie.c
net/ipv6/addrlabel.c
net/xfrm/xfrm_policy.c

index 49b8551a3b68e00de3e9819f4a3b20c6cf4b3fa3..e48c57f1943bab162530416afb35f3acdff1729d 100644 (file)
@@ -818,7 +818,7 @@ RCU pointer/list update:
        list_add_tail_rcu
        list_del_rcu
        list_replace_rcu
-       hlist_add_after_rcu
+       hlist_add_behind_rcu
        hlist_add_before_rcu
        hlist_add_head_rcu
        hlist_del_rcu
index 7e4bae760e2743532c39bd0d49cae176e2c93b2f..c3b80fd65d6254e89caf3381529f673764286115 100644 (file)
@@ -125,7 +125,7 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
                parent = &entry->head;
        }
        if (parent) {
-               hlist_add_after_rcu(parent, &item->head);
+               hlist_add_behind_rcu(&item->head, parent);
        } else {
                hlist_add_head_rcu(&item->head, h_list);
        }
index 681a9e81ff512aa874406d6e549485815c29a55d..e8ba7470700af1abaaf33826c7bffc8409666b9e 100644 (file)
@@ -1948,7 +1948,7 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi *vsi,
 
        /* add filter to the list */
        if (parent)
-               hlist_add_after(&parent->fdir_node, &input->fdir_node);
+               hlist_add_behind(&input->fdir_node, &parent->fdir_node);
        else
                hlist_add_head(&input->fdir_node,
                               &pf->fdir_filter_list);
index 94a1c07efeb0b8b6b1915084bdb7d52c0a5aaacb..e4100b5737b67a3cb862428e120e67d51bd1b7fd 100644 (file)
@@ -2517,7 +2517,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 
        /* add filter to the list */
        if (parent)
-               hlist_add_after(&parent->fdir_node, &input->fdir_node);
+               hlist_add_behind(&input->fdir_node, &parent->fdir_node);
        else
                hlist_add_head(&input->fdir_node,
                               &adapter->fdir_filter_list);
index 5dde79418297acf6ddc0a2ec2b8e41ead89b5bd6..8ef1deb59d4a3d3abe6f70862e43a307604d4133 100644 (file)
@@ -351,7 +351,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd,
                                            cfs_hash_dhead_t, dh_head);
 
        if (dh->dh_tail != NULL) /* not empty */
-               hlist_add_after(dh->dh_tail, hnode);
+               hlist_add_behind(hnode, dh->dh_tail);
        else /* empty list */
                hlist_add_head(hnode, &dh->dh_head);
        dh->dh_tail = hnode;
@@ -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);
 
        if (dh->dd_tail != NULL) /* not empty */
-               hlist_add_after(dh->dd_tail, hnode);
+               hlist_add_behind(hnode, dh->dd_tail);
        else /* empty list */
                hlist_add_head(hnode, &dh->dd_head);
        dh->dd_tail = hnode;
index 182bc41cd88711d593c4d997171c6ad483a87577..2a1447c946e7c212071eac5243a5538a499cd0fa 100644 (file)
@@ -798,7 +798,7 @@ static void commit_tree(struct mount *mnt, struct mount *shadows)
        list_splice(&head, n->list.prev);
 
        if (shadows)
-               hlist_add_after_rcu(&shadows->mnt_hash, &mnt->mnt_hash);
+               hlist_add_behind_rcu(&mnt->mnt_hash, &shadows->mnt_hash);
        else
                hlist_add_head_rcu(&mnt->mnt_hash,
                                m_hash(&parent->mnt, mnt->mnt_mountpoint));
index 74825be65b7bbec7eec8df37dda142479c00eb3d..9ce062218de9cf2559c02b92a7a201224d1d67fc 100644 (file)
@@ -232,7 +232,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
 
        BUG_ON(last == NULL);
        /* 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:
        fsnotify_recalc_inode_mask_locked(inode);
        spin_unlock(&inode->i_lock);
index 68ca5a8704b5a385e38ae696835dd831d3202691..ac851e8376b1931d88adcf4ff5eaa8bd2445a635 100644 (file)
@@ -191,7 +191,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
 
        BUG_ON(last == NULL);
        /* 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:
        fsnotify_recalc_vfsmount_mask_locked(mnt);
        spin_unlock(&mnt->mnt_root->d_lock);
index 624ec7f48293b3e37968d0486b58b2c31e315383..cbbb96fcead9208da224866d849f3b3dfcf0337e 100644 (file)
@@ -654,8 +654,8 @@ static inline void hlist_add_before(struct hlist_node *n,
        *(n->pprev) = n;
 }
 
-static inline void hlist_add_after(struct hlist_node *prev,
-                                  struct hlist_node *n)
+static inline void hlist_add_behind(struct hlist_node *n,
+                                   struct hlist_node *prev)
 {
        n->next = prev->next;
        prev->next = n;
index 8183b46fbaa2d6da9817ead257735396a6ec7b0c..372ad5e0dcb88df4af003686c7057af3e900d281 100644 (file)
@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
 }
 
 /**
- * hlist_add_after_rcu
- * @prev: the existing element to add the new element after.
+ * hlist_add_behind_rcu
  * @n: the new element to add to the hash list.
+ * @prev: the existing element to add the new element after.
  *
  * Description:
  * Adds the specified element to the specified hlist
@@ -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
  * problems on Alpha CPUs.
  */
-static inline void hlist_add_after_rcu(struct hlist_node *prev,
-                                      struct hlist_node *n)
+static inline void hlist_add_behind_rcu(struct hlist_node *n,
+                                       struct hlist_node *prev)
 {
        n->next = prev->next;
        n->pprev = &prev->next;
index 022d18ab27a64dabc04ba8e71e1455c10904ae8a..52c43f9042209deaba0be22b549724ad28de1a77 100644 (file)
@@ -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'. */
        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->timestamp = jiffies;
                ret = true;
index b4845f4b2bb414c7403e225528add6840eb26f74..7751c92c8c57fc24b0c18e4d20a095bfa02e9ff0 100644 (file)
@@ -1174,7 +1174,7 @@ static void br_multicast_add_router(struct net_bridge *br,
        }
 
        if (slot)
-               hlist_add_after_rcu(slot, &port->rlist);
+               hlist_add_behind_rcu(&port->rlist, slot);
        else
                hlist_add_head_rcu(&port->rlist, &br->router_list);
 }
index 5afeb5aa4c7cfd9b0f794a45840f6fbd79b90315..e9cb2588e4161c41613c0e50a17ea91b7416a514 100644 (file)
@@ -940,7 +940,7 @@ static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new)
                        last = li;
                }
                if (last)
-                       hlist_add_after_rcu(&last->hlist, &new->hlist);
+                       hlist_add_behind_rcu(&new->hlist, &last->hlist);
                else
                        hlist_add_before_rcu(&new->hlist, &li->hlist);
        }
index 731e1e1722d9b4322f3907e57e3a1fd1994230b5..fd0dc47f471dad23566248fecadd571a1a4c00d9 100644 (file)
@@ -277,7 +277,7 @@ static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace)
                last = p;
        }
        if (last)
-               hlist_add_after_rcu(&last->list, &newp->list);
+               hlist_add_behind_rcu(&newp->list, &last->list);
        else
                hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head);
 out:
index 0525d78ba32866c64c0b31bcf5b9d147855c308a..beeed602aeb379f2ddfbd74a61c798cd371636ba 100644 (file)
@@ -389,7 +389,7 @@ redo:
                        if (h != h0)
                                continue;
                        hlist_del(&pol->bydst);
-                       hlist_add_after(entry0, &pol->bydst);
+                       hlist_add_behind(&pol->bydst, entry0);
                }
                entry0 = &pol->bydst;
        }
@@ -654,7 +654,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
                        break;
        }
        if (newpos)
-               hlist_add_after(newpos, &policy->bydst);
+               hlist_add_behind(&policy->bydst, newpos);
        else
                hlist_add_head(&policy->bydst, chain);
        xfrm_pol_hold(policy);