+/* Double the capacity of the inode hash table. */
+void
+enlarge_inode_table(struct wim_inode_table *table)
+{
+ const size_t old_capacity = table->capacity;
+ const size_t new_capacity = old_capacity * 2;
+ struct hlist_head *old_array = table->array;
+ struct hlist_head *new_array;
+ struct wim_inode *inode;
+ struct hlist_node *tmp;
+
+ new_array = CALLOC(new_capacity, sizeof(struct hlist_head));
+ if (!new_array)
+ return;
+ table->array = new_array;
+ table->capacity = new_capacity;
+ for (size_t i = 0; i < old_capacity; i++) {
+ hlist_for_each_entry_safe(inode, tmp, &old_array[i], i_hlist_node) {
+ hlist_add_head(&inode->i_hlist_node,
+ &new_array[hash_inode(table, inode->i_ino,
+ inode->i_devno)]);
+ }
+ }
+ FREE(old_array);
+}
+