]> Pileus Git - ~andy/linux/commitdiff
bcache: fix for gc crashing when no sectors are used
authorNicholas Swenson <nks@daterainc.com>
Fri, 1 Nov 2013 02:25:18 +0000 (19:25 -0700)
committerKent Overstreet <kmo@daterainc.com>
Mon, 16 Dec 2013 22:22:57 +0000 (14:22 -0800)
Signed-off-by: Nicholas Swenson <nks@daterainc.com>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
drivers/md/bcache/movinggc.c

index 7c1275e66025b691ec8ee4896448d46e28a2c5d9..46c952379fabf09fc09b093f4211c2f3f394189e 100644 (file)
@@ -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)