Commit 38f0664a authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix error message on bucket sector count overflow

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent f1f5f114
...@@ -1444,8 +1444,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, ...@@ -1444,8 +1444,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;
u16 *dst_sectors; u16 *dst_sectors, orig_sectors;
bool overflow;
int ret; int ret;
ret = trans_get_key(trans, BTREE_ID_ALLOC, ret = trans_get_key(trans, BTREE_ID_ALLOC,
...@@ -1502,13 +1501,12 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, ...@@ -1502,13 +1501,12 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
dst_sectors = !p.ptr.cached dst_sectors = !p.ptr.cached
? &u.dirty_sectors ? &u.dirty_sectors
: &u.cached_sectors; : &u.cached_sectors;
orig_sectors = *dst_sectors;
overflow = checked_add(*dst_sectors, sectors); if (checked_add(*dst_sectors, sectors)) {
if (overflow) {
bch2_fs_inconsistent(c, bch2_fs_inconsistent(c,
"bucket sector count overflow: %u + %lli > U16_MAX", "bucket sector count overflow: %u + %lli > U16_MAX",
*dst_sectors, sectors); orig_sectors, sectors);
/* return an error indicating that we need full fsck */ /* return an error indicating that we need full fsck */
ret = -EIO; ret = -EIO;
goto out; goto out;
......
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