summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-12-05 22:43:30 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:41:11 -0900
commitfa31f1a033c74f83ced87984f8b93576aae632d3 (patch)
tree38c165cc8b7aaa49fbac0482e1c9405fd36d74a3
parent68b7356c22a58ef3768ecfe6f43faa3ed3bc7871 (diff)
bcache: change copygc assertion to just print a warning
also, fix the assertion...
-rw-r--r--drivers/md/bcache/bcache.h2
-rw-r--r--drivers/md/bcache/movinggc.c33
2 files changed, 23 insertions, 12 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index f6b6c4e68192..e0f164bb5693 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -215,6 +215,8 @@
printk(KERN_INFO bch_fmt(c, fmt), ##__VA_ARGS__)
#define bch_notice(c, fmt, ...) \
printk(KERN_NOTICE bch_fmt(c, fmt), ##__VA_ARGS__)
+#define bch_warn(c, fmt, ...) \
+ printk(KERN_WARNING bch_fmt(c, fmt), ##__VA_ARGS__)
#define bch_err(c, fmt, ...) \
printk(KERN_ERR bch_fmt(c, fmt), ##__VA_ARGS__)
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c
index 1fe0bbb6869a..3da05da54c98 100644
--- a/drivers/md/bcache/movinggc.c
+++ b/drivers/md/bcache/movinggc.c
@@ -65,12 +65,16 @@ found:
return ret;
}
-static void read_moving(struct cache *ca, size_t buckets_to_move)
+static void read_moving(struct cache *ca, size_t buckets_to_move,
+ u64 sectors_to_move)
{
struct cache_set *c = ca->set;
+ struct bucket *g;
struct moving_context ctxt;
struct btree_iter iter;
struct bkey_s_c k;
+ u64 sectors_not_moved = 0;
+ size_t buckets_not_moved = 0;
bch_ratelimit_reset(&ca->moving_gc_pd.rate);
bch_move_ctxt_init(&ctxt, &ca->moving_gc_pd.rate,
@@ -105,13 +109,23 @@ next:
cond_resched();
}
+ bch_btree_iter_unlock(&iter);
+ bch_move_ctxt_exit(&ctxt);
+ trace_bcache_moving_gc_end(ca, ctxt.sectors_moved, ctxt.keys_moved,
+ buckets_to_move);
+
/* don't check this if we bailed out early: */
- if (IS_ENABLED(CONFIG_BCACHE_DEBUG)) {
- struct bucket *g;
+ for_each_bucket(g, ca)
+ if (g->copygc_gen && bucket_sectors_used(g)) {
+ sectors_not_moved += bucket_sectors_used(g);
+ buckets_not_moved++;
+ }
- for_each_bucket(g, ca)
- BUG_ON(g->copygc_gen && bucket_sectors_used(g));
- }
+ if (sectors_not_moved)
+ bch_warn(c, "copygc finished but %llu/%llu sectors, %zu/%zu buckets not moved",
+ sectors_not_moved, sectors_to_move,
+ buckets_not_moved, buckets_to_move);
+ return;
out:
bch_btree_iter_unlock(&iter);
bch_move_ctxt_exit(&ctxt);
@@ -213,12 +227,7 @@ static void bch_moving_gc(struct cache *ca)
mutex_unlock(&ca->heap_lock);
up_read(&c->gc_lock);
- read_moving(ca, buckets_to_move);
-
- if (IS_ENABLED(CONFIG_BCACHE_DEBUG)) {
- for_each_bucket(g, ca)
- BUG_ON(g->copygc_gen && bucket_sectors_used(g));
- }
+ read_moving(ca, buckets_to_move, sectors_to_move);
}
static int bch_moving_gc_thread(void *arg)