Re: [PATCH v4 01/13] ring-buffer: Allow mapped field to be set without mapping

From: Steven Rostedt
Date: Tue Jun 11 2024 - 21:57:27 EST


On Tue, 11 Jun 2024 21:39:37 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> >
> > Maybe explain why sometimes __rb_inc_dec_mapped() is called to
> > increment or decrement ->mapped, and sometimes it id done directly ?
> > I can see that the function also acquires the buffer mutex, which
> > isn't needed at the places where mapped is incremented/decremented
> > directly, but common code would still be nice, and it is odd to see
> > over/underflows handled sometimes but not always.
>
> Sure. I'll add comments explaining more.

And I found a bug with this code. It assumes that mapped will be equal
to 1 if it's the last mapping. That will no longer be the case.

-- Steve