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

bcachefs: Add missing call to bch2_replicas_entry_sort()

This fixes a bug introduced by "bcachefs: Improve diagnostics when
journal entries are missing" - devices in a replicas entry are supposed
to be sorted.

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

authored by

Kent Overstreet and committed by
Kent Overstreet
26452d1d a28bd48a

+9 -6
+2
fs/bcachefs/journal_io.c
··· 937 937 for (ptr = 0; ptr < i->nr_ptrs; ptr++) 938 938 replicas.e.devs[replicas.e.nr_devs++] = i->ptrs[ptr].dev; 939 939 940 + bch2_replicas_entry_sort(&replicas.e); 941 + 940 942 /* 941 943 * If we're mounting in degraded mode - if we didn't read all 942 944 * the devices - this is wrong:
+6 -6
fs/bcachefs/replicas.c
··· 26 26 #endif 27 27 } 28 28 29 - static void replicas_entry_sort(struct bch_replicas_entry *e) 29 + void bch2_replicas_entry_sort(struct bch_replicas_entry *e) 30 30 { 31 31 bubble_sort(e->devs, e->nr_devs, u8_cmp); 32 32 } ··· 122 122 break; 123 123 } 124 124 125 - replicas_entry_sort(e); 125 + bch2_replicas_entry_sort(e); 126 126 } 127 127 128 128 void bch2_devlist_to_replicas(struct bch_replicas_entry *e, ··· 142 142 for (i = 0; i < devs.nr; i++) 143 143 e->devs[e->nr_devs++] = devs.devs[i]; 144 144 145 - replicas_entry_sort(e); 145 + bch2_replicas_entry_sort(e); 146 146 } 147 147 148 148 static struct bch_replicas_cpu ··· 197 197 int bch2_replicas_entry_idx(struct bch_fs *c, 198 198 struct bch_replicas_entry *search) 199 199 { 200 - replicas_entry_sort(search); 200 + bch2_replicas_entry_sort(search); 201 201 202 202 return __replicas_entry_idx(&c->replicas, search); 203 203 } ··· 690 690 for_each_replicas_entry(sb_r, e) { 691 691 dst = cpu_replicas_entry(cpu_r, idx++); 692 692 memcpy(dst, e, replicas_entry_bytes(e)); 693 - replicas_entry_sort(dst); 693 + bch2_replicas_entry_sort(dst); 694 694 } 695 695 696 696 return 0; ··· 727 727 dst->nr_devs = e->nr_devs; 728 728 dst->nr_required = 1; 729 729 memcpy(dst->devs, e->devs, e->nr_devs); 730 - replicas_entry_sort(dst); 730 + bch2_replicas_entry_sort(dst); 731 731 } 732 732 733 733 return 0;
+1
fs/bcachefs/replicas.h
··· 5 5 #include "eytzinger.h" 6 6 #include "replicas_types.h" 7 7 8 + void bch2_replicas_entry_sort(struct bch_replicas_entry *); 8 9 void bch2_replicas_entry_to_text(struct printbuf *, 9 10 struct bch_replicas_entry *); 10 11 void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *);