Lines Matching +full:1 +full:e

24 static void verify_replicas_entry(struct bch_replicas_entry_v1 *e)  in verify_replicas_entry()  argument
27 BUG_ON(!e->nr_devs); in verify_replicas_entry()
28 BUG_ON(e->nr_required > 1 && in verify_replicas_entry()
29 e->nr_required >= e->nr_devs); in verify_replicas_entry()
31 for (unsigned i = 0; i + 1 < e->nr_devs; i++) in verify_replicas_entry()
32 BUG_ON(e->devs[i] >= e->devs[i + 1]); in verify_replicas_entry()
36 void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *e) in bch2_replicas_entry_sort() argument
38 bubble_sort(e->devs, e->nr_devs, u8_cmp); in bch2_replicas_entry_sort()
48 struct bch_replicas_entry_v0 *e) in bch2_replicas_entry_v0_to_text() argument
50 bch2_prt_data_type(out, e->data_type); in bch2_replicas_entry_v0_to_text()
52 prt_printf(out, ": %u [", e->nr_devs); in bch2_replicas_entry_v0_to_text()
53 for (unsigned i = 0; i < e->nr_devs; i++) in bch2_replicas_entry_v0_to_text()
54 prt_printf(out, i ? " %u" : "%u", e->devs[i]); in bch2_replicas_entry_v0_to_text()
59 struct bch_replicas_entry_v1 *e) in bch2_replicas_entry_to_text() argument
61 bch2_prt_data_type(out, e->data_type); in bch2_replicas_entry_to_text()
63 prt_printf(out, ": %u/%u [", e->nr_required, e->nr_devs); in bch2_replicas_entry_to_text()
64 for (unsigned i = 0; i < e->nr_devs; i++) in bch2_replicas_entry_to_text()
65 prt_printf(out, i ? " %u" : "%u", e->devs[i]); in bch2_replicas_entry_to_text()
78 if (r->nr_required > 1 && in bch2_replicas_entry_sb_validate()
106 if (r->nr_required > 1 && in bch2_replicas_entry_validate()
128 struct bch_replicas_entry_v1 *e; in bch2_cpu_replicas_to_text() local
131 for_each_cpu_replicas_entry(r, e) { in bch2_cpu_replicas_to_text()
136 bch2_replicas_entry_to_text(out, e); in bch2_cpu_replicas_to_text()
147 r->nr_required = 1; in extent_to_replicas()
174 void bch2_bkey_to_replicas(struct bch_replicas_entry_v1 *e, in bch2_bkey_to_replicas() argument
177 e->nr_devs = 0; in bch2_bkey_to_replicas()
182 e->data_type = BCH_DATA_btree; in bch2_bkey_to_replicas()
183 extent_to_replicas(k, e); in bch2_bkey_to_replicas()
187 e->data_type = BCH_DATA_user; in bch2_bkey_to_replicas()
188 extent_to_replicas(k, e); in bch2_bkey_to_replicas()
191 e->data_type = BCH_DATA_parity; in bch2_bkey_to_replicas()
192 stripe_to_replicas(k, e); in bch2_bkey_to_replicas()
196 bch2_replicas_entry_sort(e); in bch2_bkey_to_replicas()
199 void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *e, in bch2_devlist_to_replicas() argument
207 e->data_type = data_type; in bch2_devlist_to_replicas()
208 e->nr_devs = 0; in bch2_devlist_to_replicas()
209 e->nr_required = 1; in bch2_devlist_to_replicas()
212 replicas_entry_add_dev(e, *i); in bch2_devlist_to_replicas()
214 bch2_replicas_entry_sort(e); in bch2_devlist_to_replicas()
223 .nr = old->nr + 1, in cpu_replicas_add_entry()
251 return -1; in __replicas_entry_idx()
258 return idx < r->nr ? idx : -1; in __replicas_entry_idx()
397 struct bch_replicas_entry_v1 *e; in bch2_replicas_gc_start() local
408 for_each_cpu_replicas_entry(&c->replicas, e) { in bch2_replicas_gc_start()
410 if (e->data_type >= BCH_DATA_NR || in bch2_replicas_gc_start()
411 !((1 << e->data_type) & typemask)) { in bch2_replicas_gc_start()
415 replicas_entry_bytes(e)); in bch2_replicas_gc_start()
428 for_each_cpu_replicas_entry(&c->replicas, e) in bch2_replicas_gc_start()
429 if (e->data_type >= BCH_DATA_NR || in bch2_replicas_gc_start()
430 !((1 << e->data_type) & typemask)) in bch2_replicas_gc_start()
432 e, c->replicas_gc.entry_size); in bch2_replicas_gc_start()
476 struct bch_replicas_entry_v1 *e = in bch2_replicas_gc2() local
483 unsafe_memcpy(&k.replicas, e, replicas_entry_bytes(e), in bch2_replicas_gc2()
492 if (e->data_type == BCH_DATA_journal || !kill) in bch2_replicas_gc2()
494 e, new.entry_size); in bch2_replicas_gc2()
522 struct bch_replicas_entry_v1 *e, *dst; in __bch2_sb_replicas_to_cpu_replicas() local
525 for_each_replicas_entry(sb_r, e) { in __bch2_sb_replicas_to_cpu_replicas()
527 replicas_entry_bytes(e)); in __bch2_sb_replicas_to_cpu_replicas()
538 for_each_replicas_entry(sb_r, e) { in __bch2_sb_replicas_to_cpu_replicas()
540 memcpy(dst, e, replicas_entry_bytes(e)); in __bch2_sb_replicas_to_cpu_replicas()
551 struct bch_replicas_entry_v0 *e; in __bch2_sb_replicas_v0_to_cpu_replicas() local
554 for_each_replicas_entry(sb_r, e) { in __bch2_sb_replicas_v0_to_cpu_replicas()
556 replicas_entry_bytes(e)); in __bch2_sb_replicas_v0_to_cpu_replicas()
570 for_each_replicas_entry(sb_r, e) { in __bch2_sb_replicas_v0_to_cpu_replicas()
574 dst->data_type = e->data_type; in __bch2_sb_replicas_v0_to_cpu_replicas()
575 dst->nr_devs = e->nr_devs; in __bch2_sb_replicas_v0_to_cpu_replicas()
576 dst->nr_required = 1; in __bch2_sb_replicas_v0_to_cpu_replicas()
577 memcpy(dst->devs, e->devs, e->nr_devs); in __bch2_sb_replicas_v0_to_cpu_replicas()
620 bytes += replicas_entry_bytes(src) - 1; in bch2_cpu_replicas_to_sb_replicas_v0()
660 if (src->nr_required != 1) in bch2_cpu_replicas_to_sb_replicas()
704 struct bch_replicas_entry_v1 *e = in bch2_cpu_replicas_validate() local
707 int ret = bch2_replicas_entry_sb_validate(e, sb, err); in bch2_cpu_replicas_validate()
711 if (i + 1 < cpu_r->nr) { in bch2_cpu_replicas_validate()
713 cpu_replicas_entry(cpu_r, i + 1); in bch2_cpu_replicas_validate()
715 BUG_ON(memcmp(e, n, cpu_r->entry_size) > 0); in bch2_cpu_replicas_validate()
717 if (!memcmp(e, n, cpu_r->entry_size)) { in bch2_cpu_replicas_validate()
719 bch2_replicas_entry_to_text(err, e); in bch2_cpu_replicas_validate()
749 struct bch_replicas_entry_v1 *e; in bch2_sb_replicas_to_text() local
752 for_each_replicas_entry(r, e) { in bch2_sb_replicas_to_text()
757 bch2_replicas_entry_to_text(out, e); in bch2_sb_replicas_to_text()
788 struct bch_replicas_entry_v0 *e; in bch2_sb_replicas_v0_to_text() local
791 for_each_replicas_entry(sb_r, e) { in bch2_sb_replicas_v0_to_text()
796 bch2_replicas_entry_v0_to_text(out, e); in bch2_sb_replicas_v0_to_text()
811 struct bch_replicas_entry_v1 *e; in bch2_have_enough_devs() local
815 for_each_cpu_replicas_entry(&c->replicas, e) { in bch2_have_enough_devs()
817 bool metadata = e->data_type < BCH_DATA_user; in bch2_have_enough_devs()
819 if (e->data_type == BCH_DATA_cached) in bch2_have_enough_devs()
823 for (unsigned i = 0; i < e->nr_devs; i++) { in bch2_have_enough_devs()
824 if (e->devs[i] == BCH_SB_MEMBER_INVALID) { in bch2_have_enough_devs()
829 nr_online += test_bit(e->devs[i], devs.d); in bch2_have_enough_devs()
831 struct bch_dev *ca = bch2_dev_rcu_noerror(c, e->devs[i]); in bch2_have_enough_devs()
836 if (nr_online + nr_failed == e->nr_devs) in bch2_have_enough_devs()
839 if (nr_online < e->nr_required) in bch2_have_enough_devs()
844 if (nr_online < e->nr_devs) in bch2_have_enough_devs()
853 bch2_replicas_entry_to_text(&buf, e); in bch2_have_enough_devs()
886 data_has |= 1 << r->data_type; in bch2_sb_dev_has_data()
898 data_has |= 1 << r->data_type; in bch2_sb_dev_has_data()