switch (iter->state) {
case ITER_GET_SUBBUF:
ret = lib_ring_buffer_get_next_subbuf(buf);
- if (ret && !READ_ONCE(buf->finalized)
+ if (ret && !LTTNG_READ_ONCE(buf->finalized)
&& config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
/*
* Use "pull" scheme for global buffers. The reader
}
EXPORT_SYMBOL_GPL(lib_ring_buffer_get_next_record);
+void lib_ring_buffer_put_current_record(struct lib_ring_buffer *buf)
+{
+ struct lib_ring_buffer_iter *iter;
+
+ if (!buf)
+ return;
+ iter = &buf->iter;
+ if (iter->state != ITER_NEXT_RECORD)
+ return;
+ iter->read_offset += iter->payload_len;
+ iter->state = ITER_TEST_RECORD;
+ if (iter->read_offset - iter->consumed >= iter->data_size) {
+ lib_ring_buffer_put_next_subbuf(buf);
+ iter->state = ITER_GET_SUBBUF;
+ }
+}
+EXPORT_SYMBOL_GPL(lib_ring_buffer_put_current_record);
+
static int buf_is_higher(void *a, void *b)
{
struct lib_ring_buffer *bufa = a;
*/
if (chan->iter.last_timestamp
> (buf->iter.timestamp + MAX_CLOCK_DELTA)) {
- printk(KERN_WARNING "ring_buffer: timestamps going "
+ printk(KERN_WARNING "LTTng: ring_buffer: timestamps going "
"backward. Last time %llu ns, cpu %d, "
"current time %llu ns, cpu %d, "
"delta %llu ns.\n",
list_add(&buf->iter.empty_node, &chan->iter.empty_head);
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
int lttng_cpuhp_rb_iter_online(unsigned int cpu,
struct lttng_cpuhp_node *node)
}
EXPORT_SYMBOL_GPL(lttng_cpuhp_rb_iter_online);
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
#ifdef CONFIG_HOTPLUG_CPU
static
}
#endif
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
int channel_iterator_init(struct channel *chan)
{
if (ret)
return ret;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
chan->cpuhp_iter_online.component = LTTNG_RING_BUFFER_ITER;
ret = cpuhp_state_add_instance(lttng_rb_hp_online,
&chan->cpuhp_iter_online.node);
if (ret)
return ret;
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
{
int cpu;
}
#endif
}
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
} else {
buf = channel_get_ring_buffer(config, chan, 0);
lib_ring_buffer_iterator_init(chan, buf);
const struct lib_ring_buffer_config *config = &chan->backend.config;
if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
{
int ret;
&chan->cpuhp_iter_online.node);
WARN_ON(ret);
}
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
chan->hp_iter_enable = 0;
unregister_cpu_notifier(&chan->hp_iter_notifier);
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
+#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
}
}
return -EFAULT;
}
read_count += copy_len;
- };
- return read_count;
+ }
+ goto put_record;
nodata:
*ppos = 0;
chan->iter.len_left = 0;
+put_record:
+ lib_ring_buffer_put_current_record(buf);
return read_count;
}