From: Jonathan Rajotte Date: Thu, 28 Sep 2017 20:37:22 +0000 (-0400) Subject: Clean-up: consumer_add_metadata_stream always returns 0 X-Git-Tag: v2.11.0-rc1~418 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=66d583dc40af49e00d85385eb6f148c0fe3f7d50;p=lttng-tools.git Clean-up: consumer_add_metadata_stream always returns 0 Since c869f647b0c4476645ab9ee01e362401fb8c1e42, the return value of consumer_add_metadata_stream is always zero. Hence, we can remove some dead error handling code. consumer_add_metadata_stream success is checked using asserts. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index a8c369904..96ad8512e 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -630,10 +630,9 @@ end: /* * Add a stream to the global list protected by a mutex. */ -int consumer_add_data_stream(struct lttng_consumer_stream *stream) +void consumer_add_data_stream(struct lttng_consumer_stream *stream) { struct lttng_ht *ht = data_ht; - int ret = 0; assert(stream); assert(ht); @@ -683,8 +682,6 @@ int consumer_add_data_stream(struct lttng_consumer_stream *stream) pthread_mutex_unlock(&stream->chan->timer_lock); pthread_mutex_unlock(&stream->chan->lock); pthread_mutex_unlock(&consumer_data.lock); - - return ret; } void consumer_del_data_stream(struct lttng_consumer_stream *stream) @@ -2106,10 +2103,9 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, * Action done with the metadata stream when adding it to the consumer internal * data structures to handle it. */ -int consumer_add_metadata_stream(struct lttng_consumer_stream *stream) +void consumer_add_metadata_stream(struct lttng_consumer_stream *stream) { struct lttng_ht *ht = metadata_ht; - int ret = 0; struct lttng_ht_iter iter; struct lttng_ht_node_u64 *node; @@ -2169,7 +2165,6 @@ int consumer_add_metadata_stream(struct lttng_consumer_stream *stream) pthread_mutex_unlock(&stream->chan->lock); pthread_mutex_unlock(&stream->chan->timer_lock); pthread_mutex_unlock(&consumer_data.lock); - return ret; } /* diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index d115a597a..eb9b8c463 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -754,9 +754,9 @@ void consumer_destroy_relayd(struct consumer_relayd_sock_pair *relayd); unsigned long consumer_get_consume_start_pos(unsigned long consumed_pos, unsigned long produced_pos, uint64_t nb_packets_per_stream, uint64_t max_sb_size); -int consumer_add_data_stream(struct lttng_consumer_stream *stream); +void consumer_add_data_stream(struct lttng_consumer_stream *stream); void consumer_del_stream_for_data(struct lttng_consumer_stream *stream); -int consumer_add_metadata_stream(struct lttng_consumer_stream *stream); +void consumer_add_metadata_stream(struct lttng_consumer_stream *stream); void consumer_del_stream_for_metadata(struct lttng_consumer_stream *stream); int consumer_create_index_file(struct lttng_consumer_stream *stream); diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 1c2751b59..02d042733 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -740,26 +740,14 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, /* Get the right pipe where the stream will be sent. */ if (new_stream->metadata_flag) { - ret = consumer_add_metadata_stream(new_stream); - if (ret) { - ERR("Consumer add metadata stream %" PRIu64 " failed. Continuing", - new_stream->key); - consumer_stream_free(new_stream); - goto end_nosignal; - } + consumer_add_metadata_stream(new_stream); stream_pipe = ctx->consumer_metadata_pipe; } else { - ret = consumer_add_data_stream(new_stream); - if (ret) { - ERR("Consumer add stream %" PRIu64 " failed. Continuing", - new_stream->key); - consumer_stream_free(new_stream); - goto end_nosignal; - } + consumer_add_data_stream(new_stream); stream_pipe = ctx->consumer_data_pipe; } - /* Vitible to other threads */ + /* Visible to other threads */ new_stream->globally_visible = 1; health_code_update(); diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index ef88a97a4..c5c2a6548 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -206,20 +206,10 @@ static int send_stream_to_thread(struct lttng_consumer_stream *stream, /* Get the right pipe where the stream will be sent. */ if (stream->metadata_flag) { - ret = consumer_add_metadata_stream(stream); - if (ret) { - ERR("Consumer add metadata stream %" PRIu64 " failed.", - stream->key); - goto error; - } + consumer_add_metadata_stream(stream); stream_pipe = ctx->consumer_metadata_pipe; } else { - ret = consumer_add_data_stream(stream); - if (ret) { - ERR("Consumer add stream %" PRIu64 " failed.", - stream->key); - goto error; - } + consumer_add_data_stream(stream); stream_pipe = ctx->consumer_data_pipe; }