Skip to content

Commit 53f6619

Browse files
author
Kent Overstreet
committed
bcachefs: BCH_SB_MEMBER_INVALID
Create a sentinal value for "invalid device". This is needed for removing devices that have stripes on them (force removing, without evacuating); we need a sentinal value for the stripe pointers to the device being removed. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 7f12a96 commit 53f6619

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

fs/bcachefs/replicas.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ int bch2_replicas_entry_validate(struct bch_replicas_entry_v1 *r,
8282
}
8383

8484
for (unsigned i = 0; i < r->nr_devs; i++)
85-
if (!bch2_member_exists(sb, r->devs[i])) {
85+
if (r->devs[i] != BCH_SB_MEMBER_INVALID &&
86+
!bch2_member_exists(sb, r->devs[i])) {
8687
prt_printf(err, "invalid device %u in entry ", r->devs[i]);
8788
goto bad;
8889
}

fs/bcachefs/sb-members.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
void bch2_dev_missing(struct bch_fs *c, unsigned dev)
1313
{
14-
bch2_fs_inconsistent(c, "pointer to nonexistent device %u", dev);
14+
if (dev != BCH_SB_MEMBER_INVALID)
15+
bch2_fs_inconsistent(c, "pointer to nonexistent device %u", dev);
1516
}
1617

1718
void bch2_dev_bucket_missing(struct bch_fs *c, struct bpos bucket)

fs/bcachefs/sb-members_format.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
*/
99
#define BCH_SB_MEMBERS_MAX 64
1010

11+
/*
12+
* Sentinal value - indicates a device that does not exist
13+
*/
14+
#define BCH_SB_MEMBER_INVALID 255
15+
1116
#define BCH_MIN_NR_NBUCKETS (1 << 6)
1217

1318
#define BCH_IOPS_MEASUREMENTS() \

0 commit comments

Comments
 (0)