- 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)
-{
- struct link_group *group, *next_group;
- size_t pos;
-
- group = table->extra_groups;
- while (group) {
- next_group = group->next;
- pos = group->link_group_id % table->capacity;
- group->next = table->array[pos];
- table->array[pos] = group;
- group = next_group;
- }
- table->extra_groups = NULL;
-}
-
-/* Assign the link group IDs to dentries in a link group table, and return the
- * next available link group ID. */
-u64 assign_link_group_ids(struct link_group_table *table)
-{
- DEBUG("Assigning link groups");
- struct link_group *extra_groups = table->extra_groups;
-
- /* Assign consecutive link group IDs to each link group in the hash
- * table */
- u64 id = 1;
- for (size_t i = 0; i < table->capacity; i++) {
- id = assign_link_group_ids_to_list(table->array[i], id,
- &table->extra_groups);
- table->array[i] = NULL;
- }
-
- /* Assign link group IDs to the "extra" link groups and insert them into
- * the hash table */
- id = assign_link_group_ids_to_list(extra_groups, id, NULL);
- insert_extra_groups(table);
- return id;