summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/movinggc.c
diff options
context:
space:
mode:
authorNicholas Swenson <nks@daterainc.com>2013-11-08 01:53:19 (GMT)
committerKent Overstreet <kmo@daterainc.com>2013-12-16 22:22:58 (GMT)
commit981aa8c091e164ea51dd1e81b71a1f3852bbcceb (patch)
tree63b14b1df54db25daa2ce46c8f42b5cff0ab1b89 /drivers/md/bcache/movinggc.c
parentbee63f40cb5f5e8ab2abfbc85acde99cc0acd4b5 (diff)
downloadlinux-981aa8c091e164ea51dd1e81b71a1f3852bbcceb.tar.xz
bcache: bugfix - moving_gc now moves only correct buckets
Removed gc_move_threshold because picking buckets only by threshold could lead moving extra buckets (ei. if there are buckets at the threshold that aren't supposed to be moved do to space considerations). This is replaced by a GC_MOVE bit in the gc_mark bitmask. Now only marked buckets get moved. Signed-off-by: Nicholas Swenson <nks@daterainc.com> Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/movinggc.c')
-rw-r--r--drivers/md/bcache/movinggc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index 46c9523..30f347d 100644
--- a/drivers/md/bcache/movinggc.c
+++ b/drivers/md/bcache/movinggc.c
@@ -25,10 +25,9 @@ static bool moving_pred(struct keybuf *buf, struct bkey *k)
unsigned i;
for (i = 0; i < KEY_PTRS(k); i++) {
- struct cache *ca = PTR_CACHE(c, k, i);
struct bucket *g = PTR_BUCKET(c, k, i);
- if (GC_SECTORS_USED(g) < ca->gc_move_threshold)
+ if (GC_MOVE(g))
return true;
}
@@ -227,9 +226,8 @@ void bch_moving_gc(struct cache_set *c)
sectors_to_move -= GC_SECTORS_USED(b);
}
- ca->gc_move_threshold = bucket_heap_top(ca);
-
- pr_debug("threshold %u", ca->gc_move_threshold);
+ while (heap_pop(&ca->heap, b, bucket_cmp))
+ SET_GC_MOVE(b, 1);
}
mutex_unlock(&c->bucket_lock);