]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - include/linux/list.h
Update bcachefs sources to 3ca08ab51ec9 bcachefs: six locks: Simplify optimistic...
[bcachefs-tools-debian] / include / linux / list.h
index bdd09efa7968534149b7c47ec27d5983309424b8..d176d0d3485e5929f31a76b14ac5eb8008fa2fce 100644 (file)
@@ -98,4 +98,15 @@ static inline void hlist_del_init(struct hlist_node *n)
             pos;                                                       \
             pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
 
+static inline size_t list_count_nodes(struct list_head *head)
+{
+       struct list_head *pos;
+       size_t count = 0;
+
+       list_for_each(pos, head)
+               count++;
+
+       return count;
+}
+
 #endif /* _LIST_LIST_H */