hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/list_bl.h
....@@ -86,6 +86,32 @@
8686 hlist_bl_set_first(h, n);
8787 }
8888
89
+static inline void hlist_bl_add_before(struct hlist_bl_node *n,
90
+ struct hlist_bl_node *next)
91
+{
92
+ struct hlist_bl_node **pprev = next->pprev;
93
+
94
+ n->pprev = pprev;
95
+ n->next = next;
96
+ next->pprev = &n->next;
97
+
98
+ /* pprev may be `first`, so be careful not to lose the lock bit */
99
+ WRITE_ONCE(*pprev,
100
+ (struct hlist_bl_node *)
101
+ ((uintptr_t)n | ((uintptr_t)*pprev & LIST_BL_LOCKMASK)));
102
+}
103
+
104
+static inline void hlist_bl_add_behind(struct hlist_bl_node *n,
105
+ struct hlist_bl_node *prev)
106
+{
107
+ n->next = prev->next;
108
+ n->pprev = &prev->next;
109
+ prev->next = n;
110
+
111
+ if (n->next)
112
+ n->next->pprev = &n->next;
113
+}
114
+
89115 static inline void __hlist_bl_del(struct hlist_bl_node *n)
90116 {
91117 struct hlist_bl_node *next = n->next;