diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-07-11 19:43:21 -0700 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-07-12 00:22:48 -0700 |
commit | 29ebf465b9050f241c4433a796a32e6c896a9dcd (patch) | |
tree | c5d9e433cff6b0ab4ea779bd6ff16bfe6c01cae0 /drivers/md | |
parent | faa5673617656ee58369a3cfe4a312cfcdc59c81 (diff) | |
download | op-kernel-dev-29ebf465b9050f241c4433a796a32e6c896a9dcd.zip op-kernel-dev-29ebf465b9050f241c4433a796a32e6c896a9dcd.tar.gz |
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.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 15b5823..ee37288 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) for_each_cache(ca, c, i) for_each_bucket(b, ca) { b->gc_gen = b->gen; - if (!atomic_read(&b->pin)) + if (!atomic_read(&b->pin)) { SET_GC_MARK(b, GC_MARK_RECLAIMABLE); + SET_GC_SECTORS_USED(b, 0); + } } mutex_unlock(&c->bucket_lock); |