-static void free_link_group_list(struct link_group *group)
-{
- struct link_group *next_group;
- while (group) {
- next_group = group->next;
- FREE(group);
- group = next_group;
- }
-}
-
-/* Frees a link group table. */
-void free_link_group_table(struct link_group_table *table)
-{
- if (table) {
- if (table->array)
- for (size_t i = 0; i < table->capacity; i++)
- free_link_group_list(table->array[i]);
- free_link_group_list(table->extra_groups);
- FREE(table);
- }
-}
-
-static u64
-assign_link_group_ids_to_list(struct link_group *group, u64 id,
- struct link_group **extra_groups)
-{
- struct dentry *dentry;
- struct list_head *cur_head;
- struct link_group *prev_group = NULL;
- struct link_group *cur_group = group;
- while (cur_group) {
- cur_head = cur_group->dentry_list;
- do {
- dentry = container_of(cur_head,
- struct dentry,
- link_group_list);
- dentry->link_group_id = id;
- cur_head = cur_head->next;
- } while (cur_head != cur_group->dentry_list);
- cur_group->link_group_id = id;
- id++;
- prev_group = cur_group;
- cur_group = cur_group->next;
- }
- if (group && extra_groups) {
- prev_group->next = *extra_groups;
- *extra_groups = group;
- }
- return id;
-}
-
-/* Insert the link groups in the `extra_groups' list into the hash table */
-static void insert_extra_groups(struct link_group_table *table)