Skip to content

Commit 1d02328

Browse files
Ken Heliastorvalds
authored andcommitted
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: 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>
1 parent bc18dd3 commit 1d02328

15 files changed

Lines changed: 21 additions & 21 deletions

File tree

‎Documentation/RCU/whatisRCU.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ RCU pointer/list update:
818818
list_add_tail_rcu
819819
list_del_rcu
820820
list_replace_rcu
821-
hlist_add_after_rcu
821+
hlist_add_behind_rcu
822822
hlist_add_before_rcu
823823
hlist_add_head_rcu
824824
hlist_del_rcu

‎drivers/gpu/drm/drm_hashtab.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
125125
parent = &entry->head;
126126
}
127127
if (parent) {
128-
hlist_add_after_rcu(parent, &item->head);
128+
hlist_add_behind_rcu(&item->head, parent);
129129
} else {
130130
hlist_add_head_rcu(&item->head, h_list);
131131
}

‎drivers/net/ethernet/intel/i40e/i40e_ethtool.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi *vsi,
19481948

19491949
/* add filter to the list */
19501950
if (parent)
1951-
hlist_add_after(&parent->fdir_node, &input->fdir_node);
1951+
hlist_add_behind(&input->fdir_node, &parent->fdir_node);
19521952
else
19531953
hlist_add_head(&input->fdir_node,
19541954
&pf->fdir_filter_list);

‎drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
25172517

25182518
/* add filter to the list */
25192519
if (parent)
2520-
hlist_add_after(&parent->fdir_node, &input->fdir_node);
2520+
hlist_add_behind(&input->fdir_node, &parent->fdir_node);
25212521
else
25222522
hlist_add_head(&input->fdir_node,
25232523
&adapter->fdir_filter_list);

‎drivers/staging/lustre/lustre/libcfs/hash.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd,
351351
cfs_hash_dhead_t, dh_head);
352352

353353
if (dh->dh_tail != NULL) /* not empty */
354-
hlist_add_after(dh->dh_tail, hnode);
354+
hlist_add_behind(hnode, dh->dh_tail);
355355
else /* empty list */
356356
hlist_add_head(hnode, &dh->dh_head);
357357
dh->dh_tail = hnode;
@@ -406,7 +406,7 @@ cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd,
406406
cfs_hash_dhead_dep_t, dd_head);
407407

408408
if (dh->dd_tail != NULL) /* not empty */
409-
hlist_add_after(dh->dd_tail, hnode);
409+
hlist_add_behind(hnode, dh->dd_tail);
410410
else /* empty list */
411411
hlist_add_head(hnode, &dh->dd_head);
412412
dh->dd_tail = hnode;

‎fs/namespace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static void commit_tree(struct mount *mnt, struct mount *shadows)
798798
list_splice(&head, n->list.prev);
799799

800800
if (shadows)
801-
hlist_add_after_rcu(&shadows->mnt_hash, &mnt->mnt_hash);
801+
hlist_add_behind_rcu(&mnt->mnt_hash, &shadows->mnt_hash);
802802
else
803803
hlist_add_head_rcu(&mnt->mnt_hash,
804804
m_hash(&parent->mnt, mnt->mnt_mountpoint));

‎fs/notify/inode_mark.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
232232

233233
BUG_ON(last == NULL);
234234
/* mark should be the last entry. last is the current last entry */
235-
hlist_add_after_rcu(&last->i.i_list, &mark->i.i_list);
235+
hlist_add_behind_rcu(&mark->i.i_list, &last->i.i_list);
236236
out:
237237
fsnotify_recalc_inode_mask_locked(inode);
238238
spin_unlock(&inode->i_lock);

‎fs/notify/vfsmount_mark.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
191191

192192
BUG_ON(last == NULL);
193193
/* mark should be the last entry. last is the current last entry */
194-
hlist_add_after_rcu(&last->m.m_list, &mark->m.m_list);
194+
hlist_add_behind_rcu(&mark->m.m_list, &last->m.m_list);
195195
out:
196196
fsnotify_recalc_vfsmount_mask_locked(mnt);
197197
spin_unlock(&mnt->mnt_root->d_lock);

‎include/linux/list.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ static inline void hlist_add_before(struct hlist_node *n,
654654
*(n->pprev) = n;
655655
}
656656

657-
static inline void hlist_add_after(struct hlist_node *prev,
658-
struct hlist_node *n)
657+
static inline void hlist_add_behind(struct hlist_node *n,
658+
struct hlist_node *prev)
659659
{
660660
n->next = prev->next;
661661
prev->next = n;

‎include/linux/rculist.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
432432
}
433433

434434
/**
435-
* hlist_add_after_rcu
436-
* @prev: the existing element to add the new element after.
435+
* hlist_add_behind_rcu
437436
* @n: the new element to add to the hash list.
437+
* @prev: the existing element to add the new element after.
438438
*
439439
* Description:
440440
* Adds the specified element to the specified hlist
@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
449449
* hlist_for_each_entry_rcu(), used to prevent memory-consistency
450450
* problems on Alpha CPUs.
451451
*/
452-
static inline void hlist_add_after_rcu(struct hlist_node *prev,
453-
struct hlist_node *n)
452+
static inline void hlist_add_behind_rcu(struct hlist_node *n,
453+
struct hlist_node *prev)
454454
{
455455
n->next = prev->next;
456456
n->pprev = &prev->next;

0 commit comments

Comments
 (0)