Remove the use of the "waitfd_node" for metadata and index the "node" by
wait fd during stream allocation only for metadata stream.
This is done so the waitfd node could be used later on for the hash
table indexing stream by session id for the traced data check command
(soon to be implemented).
Signed-off-by: David Goulet <dgoulet@efficios.com>
-static
-void consumer_free_metadata_stream(struct rcu_head *head)
-{
- struct lttng_ht_node_ulong *node =
- caa_container_of(head, struct lttng_ht_node_ulong, head);
- struct lttng_consumer_stream *stream =
- caa_container_of(node, struct lttng_consumer_stream, waitfd_node);
-
- free(stream);
-}
-
/*
* RCU protected relayd socket pair free.
*/
/*
* RCU protected relayd socket pair free.
*/
stream->metadata_flag = metadata_flag;
strncpy(stream->path_name, path_name, sizeof(stream->path_name));
stream->path_name[sizeof(stream->path_name) - 1] = '\0';
stream->metadata_flag = metadata_flag;
strncpy(stream->path_name, path_name, sizeof(stream->path_name));
stream->path_name[sizeof(stream->path_name) - 1] = '\0';
- lttng_ht_node_init_ulong(&stream->waitfd_node, stream->wait_fd);
- lttng_ht_node_init_ulong(&stream->node, stream->key);
+
+ /*
+ * Index differently the metadata node because the thread is using an
+ * internal hash table to match streams in the metadata_ht to the epoll set
+ * file descriptor.
+ */
+ if (metadata_flag) {
+ lttng_ht_node_init_ulong(&stream->node, stream->wait_fd);
+ } else {
+ lttng_ht_node_init_ulong(&stream->node, stream->key);
+ }
/*
* The cpu number is needed before using any ustctl_* actions. Ignored for
/*
* The cpu number is needed before using any ustctl_* actions. Ignored for
- cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, waitfd_node.node) {
+ cds_lfht_for_each_entry(ht->ht, &iter.iter, stream, node.node) {
ret = lttng_ht_del(ht, &iter);
assert(!ret);
ret = lttng_ht_del(ht, &iter);
assert(!ret);
- call_rcu(&stream->waitfd_node.head, consumer_free_metadata_stream);
+ call_rcu(&stream->node.head, consumer_free_stream);
- iter.iter.node = &stream->waitfd_node.node;
+ iter.iter.node = &stream->node.node;
ret = lttng_ht_del(ht, &iter);
assert(!ret);
rcu_read_unlock();
ret = lttng_ht_del(ht, &iter);
assert(!ret);
rcu_read_unlock();
- call_rcu(&stream->waitfd_node.head, consumer_free_metadata_stream);
+ call_rcu(&stream->node.head, consumer_free_stream);
/* Steal stream identifier to avoid having streams with the same key */
consumer_steal_stream_key(stream->key, ht);
/* Steal stream identifier to avoid having streams with the same key */
consumer_steal_stream_key(stream->key, ht);
- lttng_ht_add_unique_ulong(ht, &stream->waitfd_node);
+ lttng_ht_add_unique_ulong(ht, &stream->node);
rcu_read_unlock();
pthread_mutex_unlock(&consumer_data.lock);
rcu_read_unlock();
pthread_mutex_unlock(&consumer_data.lock);
assert(node);
stream = caa_container_of(node, struct lttng_consumer_stream,
assert(node);
stream = caa_container_of(node, struct lttng_consumer_stream,
/* Check for error event */
if (revents & (LPOLLERR | LPOLLHUP)) {
/* Check for error event */
if (revents & (LPOLLERR | LPOLLHUP)) {