summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-28 01:37:24 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-02 02:11:08 +0100
commitdc7a15fb90bf658be8289c9540c11f50993d10ff (patch)
treed85005f052edb5e595e7f40aa1dad5f9858e1f0c
parentbcachefs: Fix an integer overflow (diff)
downloadlinux-dc7a15fb90bf658be8289c9540c11f50993d10ff.tar.xz
linux-dc7a15fb90bf658be8289c9540c11f50993d10ff.zip
bcachefs: Skip deleted members in member_to_text()
This fixes show-super output - we shouldn't be printing members that have been deleted. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/sb-members.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/bcachefs/sb-members.c b/fs/bcachefs/sb-members.c
index 032fe45481d3..ab5de12eca4a 100644
--- a/fs/bcachefs/sb-members.c
+++ b/fs/bcachefs/sb-members.c
@@ -168,6 +168,9 @@ static void member_to_text(struct printbuf *out,
u64 bucket_size = le16_to_cpu(m.bucket_size);
u64 device_size = le64_to_cpu(m.nbuckets) * bucket_size;
+ if (!bch2_member_exists(&m))
+ return;
+
prt_printf(out, "Device:");
prt_tab(out);
prt_printf(out, "%u", i);
@@ -304,10 +307,8 @@ static void bch2_sb_members_v1_to_text(struct printbuf *out, struct bch_sb *sb,
struct bch_sb_field_disk_groups *gi = bch2_sb_field_get(sb, disk_groups);
unsigned i;
- for (i = 0; i < sb->nr_devices; i++) {
- struct bch_member m = members_v1_get(mi, i);
- member_to_text(out, m, gi, sb, i);
- }
+ for (i = 0; i < sb->nr_devices; i++)
+ member_to_text(out, members_v1_get(mi, i), gi, sb, i);
}
const struct bch_sb_field_ops bch_sb_field_ops_members_v1 = {
@@ -322,10 +323,8 @@ static void bch2_sb_members_v2_to_text(struct printbuf *out, struct bch_sb *sb,
struct bch_sb_field_disk_groups *gi = bch2_sb_field_get(sb, disk_groups);
unsigned i;
- for (i = 0; i < sb->nr_devices; i++) {
- struct bch_member m = members_v2_get(mi, i);
- member_to_text(out, m, gi, sb, i);
- }
+ for (i = 0; i < sb->nr_devices; i++)
+ member_to_text(out, members_v2_get(mi, i), gi, sb, i);
}
static int bch2_sb_members_v2_validate(struct bch_sb *sb,