Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jonathan.rajotte-julien@efficios.com (Jonathan Rajotte)
Subject: [lttng-dev] [PATCH lttng-tools 2/2] Cleanup: consumer_add_metadata_stream always return 0
Date: Thu, 28 Sep 2017 16:37:22 -0400	[thread overview]
Message-ID: <20170928203722.29150-2-jonathan.rajotte-julien@efficios.com> (raw)
In-Reply-To: <20170928203722.29150-1-jonathan.rajotte-julien@efficios.com>

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 based on assert() check for
relevant data.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/common/consumer/consumer.c               |  9 ++-------
 src/common/consumer/consumer.h               |  4 ++--
 src/common/kernel-consumer/kernel-consumer.c | 18 +++---------------
 src/common/ust-consumer/ust-consumer.c       | 14 ++------------
 4 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c
index a8c36990..96ad8512 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 d115a597..eb9b8c46 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 7bcb86a3..b761a879 100644
--- a/src/common/kernel-consumer/kernel-consumer.c
+++ b/src/common/kernel-consumer/kernel-consumer.c
@@ -748,26 +748,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 ab240f7d..bd8e2c50 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;
 	}
 
-- 
2.11.0



      reply	other threads:[~2017-09-28 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 20:37 [lttng-dev] [PATCH lttng-tools 1/2] Fix: scope ownership of a stream for ust-consumer Jonathan Rajotte
2017-09-28 20:37 ` Jonathan Rajotte [this message]

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=20170928203722.29150-2-jonathan.rajotte-julien@efficios.com \
    --to=jonathan.rajotte-julien@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