Re: Merging relayfs?

From: Tom Zanussi
Date: Mon Jul 18 2005 - 09:45:01 EST


Steven Rostedt writes:
> On Sun, 2005-07-17 at 10:52 -0500, Tom Zanussi wrote:
>
> > >
> > > > > - overwrite mode can be implemented via the buffer switch callback
> > > >
> > > > The buffer switch callback is already where this is handled, unless
> > > > you're thinking of something else - one of the first checks in the
> > > > buffer switch is relay_buf_full(), which always returns 0 if the
> > > > buffer is in overwrite mode.
> > >
> > > I mean, relayfs doesn't has to know about this, the client itself can do
> > > it (e.g. via helper functions).
> >
> > In a previous version, we did something like having the client pass
> > back a return value from the callback indicating whether or not to
> > continue or stop. I can try doing something like that instead again.
>
> Tom,
>
> I'm actually very much against this. Looking at a point of view from the
> logdev device. Having a callback to know to continue at every buffer
> switch would just be slowing down something that is expected to be very
> fast. I don't see the problem with having an overwrite mode or not. Why
> can't relayfs know this? It _is_ an operation of relayfs, and having it
> pushed to the client would seem to make the client need to know more
> about how relayfs works that it needs to. Because, the logdev device
> doesn't care about buffer switches.

I don't think it would slow anything down - it would be pretty much
the same code being executed as before e.g. the buffer_start()
callback for overwrite mode could look like this:

int buffer_start()
{
...
return 1; // continue unconditionally
}

And for no-overwrite mode:

int buffer_start()
{
...
return !relay_buf_full(buf); // continue if not full
}

Since the buffer start callback already returns the amount that's
supposed to be reserved at the start of the sub-buffer, I'd have to
make that an outparam instead, I guess, but it's basically the same
code handling the overwrite/no-overwrite condition.

Tom


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/