From 3cc2f24a5cdabfbcb1022c0798f6b4845f72b498 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 16 Oct 2012 11:42:23 -0400 Subject: [PATCH] Remove unused code The consumer change stream state function has been removed since it was not only not used but using the stream_ht also removed with this patch. Signed-off-by: David Goulet --- src/common/consumer.c | 30 -------------------------- src/common/consumer.h | 13 +++++------ src/common/ust-consumer/ust-consumer.c | 14 ------------ 3 files changed, 5 insertions(+), 52 deletions(-) diff --git a/src/common/consumer.c b/src/common/consumer.c index fb0d7d05a..0f0e60ad8 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -623,23 +623,6 @@ error: return outfd; } -/* - * Update a stream according to what we just received. - */ -void consumer_change_stream_state(int stream_key, - enum lttng_consumer_stream_state state) -{ - struct lttng_consumer_stream *stream; - - pthread_mutex_lock(&consumer_data.lock); - stream = consumer_find_stream(stream_key, consumer_data.stream_ht); - if (stream) { - stream->state = state; - } - consumer_data.need_update = 1; - pthread_mutex_unlock(&consumer_data.lock); -} - static void consumer_free_channel(struct rcu_head *head) { @@ -897,17 +880,6 @@ void lttng_consumer_cleanup(void) rcu_read_lock(); - /* - * close all outfd. Called when there are no more threads running (after - * joining on the threads), no need to protect list iteration with mutex. - */ - cds_lfht_for_each_entry(consumer_data.stream_ht->ht, &iter.iter, node, - node) { - struct lttng_consumer_stream *stream = - caa_container_of(node, struct lttng_consumer_stream, node); - consumer_del_stream(stream, consumer_data.stream_ht); - } - cds_lfht_for_each_entry(consumer_data.channel_ht->ht, &iter.iter, node, node) { struct lttng_consumer_channel *channel = @@ -917,7 +889,6 @@ void lttng_consumer_cleanup(void) rcu_read_unlock(); - lttng_ht_destroy(consumer_data.stream_ht); lttng_ht_destroy(consumer_data.channel_ht); } @@ -2335,7 +2306,6 @@ int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream) */ void lttng_consumer_init(void) { - consumer_data.stream_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); consumer_data.channel_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); consumer_data.relayd_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG); diff --git a/src/common/consumer.h b/src/common/consumer.h index 058bd695b..fe1568382 100644 --- a/src/common/consumer.h +++ b/src/common/consumer.h @@ -101,8 +101,8 @@ struct lttng_ust_lib_ring_buffer; * uniquely a stream. */ struct lttng_consumer_stream { + /* Hash table node for both metadata and data type */ struct lttng_ht_node_ulong node; - struct lttng_ht_node_ulong waitfd_node; struct lttng_consumer_channel *chan; /* associated channel */ /* * key is the key used by the session daemon to refer to the @@ -253,13 +253,12 @@ struct lttng_consumer_global_data { pthread_mutex_t lock; /* - * Number of streams in the hash table. Protected by consumer_data.lock. + * Number of streams in the data stream hash table declared outside. + * Protected by consumer_data.lock. */ int stream_count; - /* - * Hash tables of streams and channels. Protected by consumer_data.lock. - */ - struct lttng_ht *stream_ht; + + /* Channel hash table protected by consumer_data.lock. */ struct lttng_ht *channel_ht; /* * Flag specifying if the local array of FDs needs update in the @@ -344,8 +343,6 @@ extern void consumer_del_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht); extern void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, struct lttng_ht *ht); -extern void consumer_change_stream_state(int stream_key, - enum lttng_consumer_stream_state state); extern void consumer_del_channel(struct lttng_consumer_channel *channel); extern struct lttng_consumer_channel *consumer_allocate_channel( int channel_key, diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 5886d89b5..dea92ac23 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -308,20 +308,6 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, { rcu_read_unlock(); return -ENOSYS; -#if 0 - if (ctx->on_update_stream != NULL) { - ret = ctx->on_update_stream(msg.u.stream.stream_key, msg.u.stream.state); - if (ret == 0) { - consumer_change_stream_state(msg.u.stream.stream_key, msg.u.stream.state); - } else if (ret < 0) { - goto end; - } - } else { - consumer_change_stream_state(msg.u.stream.stream_key, - msg.u.stream.state); - } - break; -#endif } default: break; -- 2.34.1