- unsigned int l1 = (hash & (table->n_buckets - 1)) >> DP_L1_SHIFT;
- unsigned int l2 = hash & ((1 << DP_L2_BITS) - 1);
+ struct tbl *table = container_of(rcu, struct tbl, rcu);
+ tbl_destroy(table, table->obj_destructor);
+}
+
+/**
+ * tbl_deferred_destroy - destroy table after a RCU grace period
+ * @table: table to destroy
+ * @destructor: function to be called on objects at destruction time
+ *
+ * Calls tbl_destroy() on @table after an RCU grace period. If @destructor is
+ * not null it is called on every element before the table is destroyed. */
+void tbl_deferred_destroy(struct tbl *table, void (*destructor)(struct tbl_node *))
+{
+ if (!table)
+ return;
+
+ table->obj_destructor = destructor;
+ call_rcu(&table->rcu, destroy_table_rcu);
+}
+
+static struct tbl_bucket **find_bucket(struct tbl *table, u32 hash)
+{
+ unsigned int l1 = (hash & (table->n_buckets - 1)) >> TBL_L1_SHIFT;
+ unsigned int l2 = hash & ((1 << TBL_L2_BITS) - 1);