diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-06-30 17:10:51 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-06-30 18:30:55 -0400 |
commit | d32b1958b7d3e3dbb636cb837261bdbffe99c2e6 (patch) | |
tree | d93d942af5f9a6e5a68cdb722d1fc9a345f1f654 | |
parent | 67d67ff15b357d376fc0775d0add3573d42e80a9 (diff) |
bcachefs: check_key_has_inode() reconstructs more aggressively
For regular files: reconstruct if more than three extents are found
found
For directories: reconstruct if a single dirent is found.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/fsck.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index 1a4080ac66f7..00afe0a3593f 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -1500,6 +1500,10 @@ static int check_key_has_inode(struct btree_trans *trans, SPOS(k.k->p.inode, 0, k.k->p.snapshot), POS(k.k->p.inode, U64_MAX), 0, k2, ret) { + if (k.k->type == KEY_TYPE_error || + k.k->type == KEY_TYPE_hash_whiteout) + continue; + nr_keys++; if (nr_keys <= 10) { bch2_bkey_val_to_text(&buf, c, k2); @@ -1512,9 +1516,11 @@ static int check_key_has_inode(struct btree_trans *trans, if (ret) goto err; + unsigned reconstruct_limit = iter->btree_id == BTREE_ID_extents ? 3 : 0; + if (nr_keys > 100) prt_printf(&buf, "found > %u keys for this missing inode\n", nr_keys); - else if (nr_keys > 10) + else if (nr_keys > reconstruct_limit) prt_printf(&buf, "found %u keys for this missing inode\n", nr_keys); if (!have_inode) { |