src.ctf.fs: remove uneeded check in create_streams_for_trace
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 9 Jun 2022 17:52:02 +0000 (13:52 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
At this point, we certainly have a stream class.

The ir_sc field is set in ctf_stream_class_to_ir.
ctf_stream_class_to_ir is called by ctf_trace_class_translate, which is
called by ctf_visitor_generate_ir_visit_node if ctx->trace_class is set.
That trace_class field is set if a self_comp was passed to
ctf_visitor_generate_ir_create, in the decoder_config object.  Going up
the stack, we get to ctf_fs_metadata_set_trace_class, called by
ctf_fs_trace_create, called by ctf_fs_component_create_ctf_fs_trace.

create_streams_for_trace is called by ctf_fs_trace_create, which always
passes a self_comp to ctf_fs_component_create_ctf_fs_trace, ensuring we
always end up with a stream class.

ctf_fs_component_create_ctf_fs_trace is also used in the context of
queries, where no self_comp if passed, and therefore no stream class is
created..  But in that context, create_streams_for_trace is not called.

Change-Id: I5e8ef72a1013fc156a7bc6ac0d4cbb231a5ab704
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8237
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12274
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/fs-src/fs.cpp

index 39abdd6cf78f000eb98b508711480085e67c9044..f2bd9618e1f9e95ad5483f328cec798d87646f82 100644 (file)
@@ -2076,22 +2076,18 @@ static int create_streams_for_trace(struct ctf_fs_trace *ctf_fs_trace)
             goto error;
         }
 
-        if (ds_file_group->sc->ir_sc) {
-            BT_ASSERT(ctf_fs_trace->trace);
-
-            if (ds_file_group->stream_id == UINT64_C(-1)) {
-                /* No stream ID: use 0 */
-                ds_file_group->stream = bt_stream_create_with_id(
-                    ds_file_group->sc->ir_sc, ctf_fs_trace->trace, ctf_fs_trace->next_stream_id);
-                ctf_fs_trace->next_stream_id++;
-            } else {
-                /* Specific stream ID */
-                ds_file_group->stream =
-                    bt_stream_create_with_id(ds_file_group->sc->ir_sc, ctf_fs_trace->trace,
-                                             (uint64_t) ds_file_group->stream_id);
-            }
+        BT_ASSERT(ds_file_group->sc->ir_sc);
+        BT_ASSERT(ctf_fs_trace->trace);
+
+        if (ds_file_group->stream_id == UINT64_C(-1)) {
+            /* No stream ID: use 0 */
+            ds_file_group->stream = bt_stream_create_with_id(
+                ds_file_group->sc->ir_sc, ctf_fs_trace->trace, ctf_fs_trace->next_stream_id);
+            ctf_fs_trace->next_stream_id++;
         } else {
-            ds_file_group->stream = NULL;
+            /* Specific stream ID */
+            ds_file_group->stream = bt_stream_create_with_id(
+                ds_file_group->sc->ir_sc, ctf_fs_trace->trace, (uint64_t) ds_file_group->stream_id);
         }
 
         if (!ds_file_group->stream) {
This page took 0.025161 seconds and 4 git commands to generate.