Skip to content

Commit

Permalink
bcache: fix for gc crashing when no sectors are used
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Swenson <nks@daterainc.com>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
  • Loading branch information
Nicholas Swenson authored and Kent Overstreet committed Dec 16, 2013
1 parent 97d11a6 commit bee63f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/bcache/movinggc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ static bool bucket_cmp(struct bucket *l, struct bucket *r)

static unsigned bucket_heap_top(struct cache *ca)
{
return GC_SECTORS_USED(heap_peek(&ca->heap));
struct bucket *b;
return (b = heap_peek(&ca->heap)) ? GC_SECTORS_USED(b) : 0;
}

void bch_moving_gc(struct cache_set *c)
Expand Down

0 comments on commit bee63f4

Please sign in to comment.