aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/RCU/whatisRCU.txt2
-rw-r--r--fs/dcache.c10
-rw-r--r--include/linux/list.h13
3 files changed, 8 insertions, 17 deletions
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
index 354d89c78377..15da16861fa3 100644
--- a/Documentation/RCU/whatisRCU.txt
+++ b/Documentation/RCU/whatisRCU.txt
@@ -772,8 +772,6 @@ RCU pointer/list traversal:
772 list_for_each_entry_rcu 772 list_for_each_entry_rcu
773 list_for_each_continue_rcu (to be deprecated in favor of new 773 list_for_each_continue_rcu (to be deprecated in favor of new
774 list_for_each_entry_continue_rcu) 774 list_for_each_entry_continue_rcu)
775 hlist_for_each_rcu (to be deprecated in favor of
776 hlist_for_each_entry_rcu)
777 hlist_for_each_entry_rcu 775 hlist_for_each_entry_rcu
778 776
779RCU pointer update: 777RCU pointer update:
diff --git a/fs/dcache.c b/fs/dcache.c
index e90512ed35a4..17e439138681 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -644,7 +644,7 @@ void shrink_dcache_parent(struct dentry * parent)
644 * 644 *
645 * Prune the dentries that are anonymous 645 * Prune the dentries that are anonymous
646 * 646 *
647 * parsing d_hash list does not hlist_for_each_rcu() as it 647 * parsing d_hash list does not hlist_for_each_entry_rcu() as it
648 * done under dcache_lock. 648 * done under dcache_lock.
649 * 649 *
650 */ 650 */
@@ -1043,15 +1043,13 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
1043 struct hlist_head *head = d_hash(parent,hash); 1043 struct hlist_head *head = d_hash(parent,hash);
1044 struct dentry *found = NULL; 1044 struct dentry *found = NULL;
1045 struct hlist_node *node; 1045 struct hlist_node *node;
1046 struct dentry *dentry;
1046 1047
1047 rcu_read_lock(); 1048 rcu_read_lock();
1048 1049
1049 hlist_for_each_rcu(node, head) { 1050 hlist_for_each_entry_rcu(dentry, node, head, d_hash) {
1050 struct dentry *dentry;
1051 struct qstr *qstr; 1051 struct qstr *qstr;
1052 1052
1053 dentry = hlist_entry(node, struct dentry, d_hash);
1054
1055 if (dentry->d_name.hash != hash) 1053 if (dentry->d_name.hash != hash)
1056 continue; 1054 continue;
1057 if (dentry->d_parent != parent) 1055 if (dentry->d_parent != parent)
@@ -1123,7 +1121,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent)
1123 spin_lock(&dcache_lock); 1121 spin_lock(&dcache_lock);
1124 base = d_hash(dparent, dentry->d_name.hash); 1122 base = d_hash(dparent, dentry->d_name.hash);
1125 hlist_for_each(lhp,base) { 1123 hlist_for_each(lhp,base) {
1126 /* hlist_for_each_rcu() not required for d_hash list 1124 /* hlist_for_each_entry_rcu() not required for d_hash list
1127 * as it is parsed under dcache_lock 1125 * as it is parsed under dcache_lock
1128 */ 1126 */
1129 if (dentry == hlist_entry(lhp, struct dentry, d_hash)) { 1127 if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {
diff --git a/include/linux/list.h b/include/linux/list.h
index 084971f333fe..fbfca73355a3 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -601,7 +601,7 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
601 * or hlist_del_rcu(), running on this same list. 601 * or hlist_del_rcu(), running on this same list.
602 * However, it is perfectly legal to run concurrently with 602 * However, it is perfectly legal to run concurrently with
603 * the _rcu list-traversal primitives, such as 603 * the _rcu list-traversal primitives, such as
604 * hlist_for_each_rcu(), used to prevent memory-consistency 604 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
605 * problems on Alpha CPUs. Regardless of the type of CPU, the 605 * problems on Alpha CPUs. Regardless of the type of CPU, the
606 * list-traversal primitive must be guarded by rcu_read_lock(). 606 * list-traversal primitive must be guarded by rcu_read_lock().
607 */ 607 */
@@ -650,7 +650,7 @@ static inline void hlist_add_after(struct hlist_node *n,
650 * or hlist_del_rcu(), running on this same list. 650 * or hlist_del_rcu(), running on this same list.
651 * However, it is perfectly legal to run concurrently with 651 * However, it is perfectly legal to run concurrently with
652 * the _rcu list-traversal primitives, such as 652 * the _rcu list-traversal primitives, such as
653 * hlist_for_each_rcu(), used to prevent memory-consistency 653 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
654 * problems on Alpha CPUs. 654 * problems on Alpha CPUs.
655 */ 655 */
656static inline void hlist_add_before_rcu(struct hlist_node *n, 656static inline void hlist_add_before_rcu(struct hlist_node *n,
@@ -675,7 +675,7 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
675 * or hlist_del_rcu(), running on this same list. 675 * or hlist_del_rcu(), running on this same list.
676 * However, it is perfectly legal to run concurrently with 676 * However, it is perfectly legal to run concurrently with
677 * the _rcu list-traversal primitives, such as 677 * the _rcu list-traversal primitives, such as
678 * hlist_for_each_rcu(), used to prevent memory-consistency 678 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
679 * problems on Alpha CPUs. 679 * problems on Alpha CPUs.
680 */ 680 */
681static inline void hlist_add_after_rcu(struct hlist_node *prev, 681static inline void hlist_add_after_rcu(struct hlist_node *prev,
@@ -699,11 +699,6 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
699 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 699 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
700 pos = n) 700 pos = n)
701 701
702#define hlist_for_each_rcu(pos, head) \
703 for ((pos) = (head)->first; \
704 rcu_dereference((pos)) && ({ prefetch((pos)->next); 1; }); \
705 (pos) = (pos)->next)
706
707/** 702/**
708 * hlist_for_each_entry - iterate over list of given type 703 * hlist_for_each_entry - iterate over list of given type
709 * @tpos: the type * to use as a loop counter. 704 * @tpos: the type * to use as a loop counter.
@@ -756,7 +751,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
756 751
757/** 752/**
758 * hlist_for_each_entry_rcu - iterate over rcu list of given type 753 * hlist_for_each_entry_rcu - iterate over rcu list of given type
759 * @pos: the type * to use as a loop counter. 754 * @tpos: the type * to use as a loop counter.
760 * @pos: the &struct hlist_node to use as a loop counter. 755 * @pos: the &struct hlist_node to use as a loop counter.
761 * @head: the head for your list. 756 * @head: the head for your list.
762 * @member: the name of the hlist_node within the struct. 757 * @member: the name of the hlist_node within the struct.