From ac1b32acb4ca8c59c0e4911a8d3b27fd72dc54af Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 9 Mar 2017 08:27:30 -0900 Subject: cmd_device_fail Add a comamnd for setting a device as failed, update bcache sources --- libbcache/super-io.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'libbcache/super-io.h') diff --git a/libbcache/super-io.h b/libbcache/super-io.h index ae1e8b9d..21ba6e07 100644 --- a/libbcache/super-io.h +++ b/libbcache/super-io.h @@ -129,17 +129,27 @@ static inline bool bch_check_super_marked(struct cache_set *c, struct bkey_s_c_extent e = bkey_i_to_s_c_extent(k); const struct bch_extent_ptr *ptr; struct cache_member_cpu *mi = cache_member_info_get(c)->m; + unsigned nr_replicas = 0; bool ret = true; - extent_for_each_ptr(e, ptr) - if (!ptr->cached && - !(meta + extent_for_each_ptr(e, ptr) { + if (ptr->cached) + continue; + + if (!(meta ? mi[ptr->dev].has_metadata : mi[ptr->dev].has_data)) { ret = false; break; } + nr_replicas++; + } + + if (nr_replicas < + (meta ? c->sb.meta_replicas_have : c->sb.data_replicas_have)) + ret = false; + cache_member_info_put(); return ret; -- cgit v1.2.3