On Mon, January 5, 2009 16:09, Steven Rostedt wrote:> I just hate public functions that have flags that can get confusing.> Looking at code where I see:>> ring_buffer_get_event(buffer, cpu, ts, 0);>> I find it hard to know if the ",0" is correct or should be a ",1"> instead.

That's what I didn't like about the original patch either.Sent a new patch against tip doing the above, as well as doingthe same for rb_iter_peek (ignore the first one, see try 2).

Slightly different topic, there are quite a few unused functions,e.g. ring_buffer_read_page(). Should those be removed until theyare actually used, or are there things in the pipeline that willuse them?

I'm not sure if rb_event_length() is safe as it is, returning -1for RINGBUF_TYPE_PADDING, for an unsigned return value. Thateasily overflows into a low value in e.g. rb_advance_iter().Wouldn't it be better to return the maximum possible size?

rb_advance_reader() calls rb_get_reader_page() and rb_reader_event(),but rb_get_event(), which is the only caller of rb_advance_reader,does that as well, which seems a bit more of the same.

Further, rb_get_reader_page() takes cpu_buffer->lock, but all callersof rb_get_event() take the cpu_buffer->reader_lock. As rb_get_event()always calls rb_get_reader_page(), both locks will be taken for eachof those calls. Doesn't that make the cpu_buffer->lock redundant?Getting rid of it and moving the locking into rb_get_event() wouldsimplify things (except that ring_buffer_read_page() is a bit funny).