Skip to content

Commit b161ca8

Browse files
Hongbo LiKent Overstreet
authored andcommitted
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: a7d364a ("bcachefs: bch2_sb_member_alloc()") Signed-off-by: Hongbo Li <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 1740527 commit b161ca8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

fs/bcachefs/sb-members.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,15 @@ unsigned bch2_sb_nr_devices(const struct bch_sb *sb)
478478
int bch2_sb_member_alloc(struct bch_fs *c)
479479
{
480480
unsigned dev_idx = c->sb.nr_devices;
481+
struct bch_sb_field_members_v2 *mi;
482+
unsigned nr_devices;
483+
unsigned u64s;
484+
int best = -1;
485+
u64 best_last_mount = 0;
486+
481487
if (dev_idx < BCH_SB_MEMBERS_MAX)
482488
goto have_slot;
483489

484-
int best = -1;
485-
u64 best_last_mount = 0;
486490
for (dev_idx = 0; dev_idx < BCH_SB_MEMBERS_MAX; dev_idx++) {
487491
/* eventually BCH_SB_MEMBERS_MAX will be raised */
488492
if (dev_idx == BCH_SB_MEMBER_INVALID)
@@ -505,11 +509,11 @@ int bch2_sb_member_alloc(struct bch_fs *c)
505509

506510
return -BCH_ERR_ENOSPC_sb_members;
507511
have_slot:
508-
unsigned nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices);
512+
nr_devices = max_t(unsigned, dev_idx + 1, c->sb.nr_devices);
509513

510-
struct bch_sb_field_members_v2 *mi = bch2_sb_field_get(c->disk_sb.sb, members_v2);
511-
unsigned u64s = DIV_ROUND_UP(sizeof(struct bch_sb_field_members_v2) +
512-
le16_to_cpu(mi->member_bytes) * nr_devices, sizeof(u64));
514+
mi = bch2_sb_field_get(c->disk_sb.sb, members_v2);
515+
u64s = DIV_ROUND_UP(sizeof(struct bch_sb_field_members_v2) +
516+
le16_to_cpu(mi->member_bytes) * nr_devices, sizeof(u64));
513517

514518
mi = bch2_sb_field_resize(&c->disk_sb, members_v2, u64s);
515519
if (!mi)

0 commit comments

Comments
 (0)