Commit 9940a791 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix error message on bucket overflow

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 06f6c3ec
...@@ -1415,6 +1415,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, ...@@ -1415,6 +1415,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
struct bkey_s_c k; struct bkey_s_c k;
struct bkey_alloc_unpacked u; struct bkey_alloc_unpacked u;
struct bkey_i_alloc *a; struct bkey_i_alloc *a;
unsigned old;
bool overflow; bool overflow;
int ret; int ret;
...@@ -1443,9 +1444,9 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, ...@@ -1443,9 +1444,9 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
* Unless we're already updating that key: * Unless we're already updating that key:
*/ */
if (k.k->type != KEY_TYPE_alloc) { if (k.k->type != KEY_TYPE_alloc) {
bch_err_ratelimited(c, "pointer to nonexistent bucket %u:%zu", bch_err_ratelimited(c, "pointer to nonexistent bucket %llu:%llu",
p.ptr.dev, iter->pos.inode,
PTR_BUCKET_NR(ca, &p.ptr)); iter->pos.offset);
ret = -1; ret = -1;
goto out; goto out;
} }
...@@ -1458,19 +1459,20 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, ...@@ -1458,19 +1459,20 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
goto out; goto out;
} }
if (!p.ptr.cached) if (!p.ptr.cached) {
old = u.dirty_sectors;
overflow = checked_add(u.dirty_sectors, sectors); overflow = checked_add(u.dirty_sectors, sectors);
else } else {
old = u.cached_sectors;
overflow = checked_add(u.cached_sectors, sectors); overflow = checked_add(u.cached_sectors, sectors);
}
u.data_type = u.dirty_sectors || u.cached_sectors u.data_type = u.dirty_sectors || u.cached_sectors
? data_type : 0; ? data_type : 0;
bch2_fs_inconsistent_on(overflow, c, bch2_fs_inconsistent_on(overflow, c,
"bucket sector count overflow: %u + %lli > U16_MAX", "bucket sector count overflow: %u + %lli > U16_MAX",
!p.ptr.cached old, sectors);
? u.dirty_sectors
: u.cached_sectors, sectors);
a = trans_update_key(trans, iter, BKEY_ALLOC_U64s_MAX); a = trans_update_key(trans, iter, BKEY_ALLOC_U64s_MAX);
ret = PTR_ERR_OR_ZERO(a); ret = PTR_ERR_OR_ZERO(a);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment