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/journal_sb.c | |
parent | 73bbeaa2de1d429590a1b5ddd706dfeaf6d7d0e1 (diff) | |
download | linux-1241df5872b439ff1e5a8c70e0ce82345264904f.tar.gz linux-1241df5872b439ff1e5a8c70e0ce82345264904f.tar.bz2 linux-1241df5872b439ff1e5a8c70e0ce82345264904f.zip |
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/journal_sb.c')
-rw-r--r-- | fs/bcachefs/journal_sb.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/bcachefs/journal_sb.c b/fs/bcachefs/journal_sb.c index cc41bff86d6b..3c5a95e29463 100644 --- a/fs/bcachefs/journal_sb.c +++ b/fs/bcachefs/journal_sb.c @@ -21,7 +21,7 @@ static int bch2_sb_journal_validate(struct bch_sb *sb, struct printbuf *err) { struct bch_sb_field_journal *journal = field_to_type(f, journal); - struct bch_member *m = bch2_sb_get_members(sb)->members + sb->dev_idx; + struct bch_member m = bch2_sb_member_get(sb, sb->dev_idx); int ret = -BCH_ERR_invalid_sb_journal; unsigned nr; unsigned i; @@ -45,15 +45,15 @@ static int bch2_sb_journal_validate(struct bch_sb *sb, goto err; } - if (b[0] < le16_to_cpu(m->first_bucket)) { + if (b[0] < le16_to_cpu(m.first_bucket)) { prt_printf(err, "journal bucket %llu before first bucket %u", - b[0], le16_to_cpu(m->first_bucket)); + b[0], le16_to_cpu(m.first_bucket)); goto err; } - if (b[nr - 1] >= le64_to_cpu(m->nbuckets)) { + if (b[nr - 1] >= le64_to_cpu(m.nbuckets)) { prt_printf(err, "journal bucket %llu past end of device (nbuckets %llu)", - b[nr - 1], le64_to_cpu(m->nbuckets)); + b[nr - 1], le64_to_cpu(m.nbuckets)); goto err; } @@ -104,7 +104,7 @@ static int bch2_sb_journal_v2_validate(struct bch_sb *sb, struct printbuf *err) { struct bch_sb_field_journal_v2 *journal = field_to_type(f, journal_v2); - struct bch_member *m = bch2_sb_get_members(sb)->members + sb->dev_idx; + struct bch_member m = bch2_sb_member_get(sb, sb->dev_idx); int ret = -BCH_ERR_invalid_sb_journal; unsigned nr; unsigned i; @@ -130,15 +130,15 @@ static int bch2_sb_journal_v2_validate(struct bch_sb *sb, goto err; } - if (b[0].start < le16_to_cpu(m->first_bucket)) { + if (b[0].start < le16_to_cpu(m.first_bucket)) { prt_printf(err, "journal bucket %llu before first bucket %u", - b[0].start, le16_to_cpu(m->first_bucket)); + b[0].start, le16_to_cpu(m.first_bucket)); goto err; } - if (b[nr - 1].end > le64_to_cpu(m->nbuckets)) { + if (b[nr - 1].end > le64_to_cpu(m.nbuckets)) { prt_printf(err, "journal bucket %llu past end of device (nbuckets %llu)", - b[nr - 1].end - 1, le64_to_cpu(m->nbuckets)); + b[nr - 1].end - 1, le64_to_cpu(m.nbuckets)); goto err; } |