From: dgoulet@efficios.com (David Goulet)
Subject: [lttng-dev] [PATCH lttng-tools 4/4] Change the metadata hash table node
Date: Fri, 12 Oct 2012 10:30:35 -0400 [thread overview]
Message-ID: <1350052235-12198-4-git-send-email-dgoulet@efficios.com> (raw)
In-Reply-To: <1350052235-12198-1-git-send-email-dgoulet@efficios.com>
Remove the use of the "waitfd_node" for metadata and index the "node" by
wait fd during stream allocation only for metadata stream.
This was done so the waitfd node could be used later on for the hash
table indexing stream by session id the traced data check command (soon
to be implemented).
Signed-off-by: David Goulet <dgoulet at efficios.com>
---
src/common/consumer.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/common/consumer.c b/src/common/consumer.c
index 1fb9960..0c1a812 100644
--- a/src/common/consumer.c
+++ b/src/common/consumer.c
@@ -172,17 +172,6 @@ void consumer_free_stream(struct rcu_head *head)
free(stream);
}
-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.
*/
@@ -417,8 +406,17 @@ struct lttng_consumer_stream *consumer_allocate_stream(
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
@@ -1578,11 +1576,11 @@ static void destroy_stream_ht(struct lttng_ht *ht)
}
rcu_read_lock();
- 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);
- call_rcu(&stream->waitfd_node.head, consumer_free_metadata_stream);
+ call_rcu(&stream->node.head, consumer_free_stream);
}
rcu_read_unlock();
@@ -1636,7 +1634,7 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
}
rcu_read_lock();
- iter.iter.node = &stream->waitfd_node.node;
+ iter.iter.node = &stream->node.node;
ret = lttng_ht_del(ht, &iter);
assert(!ret);
rcu_read_unlock();
@@ -1707,7 +1705,7 @@ end:
}
free_stream:
- call_rcu(&stream->waitfd_node.head, consumer_free_metadata_stream);
+ call_rcu(&stream->node.head, consumer_free_stream);
}
/*
@@ -1756,7 +1754,7 @@ static int consumer_add_metadata_stream(struct lttng_consumer_stream *stream,
/* 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);
@@ -1881,7 +1879,7 @@ restart:
assert(node);
stream = caa_container_of(node, struct lttng_consumer_stream,
- waitfd_node);
+ node);
/* Check for error event */
if (revents & (LPOLLERR | LPOLLHUP)) {
--
1.7.10.4
next prev parent reply other threads:[~2012-10-12 14:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 14:30 [lttng-dev] [PATCH lttng-tools 1/4] Rename consumer threads and spawn them in daemon David Goulet
2012-10-12 14:30 ` [lttng-dev] [PATCH lttng-tools 2/4] Move add data stream to the data thread David Goulet
2012-10-13 15:53 ` Mathieu Desnoyers
2012-10-15 15:40 ` David Goulet
2012-10-15 17:31 ` Mathieu Desnoyers
2012-10-15 17:40 ` David Goulet
2012-10-15 17:42 ` Mathieu Desnoyers
2012-10-15 17:45 ` David Goulet
2012-10-15 17:56 ` Mathieu Desnoyers
2012-10-12 14:30 ` [lttng-dev] [PATCH lttng-tools 3/4] Make stream hash tables global to the consumer David Goulet
2012-10-13 15:56 ` Mathieu Desnoyers
2012-10-15 15:47 ` David Goulet
2012-10-15 17:57 ` Mathieu Desnoyers
2012-10-12 14:30 ` David Goulet [this message]
2012-10-13 16:00 ` [lttng-dev] [PATCH lttng-tools 4/4] Change the metadata hash table node Mathieu Desnoyers
2012-10-15 19:22 ` David Goulet
2012-10-13 15:41 ` [lttng-dev] [PATCH lttng-tools 1/4] Rename consumer threads and spawn them in daemon Mathieu Desnoyers
2012-10-15 15:39 ` David Goulet
2012-10-15 17:28 ` Mathieu Desnoyers
2012-10-15 17:37 ` David Goulet
2012-10-15 17:39 ` Mathieu Desnoyers
2012-10-15 17:42 ` David Goulet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350052235-12198-4-git-send-email-dgoulet@efficios.com \
--to=dgoulet@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox