From c0c85e4f64e24c5cf6709cf5b8b54c6c0aa13d66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 5 May 2020 13:13:03 -0400 Subject: [PATCH] consumerd: pass channel instance to stream creation function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/consumer/consumer.c | 5 ++++- src/common/consumer/consumer.h | 4 +++- src/common/kernel-consumer/kernel-consumer.c | 5 +++-- src/common/ust-consumer/ust-consumer.c | 5 +++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 6525a7203..f2ea29187 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -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; diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 2bd45f2e1..f6e8b2b52 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -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, diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index d6cefe4e5..d2fda27b5 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -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); diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index d1b04438b..19713c812 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -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) { -- 2.34.1