When tracing first was added it had latency tracers that used a separate snapshot buffer to swap the current buffer being written to with a static buffer that is only read. This later became a feature that user space could use by attaching to the latency tracer snapshot buffer. But the buffer was named max_buffer which is not what it is used for in all cases.
Rename the max_buffer name to snapshot_buffer. The "use_max_tr" field of the tracer structure is only defined when CONFIG_TRACER_MAX_TRACE is defined. To get rid of some of the #ifdefs in the code around accesses of that field, use a helper function tracer_uses_snapshot() that access the field when the config is defined, or returns false if not. Finally, since the latency tracers use the snapshot buffer and snapshot buffers do not need latency tracers, have the TRACER_MAX_TRACE config select TRACE_SNAPSHOT config and not the other way around. Also clean up the code to properly protect the max tracer references and the snapshot references. Changes since v2: https://lore.kernel.org/all/[email protected]/ - Fix tracing_set_tracer() when CONFIG_TRACER_SNAPSHOT is not enabled. Seems that some fields that are only available with that config were still exposed, and the local variable used was still hidden. (kernel test robot) - Fix trace_create_maxlat_file() declaration when CONFIG_TRACER_SNAPSHOT is not defined. Changes since v1: https://lore.kernel.org/linux-trace-kernel/[email protected]/ - This separates the updates to snapshot buffer and max tracers from the last series. It was a rewrite. Steven Rostedt (3): tracing: Rename trace_array field max_buffer to snapshot_buffer tracing: Add tracer_uses_snapshot() helper to remove #ifdefs tracing: Better separate SNAPSHOT and MAX_TRACE options ---- kernel/trace/Kconfig | 8 +- kernel/trace/trace.c | 192 +++++++++++++++++++----------------------- kernel/trace/trace.h | 44 +++++++--- kernel/trace/trace_selftest.c | 10 +-- 4 files changed, 127 insertions(+), 127 deletions(-)
