diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-08-03 22:59:52 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-08-03 22:59:52 -0800 |
commit | 1c99b8fdce303e0961ee982919c890bf156ed775 (patch) | |
tree | f5347d15b7a4bbd817f1637934c47890e1d06351 | |
parent | b08fb3587c2d14313a8cf6df4e801d16af1117a5 (diff) |
bcache: kill c->cache_slots_used
it wasn't actually needed, but it wasn't being set correctly and causing
assertions to fail
-rw-r--r-- | drivers/md/bcache/bcache.h | 1 | ||||
-rw-r--r-- | drivers/md/bcache/btree_gc.c | 6 | ||||
-rw-r--r-- | drivers/md/bcache/extents.c | 13 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 13 |
4 files changed, 12 insertions, 21 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 6903ab40ac6f..fca21a796c17 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -525,7 +525,6 @@ struct cache_set { struct work_struct read_only_work; struct cache __rcu *cache[MAX_CACHES_PER_SET]; - unsigned long cache_slots_used[BITS_TO_LONGS(MAX_CACHES_PER_SET)]; struct mutex mi_lock; struct cache_member_rcu __rcu *members; diff --git a/drivers/md/bcache/btree_gc.c b/drivers/md/bcache/btree_gc.c index a7fdec3e65a5..5dfa8e766717 100644 --- a/drivers/md/bcache/btree_gc.c +++ b/drivers/md/bcache/btree_gc.c @@ -99,10 +99,6 @@ u8 bch_btree_key_recalc_oldest_gen(struct cache_set *c, struct bkey_s_c k) rcu_read_lock(); - extent_for_each_ptr(e, ptr) - if (ptr->dev < MAX_CACHES_PER_SET) - __set_bit(ptr->dev, c->cache_slots_used); - extent_for_each_online_device(c, e, ptr, ca) { struct bucket *g = PTR_BUCKET(ca, ptr); @@ -349,8 +345,6 @@ void bch_gc(struct cache_set *c) * uses, GC could skip past them */ - memset(c->cache_slots_used, 0, sizeof(c->cache_slots_used)); - if (test_bit(CACHE_SET_GC_FAILURE, &c->flags)) return; diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c index ee8202b47a87..c6b0a709f0cb 100644 --- a/drivers/md/bcache/extents.c +++ b/drivers/md/bcache/extents.c @@ -1521,15 +1521,10 @@ static void bch_extent_debugcheck_extent(struct cache_set *c, struct btree *b, if (ptr->dev >= mi->nr_in_set) goto bad_device; - do { - seq = read_seqcount_begin(&c->gc_pos_lock); - bad = !test_bit(ptr->dev, c->cache_slots_used) && - c->gc_pos.phase == GC_PHASE_DONE; - } while (read_seqcount_retry(&c->gc_pos_lock, seq)); - - if (bad) - goto bad_device; - + /* + * If journal replay hasn't finished, we might be seeing keys + * that will be overwritten by the time journal replay is done: + */ if (!test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags)) continue; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 2278eb5b36f6..e46bab05831d 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1823,6 +1823,11 @@ static void bch_cache_remove_work(struct work_struct *work) synchronize_rcu(); lockdep_assert_held(&bch_register_lock); + + /* + * Free this device's slot in the cache_member array - all pointers to + * this device must be gone: + */ memset(&c->disk_mi[dev].uuid, 0, sizeof(c->disk_mi[dev].uuid)); bcache_write_super(c); @@ -2118,10 +2123,9 @@ int bch_cache_set_add_cache(struct cache_set *c, const char *path) goto no_slot; for (nr_this_dev = 0; nr_this_dev < MAX_CACHES_PER_SET; nr_this_dev++) - if (!test_bit(nr_this_dev, c->cache_slots_used) && - (nr_this_dev >= c->sb.nr_in_set || - bch_is_zero(c->disk_mi[nr_this_dev].uuid.b, - sizeof(uuid_le)))) + if (nr_this_dev >= c->sb.nr_in_set || + bch_is_zero(c->disk_mi[nr_this_dev].uuid.b, + sizeof(uuid_le))) goto have_slot; no_slot: up_read(&c->gc_lock); @@ -2132,7 +2136,6 @@ no_slot: have_slot: nr_in_set = max_t(unsigned, nr_this_dev + 1, c->sb.nr_in_set); - set_bit(nr_this_dev, c->cache_slots_used); up_read(&c->gc_lock); u64s = nr_in_set * (sizeof(struct cache_member) / sizeof(u64)); |