summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/sb-members.c
diff options
context:
space:
mode:
authorHongbo Li <lihongbo22@huawei.com>2024-09-04 09:15:32 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2024-09-21 17:39:48 +0200
commitb161ca80968b55e551b82955e65264e8fc5f8660 (patch)
treee5a78fcd48833233365e69d357694f7e93237d9c /fs/bcachefs/sb-members.c
parentbcachefs: bch2_sb_member_alloc() (diff)
downloadlinux-b161ca80968b55e551b82955e65264e8fc5f8660.tar.xz
linux-b161ca80968b55e551b82955e65264e8fc5f8660.zip
bcachefs: Fix compilation error for bch2_sb_member_alloc
Fix the following compilation error: ``` fs/bcachefs/sb-members.c: In function ‘bch2_sb_member_alloc’: fs/bcachefs/sb-members.c:508:2: error: a label can only be part of a statement and a declaration is not a statement 508 | unsigned nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices); ``` Fixes: a7d364a133c7 ("bcachefs: bch2_sb_member_alloc()") Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/sb-members.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/bcachefs/sb-members.c b/fs/bcachefs/sb-members.c
index 2aad62961938..02bcde3c1b02 100644
--- a/fs/bcachefs/sb-members.c
+++ b/fs/bcachefs/sb-members.c
@@ -478,11 +478,15 @@ unsigned bch2_sb_nr_devices(const struct bch_sb *sb)
int bch2_sb_member_alloc(struct bch_fs *c)
{
unsigned dev_idx = c->sb.nr_devices;
+ struct bch_sb_field_members_v2 *mi;
+ unsigned nr_devices;
+ unsigned u64s;
+ int best = -1;
+ u64 best_last_mount = 0;
+
if (dev_idx < BCH_SB_MEMBERS_MAX)
goto have_slot;
- int best = -1;
- u64 best_last_mount = 0;
for (dev_idx = 0; dev_idx < BCH_SB_MEMBERS_MAX; dev_idx++) {
/* eventually BCH_SB_MEMBERS_MAX will be raised */
if (dev_idx == BCH_SB_MEMBER_INVALID)
@@ -505,11 +509,11 @@ int bch2_sb_member_alloc(struct bch_fs *c)
return -BCH_ERR_ENOSPC_sb_members;
have_slot:
- unsigned nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices);
+ nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices);
- struct bch_sb_field_members_v2 *mi = bch2_sb_field_get(c->disk_sb.sb, members_v2);
- unsigned u64s = DIV_ROUND_UP(sizeof(struct bch_sb_field_members_v2) +
- le16_to_cpu(mi->member_bytes) * nr_devices, sizeof(u64));
+ mi = bch2_sb_field_get(c->disk_sb.sb, members_v2);
+ u64s = DIV_ROUND_UP(sizeof(struct bch_sb_field_members_v2) +
+ le16_to_cpu(mi->member_bytes) * nr_devices, sizeof(u64));
mi = bch2_sb_field_resize(&c->disk_sb, members_v2, u64s);
if (!mi)