Skip to content

Commit

Permalink
RB: use the same mechanism in reclaim as read/peek to detect end-of-ring
Browse files Browse the repository at this point in the history
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
  • Loading branch information
asalkeld committed Jun 7, 2012
1 parent cec82e0 commit 3369581
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/ringbuffer.c
Expand Up @@ -513,9 +513,13 @@ static void
_rb_chunk_reclaim(struct qb_ringbuffer_s * rb)
{
uint32_t old_read_pt;
uint32_t chunk_magic;

old_read_pt = rb->shared_hdr->read_pt;
QB_MAGIC_ASSERT(old_read_pt);
chunk_magic = QB_RB_CHUNK_MAGIC_GET(rb, old_read_pt);
if (chunk_magic != QB_RB_CHUNK_MAGIC) {
return;
}

rb->shared_hdr->read_pt = qb_rb_chunk_step(rb, old_read_pt);

Expand All @@ -533,7 +537,7 @@ _rb_chunk_reclaim(struct qb_ringbuffer_s * rb)
void
qb_rb_chunk_reclaim(struct qb_ringbuffer_s * rb)
{
if (rb == NULL || qb_rb_space_used(rb) == 0) {
if (rb == NULL) {
return;
}
_rb_chunk_reclaim(rb);
Expand Down

0 comments on commit 3369581

Please sign in to comment.