summaryrefslogtreecommitdiff
path: root/libbcache/super-io.h
diff options
context:
space:
mode:
Diffstat (limited to 'libbcache/super-io.h')
-rw-r--r--libbcache/super-io.h16
1 files changed, 13 insertions, 3 deletions
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;