Lines Matching refs:elt
38 void tracing_map_update_sum(struct tracing_map_elt *elt, unsigned int i, u64 n) in tracing_map_update_sum() argument
40 atomic64_add(n, &elt->fields[i].sum); in tracing_map_update_sum()
55 u64 tracing_map_read_sum(struct tracing_map_elt *elt, unsigned int i) in tracing_map_read_sum() argument
57 return (u64)atomic64_read(&elt->fields[i].sum); in tracing_map_read_sum()
70 void tracing_map_set_var(struct tracing_map_elt *elt, unsigned int i, u64 n) in tracing_map_set_var() argument
72 atomic64_set(&elt->vars[i], n); in tracing_map_set_var()
73 elt->var_set[i] = true; in tracing_map_set_var()
85 bool tracing_map_var_set(struct tracing_map_elt *elt, unsigned int i) in tracing_map_var_set() argument
87 return elt->var_set[i]; in tracing_map_var_set()
102 u64 tracing_map_read_var(struct tracing_map_elt *elt, unsigned int i) in tracing_map_read_var() argument
104 return (u64)atomic64_read(&elt->vars[i]); in tracing_map_read_var()
121 u64 tracing_map_read_var_once(struct tracing_map_elt *elt, unsigned int i) in tracing_map_read_var_once() argument
123 elt->var_set[i] = false; in tracing_map_read_var_once()
124 return (u64)atomic64_read(&elt->vars[i]); in tracing_map_read_var_once()
355 static void tracing_map_elt_clear(struct tracing_map_elt *elt) in tracing_map_elt_clear() argument
359 for (i = 0; i < elt->map->n_fields; i++) in tracing_map_elt_clear()
360 if (elt->fields[i].cmp_fn == tracing_map_cmp_atomic64) in tracing_map_elt_clear()
361 atomic64_set(&elt->fields[i].sum, 0); in tracing_map_elt_clear()
363 for (i = 0; i < elt->map->n_vars; i++) { in tracing_map_elt_clear()
364 atomic64_set(&elt->vars[i], 0); in tracing_map_elt_clear()
365 elt->var_set[i] = false; in tracing_map_elt_clear()
368 if (elt->map->ops && elt->map->ops->elt_clear) in tracing_map_elt_clear()
369 elt->map->ops->elt_clear(elt); in tracing_map_elt_clear()
372 static void tracing_map_elt_init_fields(struct tracing_map_elt *elt) in tracing_map_elt_init_fields() argument
376 tracing_map_elt_clear(elt); in tracing_map_elt_init_fields()
378 for (i = 0; i < elt->map->n_fields; i++) { in tracing_map_elt_init_fields()
379 elt->fields[i].cmp_fn = elt->map->fields[i].cmp_fn; in tracing_map_elt_init_fields()
381 if (elt->fields[i].cmp_fn != tracing_map_cmp_atomic64) in tracing_map_elt_init_fields()
382 elt->fields[i].offset = elt->map->fields[i].offset; in tracing_map_elt_init_fields()
386 static void tracing_map_elt_free(struct tracing_map_elt *elt) in tracing_map_elt_free() argument
388 if (!elt) in tracing_map_elt_free()
391 if (elt->map->ops && elt->map->ops->elt_free) in tracing_map_elt_free()
392 elt->map->ops->elt_free(elt); in tracing_map_elt_free()
393 kfree(elt->fields); in tracing_map_elt_free()
394 kfree(elt->vars); in tracing_map_elt_free()
395 kfree(elt->var_set); in tracing_map_elt_free()
396 kfree(elt->key); in tracing_map_elt_free()
397 kfree(elt); in tracing_map_elt_free()
402 struct tracing_map_elt *elt; in tracing_map_elt_alloc() local
405 elt = kzalloc(sizeof(*elt), GFP_KERNEL); in tracing_map_elt_alloc()
406 if (!elt) in tracing_map_elt_alloc()
409 elt->map = map; in tracing_map_elt_alloc()
411 elt->key = kzalloc(map->key_size, GFP_KERNEL); in tracing_map_elt_alloc()
412 if (!elt->key) { in tracing_map_elt_alloc()
417 elt->fields = kcalloc(map->n_fields, sizeof(*elt->fields), GFP_KERNEL); in tracing_map_elt_alloc()
418 if (!elt->fields) { in tracing_map_elt_alloc()
423 elt->vars = kcalloc(map->n_vars, sizeof(*elt->vars), GFP_KERNEL); in tracing_map_elt_alloc()
424 if (!elt->vars) { in tracing_map_elt_alloc()
429 elt->var_set = kcalloc(map->n_vars, sizeof(*elt->var_set), GFP_KERNEL); in tracing_map_elt_alloc()
430 if (!elt->var_set) { in tracing_map_elt_alloc()
435 tracing_map_elt_init_fields(elt); in tracing_map_elt_alloc()
438 err = map->ops->elt_alloc(elt); in tracing_map_elt_alloc()
442 return elt; in tracing_map_elt_alloc()
444 tracing_map_elt_free(elt); in tracing_map_elt_alloc()
451 struct tracing_map_elt *elt = NULL; in get_free_elt() local
456 elt = *(TRACING_MAP_ELT(map->elts, idx)); in get_free_elt()
458 map->ops->elt_init(elt); in get_free_elt()
461 return elt; in get_free_elt()
564 struct tracing_map_elt *elt; in __tracing_map_insert() local
566 elt = get_free_elt(map); in __tracing_map_insert()
567 if (!elt) { in __tracing_map_insert()
573 memcpy(elt->key, key, map->key_size); in __tracing_map_insert()
574 entry->val = elt; in __tracing_map_insert()
842 if (memcmp((*a)->key, (*b)->key, (*a)->elt->map->key_size)) in cmp_entries_dup()
858 elt_a = (*a)->elt; in cmp_entries_sum()
859 elt_b = (*b)->elt; in cmp_entries_sum()
886 elt_a = (*a)->elt; in cmp_entries_key()
887 elt_b = (*b)->elt; in cmp_entries_key()
911 tracing_map_elt_free(entry->elt); in destroy_sort_entry()
935 create_sort_entry(void *key, struct tracing_map_elt *elt) in create_sort_entry() argument
944 sort_entry->elt = elt; in create_sort_entry()