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:05:46 +0000 (17:05 -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 d70a5d1d406b758e1b02cc61f22b440ee006a7b1..4101925c6a8419bcfd40629918d5696f377a6be6 100644 (file)
@@ -568,7 +568,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,
@@ -596,6 +598,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 b7593d00182b23a4c604628ef372bd6a24ae861e..077e959d7863ee6653552166bac768d775917e07 100644 (file)
@@ -740,7 +740,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 54314ec75a2c4d7758fd3c3ac2cd4d8492dee893..5aec4ecf8bdb856b4b2c5fb41b6d79e1c269dcf9 100644 (file)
@@ -654,7 +654,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,
@@ -676,7 +678,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 a6d8463a8ce2f6709da1de394e4b7729632af574..b46a505021203a017832cec88826244f02895643 100644 (file)
@@ -147,7 +147,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,
@@ -176,7 +178,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.03853 seconds and 4 git commands to generate.