diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-11-14 00:19:24 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:47 +0300 |
commit | ed0d631fa50112c51f302442e3d11a1c5f4d2bb4 (patch) | |
tree | 4d8d9b772f2f54741a90ba094e9b7e7348ca5545 /fs | |
parent | 61501161817b1dee17231af6a255af836c9b6853 (diff) | |
download | linux-ed0d631fa50112c51f302442e3d11a1c5f4d2bb4.tar.xz |
bcachefs: Improve journal error messages
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/journal_io.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index e976aa83d527..a251f76fdd39 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -172,7 +172,9 @@ static int journal_validate_key(struct bch_fs *c, struct jset *jset, int ret = 0; if (journal_entry_err_on(!k->k.u64s, c, - "invalid %s in journal: k->u64s 0", type)) { + "invalid %s in journal entry %llu offset %zi: k->u64s 0", + type, le64_to_cpu(jset->seq), + (u64 *) entry - jset->_data)) { entry->u64s = cpu_to_le16((u64 *) k - entry->_data); journal_entry_null_range(vstruct_next(entry), next); return 0; @@ -180,16 +182,19 @@ static int journal_validate_key(struct bch_fs *c, struct jset *jset, if (journal_entry_err_on((void *) bkey_next(k) > (void *) vstruct_next(entry), c, - "invalid %s in journal: extends past end of journal entry", - type)) { + "invalid %s in journal entry %llu offset %zi: extends past end of journal entry", + type, le64_to_cpu(jset->seq), + (u64 *) entry - jset->_data)) { entry->u64s = cpu_to_le16((u64 *) k - entry->_data); journal_entry_null_range(vstruct_next(entry), next); return 0; } if (journal_entry_err_on(k->k.format != KEY_FORMAT_CURRENT, c, - "invalid %s in journal: bad format %u", - type, k->k.format)) { + "invalid %s in journal entry %llu offset %zi: bad format %u", + type, le64_to_cpu(jset->seq), + (u64 *) entry - jset->_data, + k->k.format)) { le16_add_cpu(&entry->u64s, -k->k.u64s); memmove(k, bkey_next(k), next - (void *) bkey_next(k)); journal_entry_null_range(vstruct_next(entry), next); @@ -207,8 +212,10 @@ static int journal_validate_key(struct bch_fs *c, struct jset *jset, char buf[160]; bch2_bkey_val_to_text(&PBUF(buf), c, bkey_i_to_s_c(k)); - mustfix_fsck_err(c, "invalid %s in journal: %s\n%s", - type, invalid, buf); + mustfix_fsck_err(c, "invalid %s in journal entry %llu offset %zi: %s\n%s", + type, le64_to_cpu(jset->seq), + (u64 *) entry - jset->_data, + invalid, buf); le16_add_cpu(&entry->u64s, -k->k.u64s); memmove(k, bkey_next(k), next - (void *) bkey_next(k)); |