consumerd: pass channel instance to stream creation function
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 5 May 2020 17:13:03 +0000 (13:13 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 26 May 2020 21:28:46 +0000 (17:28 -0400)
Both callsites of consumer_allocate_stream() set the stream's "chan"
pointer after the creation. Pass the channel directly to the stream
creation function so it can initialize the stream according to the
channel's settings.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icea7088e7695e310585bf398e14e6443d67a30bb

src/common/consumer/consumer.c
src/common/consumer/consumer.h
src/common/kernel-consumer/kernel-consumer.c
src/common/ust-consumer/ust-consumer.c

index 6525a7203130e7bbf3ce3a97cba489735029a61b..f2ea2918778469d9416101ac848f75d1dcacf6e3 100644 (file)
@@ -564,7 +564,9 @@ void consumer_stream_update_channel_attributes(
                        channel->tracefile_size;
 }
 
-struct lttng_consumer_stream *consumer_allocate_stream(uint64_t channel_key,
+struct lttng_consumer_stream *consumer_allocate_stream(
+               struct lttng_consumer_channel *channel,
+               uint64_t channel_key,
                uint64_t stream_key,
                const char *channel_name,
                uint64_t relayd_id,
@@ -592,6 +594,7 @@ struct lttng_consumer_stream *consumer_allocate_stream(uint64_t channel_key,
        }
 
        rcu_read_lock();
+       stream->chan = channel;
        stream->key = stream_key;
        stream->trace_chunk = trace_chunk;
        stream->out_fd = -1;
index 2bd45f2e1de9c0457c1e2b6fd41224b12b2dc91b..f6e8b2b52d19071575bc5b539d8017ae34efa964 100644 (file)
@@ -749,7 +749,9 @@ void consumer_stream_update_channel_attributes(
                struct lttng_consumer_stream *stream,
                struct lttng_consumer_channel *channel);
 
-struct lttng_consumer_stream *consumer_allocate_stream(uint64_t channel_key,
+struct lttng_consumer_stream *consumer_allocate_stream(
+               struct lttng_consumer_channel *channel,
+               uint64_t channel_key,
                uint64_t stream_key,
                const char *channel_name,
                uint64_t relayd_id,
index d6cefe4e54bdc144b6e810e5641aef052b4a5b9f..d2fda27b5d4dcbff1bc46217bc003144f50c33e6 100644 (file)
@@ -664,7 +664,9 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                health_code_update();
 
                pthread_mutex_lock(&channel->lock);
-               new_stream = consumer_allocate_stream(channel->key,
+               new_stream = consumer_allocate_stream(
+                               channel,
+                               channel->key,
                                fd,
                                channel->name,
                                channel->relayd_id,
@@ -686,7 +688,6 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        goto error_add_stream_nosignal;
                }
 
-               new_stream->chan = channel;
                new_stream->wait_fd = fd;
                ret = kernctl_get_max_subbuf_size(new_stream->wait_fd,
                                &new_stream->max_sb_size);
index d1b04438b0d76956bd74ff2c8ddb2d8acb777418..19713c81291f3ae8e0ab3a5c4bfe67cbacb3c27d 100644 (file)
@@ -157,7 +157,9 @@ static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
        assert(channel);
        assert(ctx);
 
-       stream = consumer_allocate_stream(channel->key,
+       stream = consumer_allocate_stream(
+                       channel,
+                       channel->key,
                        key,
                        channel->name,
                        channel->relayd_id,
@@ -186,7 +188,6 @@ static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
        }
 
        consumer_stream_update_channel_attributes(stream, channel);
-       stream->chan = channel;
 
 error:
        if (_alloc_ret) {
This page took 0.029994 seconds and 4 git commands to generate.