bcache: Fix GC_SECTORS_USED() calculation
authorKent Overstreet <kmo@daterainc.com>
Fri, 12 Jul 2013 02:43:21 +0000 (19:43 -0700)
committerKent Overstreet <kmo@daterainc.com>
Fri, 12 Jul 2013 07:22:48 +0000 (00:22 -0700)
commit29ebf465b9050f241c4433a796a32e6c896a9dcd
treec5d9e433cff6b0ab4ea779bd6ff16bfe6c01cae0
parentfaa5673617656ee58369a3cfe4a312cfcdc59c81
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
drivers/md/bcache/btree.c