OSDN Git Service

bcache: Fix GC_SECTORS_USED() calculation
authorKent Overstreet <kmo@daterainc.com>
Fri, 12 Jul 2013 02:43:21 +0000 (19:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jul 2013 23:30:10 +0000 (16:30 -0700)
commit99e56bf5abce5131746397a2ce551fd92ca8f342
tree84362fdd07d6abc662dc832dde64fafacd577c40
parentfe1b710530e60c8fbb07a73ad27e9f65305ce06a
bcache: Fix GC_SECTORS_USED() calculation

commit 29ebf465b9050f241c4433a796a32e6c896a9dcd upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bcache/btree.c