Skip to content

Commit 99179fb

Browse files
author
Kent Overstreet
committed
bcachefs: Invalid devices are now checked for by fsck, not .invalid methods
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 2f4b4a3 commit 99179fb

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

fs/bcachefs/extents.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,22 +1101,8 @@ static int extent_ptr_invalid(struct bch_fs *c,
11011101
bool metadata,
11021102
struct printbuf *err)
11031103
{
1104-
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
11051104
int ret = 0;
11061105

1107-
if (!bch2_dev_exists(c, ptr->dev)) {
1108-
/*
1109-
* If we're in the write path this key might have already been
1110-
* overwritten, and we could be seeing a device that doesn't
1111-
* exist anymore due to racing with device removal:
1112-
*/
1113-
if (flags & BKEY_INVALID_WRITE)
1114-
return 0;
1115-
1116-
bkey_fsck_err(c, err, ptr_to_invalid_device,
1117-
"pointer to invalid device (%u)", ptr->dev);
1118-
}
1119-
11201106
rcu_read_lock();
11211107
struct bch_dev *ca = bch2_dev_rcu(c, ptr->dev);
11221108
if (!ca) {
@@ -1130,6 +1116,7 @@ static int extent_ptr_invalid(struct bch_fs *c,
11301116
unsigned bucket_size = ca->mi.bucket_size;
11311117
rcu_read_unlock();
11321118

1119+
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
11331120
bkey_for_each_ptr(ptrs, ptr2)
11341121
bkey_fsck_err_on(ptr != ptr2 && ptr->dev == ptr2->dev, c, err,
11351122
ptr_to_duplicate_device,

fs/bcachefs/journal_io.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,6 @@ static int journal_entry_dev_usage_validate(struct bch_fs *c,
690690
container_of(entry, struct jset_entry_dev_usage, entry);
691691
unsigned bytes = jset_u64s(le16_to_cpu(entry->u64s)) * sizeof(u64);
692692
unsigned expected = sizeof(*u);
693-
unsigned dev;
694693
int ret = 0;
695694

696695
if (journal_entry_err_on(bytes < expected,
@@ -702,16 +701,6 @@ static int journal_entry_dev_usage_validate(struct bch_fs *c,
702701
return ret;
703702
}
704703

705-
dev = le32_to_cpu(u->dev);
706-
707-
if (journal_entry_err_on(!bch2_dev_exists(c, dev),
708-
c, version, jset, entry,
709-
journal_entry_dev_usage_bad_dev,
710-
"bad dev")) {
711-
journal_entry_null_range(entry, vstruct_next(entry));
712-
return ret;
713-
}
714-
715704
if (journal_entry_err_on(u->pad,
716705
c, version, jset, entry,
717706
journal_entry_dev_usage_bad_pad,

0 commit comments

Comments
 (0)