diff options
author | Hunter Shaffer <huntershaffer182456@gmail.com> | 2023-09-24 23:55:37 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:15 -0400 |
commit | 1241df5872b439ff1e5a8c70e0ce82345264904f (patch) | |
tree | 6830d32daf5e3481d399b52a1224a5093e914186 /fs/bcachefs/super-io.h | |
parent | 73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1 (diff) |
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.h')
-rw-r--r-- | fs/bcachefs/super-io.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/super-io.h b/fs/bcachefs/super-io.h index d51c0a19586f..817c3d790acd 100644 --- a/fs/bcachefs/super-io.h +++ b/fs/bcachefs/super-io.h @@ -6,6 +6,7 @@ #include "eytzinger.h" #include "super_types.h" #include "super.h" +#include "sb-members.h" #include <asm/byteorder.h> @@ -97,11 +98,13 @@ static inline bool bch2_member_exists(struct bch_member *m) } static inline bool bch2_dev_exists(struct bch_sb *sb, - struct bch_sb_field_members *mi, unsigned dev) { - return dev < sb->nr_devices && - bch2_member_exists(&mi->members[dev]); + if (dev < sb->nr_devices) { + struct bch_member m = bch2_sb_member_get(sb, dev); + return bch2_member_exists(&m); + } + return false; } static inline struct bch_member_cpu bch2_mi_to_cpu(struct bch_member *mi) |