From: Jérémie Galarneau Date: Tue, 5 May 2020 17:13:03 +0000 (-0400) Subject: consumerd: pass channel instance to stream creation function X-Git-Tag: v2.13.0-rc1~636 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=49f45573c5077c2e1766819bf13518ac560a3ee0;p=lttng-tools.git consumerd: pass channel instance to stream creation function 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 Change-Id: Icea7088e7695e310585bf398e14e6443d67a30bb --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index d70a5d1d4..4101925c6 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -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; diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index b7593d001..077e959d7 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -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, diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 54314ec75..5aec4ecf8 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -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); diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index a6d8463a8..b46a50502 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -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) {