consumerd: consumer-stream.cpp: iterate on lfht using lfht_filtered_iteration_adapter
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 29 Jul 2024 20:26:13 +0000 (20:26 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 18:26:44 +0000 (14:26 -0400)
Change-Id: I625c1a942fc7aa635d78a62cf468b17651596412
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer/consumer-stream.cpp

index e65592055518cbb028aeea78fde576da59c62c0f..0fa4fb214488ef6c36d912eaa51203e4994511a9 100644 (file)
@@ -364,27 +364,19 @@ end_unlock_mutex:
 int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx, uint64_t session_id)
 {
        int ret;
-       struct lttng_consumer_stream *stream = nullptr;
-       struct lttng_ht_iter iter;
-       struct lttng_ht *ht;
 
        LTTNG_ASSERT(ctx);
 
-       /* Ease our life a bit. */
-       ht = the_consumer_data.stream_list_ht;
-
-       const lttng::urcu::read_lock_guard read_lock;
-
        /* Search the metadata associated with the session id of the given stream. */
-
-       cds_lfht_for_each_entry_duplicate(ht->ht,
-                                         ht->hash_fct(&session_id, lttng_ht_seed),
-                                         ht->match_fct,
-                                         &session_id,
-                                         &iter.iter,
-                                         stream,
-                                         node_session_id.node)
-       {
+       for (auto *stream : lttng::urcu::lfht_filtered_iteration_adapter<
+                    lttng_consumer_stream,
+                    decltype(lttng_consumer_stream::node_session_id),
+                    &lttng_consumer_stream::node_session_id,
+                    std::uint64_t>(*the_consumer_data.stream_list_ht->ht,
+                                   &session_id,
+                                   the_consumer_data.stream_list_ht->hash_fct(&session_id,
+                                                                              lttng_ht_seed),
+                                   the_consumer_data.stream_list_ht->match_fct)) {
                if (!stream->metadata_flag) {
                        continue;
                }
This page took 0.026476 seconds and 4 git commands to generate.