/* Returns the total number of entries in the ring buffer (all CPU entries)  */
unsigned long ring_buffer_entries(struct ring_buffer *buffer)
/* Returns the total number of entries in the ring buffer (all CPU entries)  */
unsigned long ring_buffer_entries(struct ring_buffer *buffer)
{
	struct ring_buffer_per_cpu *cpu_buffer;
	unsigned long entries = 0;
	int cpu;
	for_each_buffer_cpu(buffer, cpu) {
		cpu_buffer = buffer->buffers[cpu];
		entries += (local_read(&cpu_buffer->entries) -
			    local_read(&cpu_buffer->overrun)) - cpu_buffer->read;
	}
	return entries;
}