Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: Rename bch_replicas_entry -> bch_replicas_entry_v1

Prep work for introducing bch_replicas_entry_v2

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+56 -56
+3 -3
fs/bcachefs/bcachefs_format.h
··· 1449 1449 struct bch_replicas_entry_v0 entries[]; 1450 1450 } __packed __aligned(8); 1451 1451 1452 - struct bch_replicas_entry { 1452 + struct bch_replicas_entry_v1 { 1453 1453 __u8 data_type; 1454 1454 __u8 nr_devs; 1455 1455 __u8 nr_required; ··· 1461 1461 1462 1462 struct bch_sb_field_replicas { 1463 1463 struct bch_sb_field field; 1464 - struct bch_replicas_entry entries[]; 1464 + struct bch_replicas_entry_v1 entries[]; 1465 1465 } __packed __aligned(8); 1466 1466 1467 1467 /* BCH_SB_FIELD_quota: */ ··· 2210 2210 struct jset_entry_data_usage { 2211 2211 struct jset_entry entry; 2212 2212 __le64 v; 2213 - struct bch_replicas_entry r; 2213 + struct bch_replicas_entry_v1 r; 2214 2214 } __packed; 2215 2215 2216 2216 struct jset_entry_clock {
+1 -1
fs/bcachefs/bcachefs_ioctl.h
··· 237 237 238 238 struct bch_replicas_usage { 239 239 __u64 sectors; 240 - struct bch_replicas_entry r; 240 + struct bch_replicas_entry_v1 r; 241 241 } __packed; 242 242 243 243 static inline struct bch_replicas_usage *
+1 -1
fs/bcachefs/btree_gc.c
··· 1284 1284 } 1285 1285 1286 1286 for (i = 0; i < c->replicas.nr; i++) { 1287 - struct bch_replicas_entry *e = 1287 + struct bch_replicas_entry_v1 *e = 1288 1288 cpu_replicas_entry(&c->replicas, i); 1289 1289 1290 1290 if (metadata_only &&
+5 -5
fs/bcachefs/buckets.c
··· 61 61 usage->reserved += usage->persistent_reserved[i]; 62 62 63 63 for (i = 0; i < c->replicas.nr; i++) { 64 - struct bch_replicas_entry *e = 64 + struct bch_replicas_entry_v1 *e = 65 65 cpu_replicas_entry(&c->replicas, i); 66 66 67 67 fs_usage_data_type_to_base(usage, e->data_type, usage->replicas[i]); ··· 214 214 } 215 215 216 216 for (i = 0; i < c->replicas.nr; i++) { 217 - struct bch_replicas_entry *e = 217 + struct bch_replicas_entry_v1 *e = 218 218 cpu_replicas_entry(&c->replicas, i); 219 219 220 220 prt_printf(out, "\t"); ··· 345 345 346 346 static inline int __update_replicas(struct bch_fs *c, 347 347 struct bch_fs_usage *fs_usage, 348 - struct bch_replicas_entry *r, 348 + struct bch_replicas_entry_v1 *r, 349 349 s64 sectors) 350 350 { 351 351 int idx = bch2_replicas_entry_idx(c, r); ··· 359 359 } 360 360 361 361 static inline int update_replicas(struct bch_fs *c, struct bkey_s_c k, 362 - struct bch_replicas_entry *r, s64 sectors, 362 + struct bch_replicas_entry_v1 *r, s64 sectors, 363 363 unsigned journal_seq, bool gc) 364 364 { 365 365 struct bch_fs_usage *fs_usage; ··· 454 454 } 455 455 456 456 static inline int update_replicas_list(struct btree_trans *trans, 457 - struct bch_replicas_entry *r, 457 + struct bch_replicas_entry_v1 *r, 458 458 s64 sectors) 459 459 { 460 460 struct replicas_delta_list *d;
+1 -1
fs/bcachefs/chardev.c
··· 444 444 dst_end = (void *) arg->replicas + replica_entries_bytes; 445 445 446 446 for (i = 0; i < c->replicas.nr; i++) { 447 - struct bch_replicas_entry *src_e = 447 + struct bch_replicas_entry_v1 *src_e = 448 448 cpu_replicas_entry(&c->replicas, i); 449 449 450 450 /* check that we have enough space for one replicas entry */
+1 -1
fs/bcachefs/ec_types.h
··· 5 5 #include "bcachefs_format.h" 6 6 7 7 struct bch_replicas_padded { 8 - struct bch_replicas_entry e; 8 + struct bch_replicas_entry_v1 e; 9 9 u8 pad[BCH_BKEY_PTRS_MAX]; 10 10 }; 11 11
+30 -30
fs/bcachefs/replicas.c
··· 11 11 12 12 /* Replicas tracking - in memory: */ 13 13 14 - static void verify_replicas_entry(struct bch_replicas_entry *e) 14 + static void verify_replicas_entry(struct bch_replicas_entry_v1 *e) 15 15 { 16 16 #ifdef CONFIG_BCACHEFS_DEBUG 17 17 unsigned i; ··· 26 26 #endif 27 27 } 28 28 29 - void bch2_replicas_entry_sort(struct bch_replicas_entry *e) 29 + void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *e) 30 30 { 31 31 bubble_sort(e->devs, e->nr_devs, u8_cmp); 32 32 } ··· 53 53 } 54 54 55 55 void bch2_replicas_entry_to_text(struct printbuf *out, 56 - struct bch_replicas_entry *e) 56 + struct bch_replicas_entry_v1 *e) 57 57 { 58 58 unsigned i; 59 59 ··· 68 68 prt_printf(out, "]"); 69 69 } 70 70 71 - int bch2_replicas_entry_validate(struct bch_replicas_entry *r, 71 + int bch2_replicas_entry_validate(struct bch_replicas_entry_v1 *r, 72 72 struct bch_sb *sb, 73 73 struct printbuf *err) 74 74 { ··· 98 98 void bch2_cpu_replicas_to_text(struct printbuf *out, 99 99 struct bch_replicas_cpu *r) 100 100 { 101 - struct bch_replicas_entry *e; 101 + struct bch_replicas_entry_v1 *e; 102 102 bool first = true; 103 103 104 104 for_each_cpu_replicas_entry(r, e) { ··· 111 111 } 112 112 113 113 static void extent_to_replicas(struct bkey_s_c k, 114 - struct bch_replicas_entry *r) 114 + struct bch_replicas_entry_v1 *r) 115 115 { 116 116 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); 117 117 const union bch_extent_entry *entry; ··· 131 131 } 132 132 133 133 static void stripe_to_replicas(struct bkey_s_c k, 134 - struct bch_replicas_entry *r) 134 + struct bch_replicas_entry_v1 *r) 135 135 { 136 136 struct bkey_s_c_stripe s = bkey_s_c_to_stripe(k); 137 137 const struct bch_extent_ptr *ptr; ··· 144 144 r->devs[r->nr_devs++] = ptr->dev; 145 145 } 146 146 147 - void bch2_bkey_to_replicas(struct bch_replicas_entry *e, 147 + void bch2_bkey_to_replicas(struct bch_replicas_entry_v1 *e, 148 148 struct bkey_s_c k) 149 149 { 150 150 e->nr_devs = 0; ··· 169 169 bch2_replicas_entry_sort(e); 170 170 } 171 171 172 - void bch2_devlist_to_replicas(struct bch_replicas_entry *e, 172 + void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *e, 173 173 enum bch_data_type data_type, 174 174 struct bch_devs_list devs) 175 175 { ··· 192 192 static struct bch_replicas_cpu 193 193 cpu_replicas_add_entry(struct bch_fs *c, 194 194 struct bch_replicas_cpu *old, 195 - struct bch_replicas_entry *new_entry) 195 + struct bch_replicas_entry_v1 *new_entry) 196 196 { 197 197 unsigned i; 198 198 struct bch_replicas_cpu new = { ··· 225 225 } 226 226 227 227 static inline int __replicas_entry_idx(struct bch_replicas_cpu *r, 228 - struct bch_replicas_entry *search) 228 + struct bch_replicas_entry_v1 *search) 229 229 { 230 230 int idx, entry_size = replicas_entry_bytes(search); 231 231 ··· 243 243 } 244 244 245 245 int bch2_replicas_entry_idx(struct bch_fs *c, 246 - struct bch_replicas_entry *search) 246 + struct bch_replicas_entry_v1 *search) 247 247 { 248 248 bch2_replicas_entry_sort(search); 249 249 ··· 251 251 } 252 252 253 253 static bool __replicas_has_entry(struct bch_replicas_cpu *r, 254 - struct bch_replicas_entry *search) 254 + struct bch_replicas_entry_v1 *search) 255 255 { 256 256 return __replicas_entry_idx(r, search) >= 0; 257 257 } 258 258 259 259 bool bch2_replicas_marked(struct bch_fs *c, 260 - struct bch_replicas_entry *search) 260 + struct bch_replicas_entry_v1 *search) 261 261 { 262 262 bool marked; 263 263 ··· 374 374 static unsigned reserve_journal_replicas(struct bch_fs *c, 375 375 struct bch_replicas_cpu *r) 376 376 { 377 - struct bch_replicas_entry *e; 377 + struct bch_replicas_entry_v1 *e; 378 378 unsigned journal_res_u64s = 0; 379 379 380 380 /* nr_inodes: */ ··· 399 399 400 400 noinline 401 401 static int bch2_mark_replicas_slowpath(struct bch_fs *c, 402 - struct bch_replicas_entry *new_entry) 402 + struct bch_replicas_entry_v1 *new_entry) 403 403 { 404 404 struct bch_replicas_cpu new_r, new_gc; 405 405 int ret = 0; ··· 464 464 goto out; 465 465 } 466 466 467 - int bch2_mark_replicas(struct bch_fs *c, struct bch_replicas_entry *r) 467 + int bch2_mark_replicas(struct bch_fs *c, struct bch_replicas_entry_v1 *r) 468 468 { 469 469 return likely(bch2_replicas_marked(c, r)) 470 470 ? 0 : bch2_mark_replicas_slowpath(c, r); ··· 515 515 516 516 int bch2_replicas_gc_start(struct bch_fs *c, unsigned typemask) 517 517 { 518 - struct bch_replicas_entry *e; 518 + struct bch_replicas_entry_v1 *e; 519 519 unsigned i = 0; 520 520 521 521 lockdep_assert_held(&c->replicas_gc_lock); ··· 590 590 } 591 591 592 592 for (i = 0; i < c->replicas.nr; i++) { 593 - struct bch_replicas_entry *e = 593 + struct bch_replicas_entry_v1 *e = 594 594 cpu_replicas_entry(&c->replicas, i); 595 595 596 596 if (e->data_type == BCH_DATA_journal || ··· 621 621 } 622 622 623 623 int bch2_replicas_set_usage(struct bch_fs *c, 624 - struct bch_replicas_entry *r, 624 + struct bch_replicas_entry_v1 *r, 625 625 u64 sectors) 626 626 { 627 627 int ret, idx = bch2_replicas_entry_idx(c, r); ··· 654 654 __bch2_sb_replicas_to_cpu_replicas(struct bch_sb_field_replicas *sb_r, 655 655 struct bch_replicas_cpu *cpu_r) 656 656 { 657 - struct bch_replicas_entry *e, *dst; 657 + struct bch_replicas_entry_v1 *e, *dst; 658 658 unsigned nr = 0, entry_size = 0, idx = 0; 659 659 660 660 for_each_replicas_entry(sb_r, e) { ··· 692 692 nr++; 693 693 } 694 694 695 - entry_size += sizeof(struct bch_replicas_entry) - 695 + entry_size += sizeof(struct bch_replicas_entry_v1) - 696 696 sizeof(struct bch_replicas_entry_v0); 697 697 698 698 cpu_r->entries = kcalloc(nr, entry_size, GFP_KERNEL); ··· 703 703 cpu_r->entry_size = entry_size; 704 704 705 705 for_each_replicas_entry(sb_r, e) { 706 - struct bch_replicas_entry *dst = 706 + struct bch_replicas_entry_v1 *dst = 707 707 cpu_replicas_entry(cpu_r, idx++); 708 708 709 709 dst->data_type = e->data_type; ··· 747 747 { 748 748 struct bch_sb_field_replicas_v0 *sb_r; 749 749 struct bch_replicas_entry_v0 *dst; 750 - struct bch_replicas_entry *src; 750 + struct bch_replicas_entry_v1 *src; 751 751 size_t bytes; 752 752 753 753 bytes = sizeof(struct bch_sb_field_replicas); ··· 785 785 struct bch_replicas_cpu *r) 786 786 { 787 787 struct bch_sb_field_replicas *sb_r; 788 - struct bch_replicas_entry *dst, *src; 788 + struct bch_replicas_entry_v1 *dst, *src; 789 789 bool need_v1 = false; 790 790 size_t bytes; 791 791 ··· 836 836 memcmp, NULL); 837 837 838 838 for (i = 0; i < cpu_r->nr; i++) { 839 - struct bch_replicas_entry *e = 839 + struct bch_replicas_entry_v1 *e = 840 840 cpu_replicas_entry(cpu_r, i); 841 841 842 842 int ret = bch2_replicas_entry_validate(e, sb, err); ··· 844 844 return ret; 845 845 846 846 if (i + 1 < cpu_r->nr) { 847 - struct bch_replicas_entry *n = 847 + struct bch_replicas_entry_v1 *n = 848 848 cpu_replicas_entry(cpu_r, i + 1); 849 849 850 850 BUG_ON(memcmp(e, n, cpu_r->entry_size) > 0); ··· 881 881 struct bch_sb_field *f) 882 882 { 883 883 struct bch_sb_field_replicas *r = field_to_type(f, replicas); 884 - struct bch_replicas_entry *e; 884 + struct bch_replicas_entry_v1 *e; 885 885 bool first = true; 886 886 887 887 for_each_replicas_entry(r, e) { ··· 943 943 bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs, 944 944 unsigned flags, bool print) 945 945 { 946 - struct bch_replicas_entry *e; 946 + struct bch_replicas_entry_v1 *e; 947 947 bool ret = true; 948 948 949 949 percpu_down_read(&c->mark_lock); ··· 1003 1003 replicas_v0 = bch2_sb_field_get(sb, replicas_v0); 1004 1004 1005 1005 if (replicas) { 1006 - struct bch_replicas_entry *r; 1006 + struct bch_replicas_entry_v1 *r; 1007 1007 1008 1008 for_each_replicas_entry(replicas, r) 1009 1009 for (i = 0; i < r->nr_devs; i++)
+11 -11
fs/bcachefs/replicas.h
··· 6 6 #include "eytzinger.h" 7 7 #include "replicas_types.h" 8 8 9 - void bch2_replicas_entry_sort(struct bch_replicas_entry *); 9 + void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *); 10 10 void bch2_replicas_entry_to_text(struct printbuf *, 11 - struct bch_replicas_entry *); 12 - int bch2_replicas_entry_validate(struct bch_replicas_entry *, 11 + struct bch_replicas_entry_v1 *); 12 + int bch2_replicas_entry_validate(struct bch_replicas_entry_v1 *, 13 13 struct bch_sb *, struct printbuf *); 14 14 void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *); 15 15 16 - static inline struct bch_replicas_entry * 16 + static inline struct bch_replicas_entry_v1 * 17 17 cpu_replicas_entry(struct bch_replicas_cpu *r, unsigned i) 18 18 { 19 19 return (void *) r->entries + r->entry_size * i; 20 20 } 21 21 22 22 int bch2_replicas_entry_idx(struct bch_fs *, 23 - struct bch_replicas_entry *); 23 + struct bch_replicas_entry_v1 *); 24 24 25 - void bch2_devlist_to_replicas(struct bch_replicas_entry *, 25 + void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *, 26 26 enum bch_data_type, 27 27 struct bch_devs_list); 28 - bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry *); 28 + bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry_v1 *); 29 29 int bch2_mark_replicas(struct bch_fs *, 30 - struct bch_replicas_entry *); 30 + struct bch_replicas_entry_v1 *); 31 31 32 32 static inline struct replicas_delta * 33 33 replicas_delta_next(struct replicas_delta *d) ··· 37 37 38 38 int bch2_replicas_delta_list_mark(struct bch_fs *, struct replicas_delta_list *); 39 39 40 - void bch2_bkey_to_replicas(struct bch_replicas_entry *, struct bkey_s_c); 40 + void bch2_bkey_to_replicas(struct bch_replicas_entry_v1 *, struct bkey_s_c); 41 41 42 - static inline void bch2_replicas_entry_cached(struct bch_replicas_entry *e, 42 + static inline void bch2_replicas_entry_cached(struct bch_replicas_entry_v1 *e, 43 43 unsigned dev) 44 44 { 45 45 e->data_type = BCH_DATA_cached; ··· 59 59 int bch2_replicas_gc2(struct bch_fs *); 60 60 61 61 int bch2_replicas_set_usage(struct bch_fs *, 62 - struct bch_replicas_entry *, 62 + struct bch_replicas_entry_v1 *, 63 63 u64); 64 64 65 65 #define for_each_cpu_replicas_entry(_r, _i) \
+2 -2
fs/bcachefs/replicas_types.h
··· 5 5 struct bch_replicas_cpu { 6 6 unsigned nr; 7 7 unsigned entry_size; 8 - struct bch_replicas_entry *entries; 8 + struct bch_replicas_entry_v1 *entries; 9 9 }; 10 10 11 11 struct replicas_delta { 12 12 s64 delta; 13 - struct bch_replicas_entry r; 13 + struct bch_replicas_entry_v1 r; 14 14 } __packed; 15 15 16 16 struct replicas_delta_list {
+1 -1
fs/bcachefs/sb-clean.c
··· 235 235 } 236 236 237 237 for (i = 0; i < c->replicas.nr; i++) { 238 - struct bch_replicas_entry *e = 238 + struct bch_replicas_entry_v1 *e = 239 239 cpu_replicas_entry(&c->replicas, i); 240 240 struct jset_entry_data_usage *u = 241 241 container_of(jset_entry_init(end, sizeof(*u) + e->nr_devs),