Remove duplicate lookup in lttng_event_enabler_create_tracepoint_events_if_missing
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 10 Feb 2022 19:20:48 +0000 (14:20 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 15 Jul 2024 20:58:48 +0000 (16:58 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic597f34dfc3823ba83728bde3fcd41bb3eed9c91

src/lttng-events.c

index 3f95cc00fd183d7db6ed744a18939cb0e8e6817f..67a41a38fe6710bf730df64f5bb30f421518f197 100644 (file)
@@ -2256,7 +2256,6 @@ struct lttng_enabler_ref *lttng_enabler_ref(
 static
 void lttng_event_enabler_create_tracepoint_events_if_missing(struct lttng_event_enabler_common *event_enabler)
 {
-       struct lttng_event_ht *events_ht = lttng_get_event_ht_from_enabler(event_enabler);
        struct lttng_kernel_probe_desc *probe_desc;
        const struct lttng_kernel_event_desc *desc;
        struct list_head *probe_list;
@@ -2270,33 +2269,19 @@ void lttng_event_enabler_create_tracepoint_events_if_missing(struct lttng_event_
         */
        list_for_each_entry(probe_desc, probe_list, head) {
                for (i = 0; i < probe_desc->nr_events; i++) {
-                       bool found = false;
-                       struct hlist_head *head;
                        struct lttng_kernel_event_common *event;
-                       struct lttng_kernel_event_common_private *event_priv;
 
                        desc = probe_desc->event_desc[i];
                        if (!lttng_desc_match_enabler(desc, event_enabler))
                                continue;
-
-                       /*
-                        * Check if already created.
-                        */
-                       head = utils_borrow_hash_table_bucket(events_ht->table, LTTNG_EVENT_HT_SIZE, desc->event_name);
-                       lttng_hlist_for_each_entry(event_priv, head, hlist_node) {
-                               if (lttng_event_enabler_desc_match_event(event_enabler, desc, event_priv->pub)) {
-                                       found = true;
-                                       break;
-                               }
-                       }
-                       if (found)
-                               continue;
-
                        /*
                         * We need to create an event for this event probe.
                         */
                        event = _lttng_kernel_event_create(event_enabler, desc);
                        if (IS_ERR(event)) {
+                               /* Skip if already found. */
+                               if (PTR_ERR(event) == -EEXIST)
+                                       continue;
                                printk(KERN_INFO "LTTng: Unable to create event %s\n",
                                        probe_desc->event_desc[i]->event_name);
                        }
This page took 0.027931 seconds and 4 git commands to generate.