aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-07-11 22:43:21 -0400
committerKent Overstreet <kmo@daterainc.com>2013-07-12 03:22:48 -0400
commit29ebf465b9050f241c4433a796a32e6c896a9dcd (patch)
treec5d9e433cff6b0ab4ea779bd6ff16bfe6c01cae0 /drivers/md
parentfaa5673617656ee58369a3cfe4a312cfcdc59c81 (diff)
bcache: Fix GC_SECTORS_USED() calculation
Part of the job of garbage collection is to add up however many sectors of live data it finds in each bucket, but that doesn't work very well if it doesn't reset GC_SECTORS_USED() when it starts. Whoops. This wouldn't have broken anything horribly, but allocation tries to preferentially reclaim buckets that are mostly empty and that's not gonna work with an incorrect GC_SECTORS_USED() value. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bcache/btree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 15b58239c683..ee372884c405 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1410,8 +1410,10 @@ static void btree_gc_start(struct cache_set *c)
1410 for_each_cache(ca, c, i) 1410 for_each_cache(ca, c, i)
1411 for_each_bucket(b, ca) { 1411 for_each_bucket(b, ca) {
1412 b->gc_gen = b->gen; 1412 b->gc_gen = b->gen;
1413 if (!atomic_read(&b->pin)) 1413 if (!atomic_read(&b->pin)) {
1414 SET_GC_MARK(b, GC_MARK_RECLAIMABLE); 1414 SET_GC_MARK(b, GC_MARK_RECLAIMABLE);
1415 SET_GC_SECTORS_USED(b, 0);
1416 }
1415 } 1417 }
1416 1418
1417 mutex_unlock(&c->bucket_lock); 1419 mutex_unlock(&c->bucket_lock);