aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/alloc.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2014-03-13 13:46:29 -0700
committerKent Overstreet <kmo@daterainc.com>2014-03-18 12:22:36 -0700
commit4fe6a816707aace9e8e297b708411c5930537793 (patch)
tree1316f5df799ba13ca96adcf47d87656fdebf394d /drivers/md/bcache/alloc.c
parentbcache: Add bch_keylist_init_single() (diff)
downloadlinux-dev-4fe6a816707aace9e8e297b708411c5930537793.tar.xz
linux-dev-4fe6a816707aace9e8e297b708411c5930537793.zip
bcache: Add a real GC_MARK_RECLAIMABLE
This means the garbage collection code can better check for data and metadata pointers to the same buckets. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/alloc.c')
-rw-r--r--drivers/md/bcache/alloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index a3e1427945f2..5ba4eaea57f4 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -155,7 +155,8 @@ add:
static bool can_invalidate_bucket(struct cache *ca, struct bucket *b)
{
- return GC_MARK(b) == GC_MARK_RECLAIMABLE &&
+ return (!GC_MARK(b) ||
+ GC_MARK(b) == GC_MARK_RECLAIMABLE) &&
!atomic_read(&b->pin) &&
can_inc_bucket_gen(b);
}
@@ -475,7 +476,7 @@ void bch_bucket_free(struct cache_set *c, struct bkey *k)
for (i = 0; i < KEY_PTRS(k); i++) {
struct bucket *b = PTR_BUCKET(c, k, i);
- SET_GC_MARK(b, GC_MARK_RECLAIMABLE);
+ SET_GC_MARK(b, 0);
SET_GC_SECTORS_USED(b, 0);
bch_bucket_add_unused(PTR_CACHE(c, k, i), b);
}