/* Flushes all channel buffers, i.e. forces buffer switch.  */
void relay_flush(struct rchan *chan)
/* Flushes all channel buffers, i.e. forces buffer switch.  */
void relay_flush(struct rchan *chan)
{
	unsigned int i;
	if (!chan)
		return;
	if (chan->is_global && chan->buf[0]) {
		relay_switch_subbuf(chan->buf[0], 0);
		return;
	}
	mutex_lock(&relay_channels_mutex);
	for_each_possible_cpu(i)
		if (chan->buf[i])
			relay_switch_subbuf(chan->buf[i], 0);
	mutex_unlock(&relay_channels_mutex);
}