diff options
author | Hunter Shaffer <huntershaffer182456@gmail.com> | 2023-09-25 06:55:37 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:15 +0300 |
commit | 1241df5872b439ff1e5a8c70e0ce82345264904f (patch) | |
tree | 6830d32daf5e3481d399b52a1224a5093e914186 /fs/bcachefs/super-io.c | |
parent | 73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1 (diff) | |
download | linux-1241df5872b439ff1e5a8c70e0ce82345264904f.tar.xz |
bcachefs: Add new helper to retrieve bch_member from sb
Prep work for introducing bch_sb_field_members_v2 - introduce new
helpers that will check for members_v2 if it exists, otherwise using v1
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r-- | fs/bcachefs/super-io.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index c9bf342d14aa..16e3a8aa290d 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -485,7 +485,6 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out, static void bch2_sb_update(struct bch_fs *c) { struct bch_sb *src = c->disk_sb.sb; - struct bch_sb_field_members *mi = bch2_sb_get_members(src); struct bch_dev *ca; unsigned i; @@ -511,8 +510,10 @@ static void bch2_sb_update(struct bch_fs *c) c->sb.features = le64_to_cpu(src->features[0]); c->sb.compat = le64_to_cpu(src->compat[0]); - for_each_member_device(ca, c, i) - ca->mi = bch2_mi_to_cpu(mi->members + i); + for_each_member_device(ca, c, i) { + struct bch_member m = bch2_sb_member_get(src, i); + ca->mi = bch2_mi_to_cpu(&m); + } } static int __copy_super(struct bch_sb_handle *dst_handle, struct bch_sb *src) @@ -1125,7 +1126,6 @@ void bch2_sb_layout_to_text(struct printbuf *out, struct bch_sb_layout *l) void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb, bool print_layout, unsigned fields) { - struct bch_sb_field_members *mi; struct bch_sb_field *f; u64 fields_have = 0; unsigned nr_devices = 0; @@ -1133,15 +1133,8 @@ void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb, if (!out->nr_tabstops) printbuf_tabstop_push(out, 44); - mi = bch2_sb_get_members(sb); - if (mi) { - struct bch_member *m; - - for (m = mi->members; - m < mi->members + sb->nr_devices; - m++) - nr_devices += bch2_member_exists(m); - } + for (int i = 0; i < sb->nr_devices; i++) + nr_devices += bch2_dev_exists(sb, i); prt_printf(out, "External UUID:"); prt_tab(out); |