45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
|
From a81618382c36ca52f5076cb51897699f3e196ae3 Mon Sep 17 00:00:00 2001
|
||
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
||
|
Date: Tue, 10 Dec 2024 14:04:39 -0500
|
||
|
Subject: [PATCH 205/213] bcachefs: better backpointer_target_not_found() error
|
||
|
message
|
||
|
Content-Type: text/plain; charset="utf-8"
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
|
||
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||
|
---
|
||
|
fs/bcachefs/backpointers.c | 13 ++++++++++++-
|
||
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
|
||
|
index 5cc4aaa3a325..b93ddfa00fdd 100644
|
||
|
--- a/fs/bcachefs/backpointers.c
|
||
|
+++ b/fs/bcachefs/backpointers.c
|
||
|
@@ -210,10 +210,21 @@ static int backpointer_target_not_found(struct btree_trans *trans,
|
||
|
prt_printf(&buf, "backpointer doesn't match %s it points to:\n ",
|
||
|
bp.v->level ? "btree node" : "extent");
|
||
|
bch2_bkey_val_to_text(&buf, c, bp.s_c);
|
||
|
- prt_printf(&buf, "\n ");
|
||
|
|
||
|
+ prt_printf(&buf, "\n ");
|
||
|
bch2_bkey_val_to_text(&buf, c, target_k);
|
||
|
|
||
|
+ struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(target_k);
|
||
|
+ const union bch_extent_entry *entry;
|
||
|
+ struct extent_ptr_decoded p;
|
||
|
+ bkey_for_each_ptr_decode(target_k.k, ptrs, p, entry)
|
||
|
+ if (p.ptr.dev == bp.k->p.inode) {
|
||
|
+ prt_printf(&buf, "\n ");
|
||
|
+ struct bkey_i_backpointer bp2;
|
||
|
+ bch2_extent_ptr_to_bp(c, bp.v->btree_id, bp.v->level, target_k, p, entry, &bp2);
|
||
|
+ bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(&bp2.k_i));
|
||
|
+ }
|
||
|
+
|
||
|
if (fsck_err(trans, backpointer_to_missing_ptr,
|
||
|
"%s", buf.buf))
|
||
|
ret = bch2_backpointer_del(trans, bp.k->p);
|
||
|
--
|
||
|
2.45.2
|
||
|
|