summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Swenson <nks@daterainc.com>2013-10-31 19:25:18 -0700
committerKent Overstreet <kmo@daterainc.com>2013-12-16 14:22:57 -0800
commitbee63f40cb5f5e8ab2abfbc85acde99cc0acd4b5 (patch)
tree200af9c17b71b40af0b1bf44320e2030bdbdfaf5
parent97d11a660fd906dbea3dccd2638495d8497c3c81 (diff)
bcache: fix for gc crashing when no sectors are used
Signed-off-by: Nicholas Swenson <nks@daterainc.com> Signed-off-by: Kent Overstreet <kmo@daterainc.com>
-rw-r--r--drivers/md/bcache/movinggc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index 7c1275e6602..46c952379fa 100644
--- a/drivers/md/bcache/movinggc.c
+++ b/drivers/md/bcache/movinggc.c
@@ -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)