Lines Matching refs:objagg

43 struct objagg {  struct
158 static struct objagg_obj *objagg_obj_lookup(struct objagg *objagg, void *obj) in objagg_obj_lookup() argument
160 return rhashtable_lookup_fast(&objagg->obj_ht, obj, objagg->ht_params); in objagg_obj_lookup()
163 static int objagg_obj_parent_assign(struct objagg *objagg, in objagg_obj_parent_assign() argument
170 delta_priv = objagg->ops->delta_create(objagg->priv, parent->obj, in objagg_obj_parent_assign()
182 trace_objagg_obj_parent_assign(objagg, objagg_obj, in objagg_obj_parent_assign()
188 static int objagg_obj_parent_lookup_assign(struct objagg *objagg, in objagg_obj_parent_lookup_assign() argument
194 list_for_each_entry(objagg_obj_cur, &objagg->obj_list, list) { in objagg_obj_parent_lookup_assign()
200 err = objagg_obj_parent_assign(objagg, objagg_obj, in objagg_obj_parent_lookup_assign()
208 static void __objagg_obj_put(struct objagg *objagg,
211 static void objagg_obj_parent_unassign(struct objagg *objagg, in objagg_obj_parent_unassign() argument
214 trace_objagg_obj_parent_unassign(objagg, objagg_obj, in objagg_obj_parent_unassign()
217 objagg->ops->delta_destroy(objagg->priv, objagg_obj->delta_priv); in objagg_obj_parent_unassign()
218 __objagg_obj_put(objagg, objagg_obj->parent); in objagg_obj_parent_unassign()
221 static int objagg_obj_root_id_alloc(struct objagg *objagg, in objagg_obj_root_id_alloc() argument
229 if (!objagg->hints) { in objagg_obj_root_id_alloc()
241 min = objagg->hints->root_count; in objagg_obj_root_id_alloc()
245 root_id = ida_alloc_range(&objagg->root_ida, min, max, GFP_KERNEL); in objagg_obj_root_id_alloc()
253 static void objagg_obj_root_id_free(struct objagg *objagg, in objagg_obj_root_id_free() argument
256 if (!objagg->hints) in objagg_obj_root_id_free()
258 ida_free(&objagg->root_ida, objagg_obj->root_id); in objagg_obj_root_id_free()
261 static int objagg_obj_root_create(struct objagg *objagg, in objagg_obj_root_create() argument
267 err = objagg_obj_root_id_alloc(objagg, objagg_obj, hnode); in objagg_obj_root_create()
270 objagg_obj->root_priv = objagg->ops->root_create(objagg->priv, in objagg_obj_root_create()
277 trace_objagg_obj_root_create(objagg, objagg_obj); in objagg_obj_root_create()
281 objagg_obj_root_id_free(objagg, objagg_obj); in objagg_obj_root_create()
285 static void objagg_obj_root_destroy(struct objagg *objagg, in objagg_obj_root_destroy() argument
288 trace_objagg_obj_root_destroy(objagg, objagg_obj); in objagg_obj_root_destroy()
289 objagg->ops->root_destroy(objagg->priv, objagg_obj->root_priv); in objagg_obj_root_destroy()
290 objagg_obj_root_id_free(objagg, objagg_obj); in objagg_obj_root_destroy()
293 static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj);
295 static int objagg_obj_init_with_hints(struct objagg *objagg, in objagg_obj_init_with_hints() argument
303 hnode = objagg_hints_lookup(objagg->hints, objagg_obj->obj); in objagg_obj_init_with_hints()
311 return objagg_obj_root_create(objagg, objagg_obj, hnode); in objagg_obj_init_with_hints()
313 parent = __objagg_obj_get(objagg, hnode->parent->obj); in objagg_obj_init_with_hints()
317 err = objagg_obj_parent_assign(objagg, objagg_obj, parent, false); in objagg_obj_init_with_hints()
327 objagg_obj_put(objagg, parent); in objagg_obj_init_with_hints()
331 static int objagg_obj_init(struct objagg *objagg, in objagg_obj_init() argument
340 err = objagg_obj_init_with_hints(objagg, objagg_obj, &hint_found); in objagg_obj_init()
348 err = objagg_obj_parent_lookup_assign(objagg, objagg_obj); in objagg_obj_init()
352 return objagg_obj_root_create(objagg, objagg_obj, NULL); in objagg_obj_init()
355 static void objagg_obj_fini(struct objagg *objagg, in objagg_obj_fini() argument
359 objagg_obj_parent_unassign(objagg, objagg_obj); in objagg_obj_fini()
361 objagg_obj_root_destroy(objagg, objagg_obj); in objagg_obj_fini()
364 static struct objagg_obj *objagg_obj_create(struct objagg *objagg, void *obj) in objagg_obj_create() argument
369 objagg_obj = kzalloc(sizeof(*objagg_obj) + objagg->ops->obj_size, in objagg_obj_create()
374 memcpy(objagg_obj->obj, obj, objagg->ops->obj_size); in objagg_obj_create()
376 err = objagg_obj_init(objagg, objagg_obj); in objagg_obj_create()
380 err = rhashtable_insert_fast(&objagg->obj_ht, &objagg_obj->ht_node, in objagg_obj_create()
381 objagg->ht_params); in objagg_obj_create()
384 list_add(&objagg_obj->list, &objagg->obj_list); in objagg_obj_create()
385 objagg->obj_count++; in objagg_obj_create()
386 trace_objagg_obj_create(objagg, objagg_obj); in objagg_obj_create()
391 objagg_obj_fini(objagg, objagg_obj); in objagg_obj_create()
397 static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj) in __objagg_obj_get() argument
404 objagg_obj = objagg_obj_lookup(objagg, obj); in __objagg_obj_get()
410 return objagg_obj_create(objagg, obj); in __objagg_obj_get()
437 struct objagg_obj *objagg_obj_get(struct objagg *objagg, void *obj) in objagg_obj_get() argument
441 objagg_obj = __objagg_obj_get(objagg, obj); in objagg_obj_get()
445 trace_objagg_obj_get(objagg, objagg_obj, objagg_obj->refcount); in objagg_obj_get()
450 static void objagg_obj_destroy(struct objagg *objagg, in objagg_obj_destroy() argument
453 trace_objagg_obj_destroy(objagg, objagg_obj); in objagg_obj_destroy()
454 --objagg->obj_count; in objagg_obj_destroy()
456 rhashtable_remove_fast(&objagg->obj_ht, &objagg_obj->ht_node, in objagg_obj_destroy()
457 objagg->ht_params); in objagg_obj_destroy()
458 objagg_obj_fini(objagg, objagg_obj); in objagg_obj_destroy()
462 static void __objagg_obj_put(struct objagg *objagg, in __objagg_obj_put() argument
466 objagg_obj_destroy(objagg, objagg_obj); in __objagg_obj_put()
478 void objagg_obj_put(struct objagg *objagg, struct objagg_obj *objagg_obj) in objagg_obj_put() argument
480 trace_objagg_obj_put(objagg, objagg_obj, objagg_obj->refcount); in objagg_obj_put()
482 __objagg_obj_put(objagg, objagg_obj); in objagg_obj_put()
514 struct objagg *objagg_create(const struct objagg_ops *ops, in objagg_create()
517 struct objagg *objagg; in objagg_create() local
525 objagg = kzalloc(sizeof(*objagg), GFP_KERNEL); in objagg_create()
526 if (!objagg) in objagg_create()
528 objagg->ops = ops; in objagg_create()
530 objagg->hints = objagg_hints; in objagg_create()
533 objagg->priv = priv; in objagg_create()
534 INIT_LIST_HEAD(&objagg->obj_list); in objagg_create()
536 objagg->ht_params.key_len = ops->obj_size; in objagg_create()
537 objagg->ht_params.key_offset = offsetof(struct objagg_obj, obj); in objagg_create()
538 objagg->ht_params.head_offset = offsetof(struct objagg_obj, ht_node); in objagg_create()
540 err = rhashtable_init(&objagg->obj_ht, &objagg->ht_params); in objagg_create()
544 ida_init(&objagg->root_ida); in objagg_create()
546 trace_objagg_create(objagg); in objagg_create()
547 return objagg; in objagg_create()
550 kfree(objagg); in objagg_create()
561 void objagg_destroy(struct objagg *objagg) in objagg_destroy() argument
563 trace_objagg_destroy(objagg); in objagg_destroy()
564 ida_destroy(&objagg->root_ida); in objagg_destroy()
565 WARN_ON(!list_empty(&objagg->obj_list)); in objagg_destroy()
566 rhashtable_destroy(&objagg->obj_ht); in objagg_destroy()
567 if (objagg->hints) in objagg_destroy()
568 objagg_hints_put(objagg->hints); in objagg_destroy()
569 kfree(objagg); in objagg_destroy()
604 const struct objagg_stats *objagg_stats_get(struct objagg *objagg) in objagg_stats_get() argument
611 objagg->obj_count), GFP_KERNEL); in objagg_stats_get()
616 list_for_each_entry(objagg_obj, &objagg->obj_list, list) { in objagg_stats_get()
777 static struct objagg_tmp_graph *objagg_tmp_graph_create(struct objagg *objagg) in objagg_tmp_graph_create() argument
779 unsigned int nodes_count = objagg->obj_count; in objagg_tmp_graph_create()
803 list_for_each_entry(objagg_obj, &objagg->obj_list, list) { in objagg_tmp_graph_create()
817 if (objagg->ops->delta_check(objagg->priv, in objagg_tmp_graph_create()
843 struct objagg *objagg) in objagg_opt_simple_greedy_fillup_hints() argument
852 graph = objagg_tmp_graph_create(objagg); in objagg_opt_simple_greedy_fillup_hints()
864 objagg->ops->obj_size, in objagg_opt_simple_greedy_fillup_hints()
880 objagg->ops->obj_size, in objagg_opt_simple_greedy_fillup_hints()
897 struct objagg *objagg);
940 struct objagg_hints *objagg_hints_get(struct objagg *objagg, in objagg_hints_get() argument
951 objagg_hints->ops = objagg->ops; in objagg_hints_get()
956 objagg_hints->ht_params.key_len = objagg->ops->obj_size; in objagg_hints_get()
967 err = algo->fillup_hints(objagg_hints, objagg); in objagg_hints_get()
971 if (WARN_ON(objagg_hints->node_count != objagg->obj_count)) { in objagg_hints_get()