X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fstream.c;h=1eaca14ec934e27c6a36f3c986bce70d09340a85;hb=87250ba19aec78f36e301494a03f5678fcb6fbb4;hp=1e51547fa2bc928924cf79bbce9fbbd8b2add379;hpb=8bb66c3cd60938352927ee865759433387324250;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/stream.c b/src/bin/lttng-relayd/stream.c index 1e51547fa..1eaca14ec 100644 --- a/src/bin/lttng-relayd/stream.c +++ b/src/bin/lttng-relayd/stream.c @@ -1,21 +1,11 @@ /* - * Copyright (C) 2013 - Julien Desfossez - * David Goulet - * 2015 - Mathieu Desnoyers - * 2019 - Jérémie Galarneau + * Copyright (C) 2013 Julien Desfossez + * Copyright (C) 2013 David Goulet + * Copyright (C) 2015 Mathieu Desnoyers + * Copyright (C) 2019 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -81,6 +71,7 @@ static void stream_complete_rotation(struct relay_stream *stream) lttng_trace_chunk_put(stream->trace_chunk); stream->trace_chunk = stream->ongoing_rotation.value.next_trace_chunk; stream->ongoing_rotation = (typeof(stream->ongoing_rotation)) {}; + stream->completed_rotation_count++; } static int stream_create_data_output_file_from_trace_chunk( @@ -225,7 +216,7 @@ static int rotate_truncate_stream(struct relay_stream *stream) * trace chunk. */ acquired_reference = lttng_trace_chunk_get(stream->trace_chunk); - assert(acquired_reference); + LTTNG_ASSERT(acquired_reference); previous_chunk = stream->trace_chunk; /* @@ -234,12 +225,12 @@ static int rotate_truncate_stream(struct relay_stream *stream) * the orinal stream_fd will be used to copy the "extra" data * to the new file. */ - assert(stream->file); + LTTNG_ASSERT(stream->file); previous_stream_file = stream->file; stream->file = NULL; - assert(!stream->is_metadata); - assert(stream->tracefile_size_current > + LTTNG_ASSERT(!stream->is_metadata); + LTTNG_ASSERT(stream->tracefile_size_current > stream->pos_after_last_complete_data_index); misplaced_data_size = stream->tracefile_size_current - stream->pos_after_last_complete_data_index; @@ -251,7 +242,7 @@ static int rotate_truncate_stream(struct relay_stream *stream) goto end; } - assert(stream->file); + LTTNG_ASSERT(stream->file); /* * Seek the current tracefile to the position at which the rotation * should have occurred. @@ -515,7 +506,7 @@ static int try_rotate_stream_index(struct relay_stream *stream) * In overwrite mode, the packet seq num may jump over the * rotation position. */ - assert(LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 >= + LTTNG_ASSERT(LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 >= stream->ongoing_rotation.value.packet_seq_num); DBG("Rotating stream %" PRIu64 " index file", stream->stream_handle); @@ -560,7 +551,7 @@ static int stream_set_trace_chunk(struct relay_stream *stream, lttng_trace_chunk_put(stream->trace_chunk); acquired_reference = lttng_trace_chunk_get(chunk); - assert(acquired_reference); + LTTNG_ASSERT(acquired_reference); stream->trace_chunk = chunk; if (stream->file) { @@ -735,7 +726,7 @@ static void stream_unpublish(struct relay_stream *stream) iter.iter.node = &stream->node.node; ret = lttng_ht_del(relay_streams_ht, &iter); - assert(!ret); + LTTNG_ASSERT(!ret); stream->in_stream_ht = false; } if (stream->published) { @@ -818,7 +809,7 @@ static void stream_release(struct urcu_ref *ref) void stream_put(struct relay_stream *stream) { rcu_read_lock(); - assert(stream->ref.refcount != 0); + LTTNG_ASSERT(stream->ref.refcount != 0); /* * Wait until we have processed all the stream packets before * actually putting our last stream reference. @@ -850,7 +841,7 @@ int stream_set_pending_rotation(struct relay_stream *stream, const bool reference_acquired = lttng_trace_chunk_get(next_trace_chunk); - assert(reference_acquired); + LTTNG_ASSERT(reference_acquired); } LTTNG_OPTIONAL_SET(&stream->ongoing_rotation, rotation); @@ -1141,7 +1132,7 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num, uint64_t data_offset; struct relay_index *index; - assert(stream->trace_chunk); + LTTNG_ASSERT(stream->trace_chunk); ASSERT_LOCKED(stream->lock); /* Get data offset because we are about to update the index. */ data_offset = htobe64(stream->tracefile_size_current);