diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-11 19:31:03 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:52 -0400 |
commit | c1f59ef6d00940f22fa5e88d1d7705c85ec6d118 (patch) | |
tree | 2cd5a2a164175a8e08d344e2d0a323bddeafbe14 /fs | |
parent | 930c0c4cefede8532765cc4f74ec3ff05dc1db15 (diff) | |
download | lwn-c1f59ef6d00940f22fa5e88d1d7705c85ec6d118.tar.gz lwn-c1f59ef6d00940f22fa5e88d1d7705c85ec6d118.zip |
bcachefs: More info on check_bucket_ref() error
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/buckets.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 9dcdfca19d52..abbd28bf9a45 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -663,13 +663,14 @@ err: return ret; } -static int check_bucket_ref(struct bch_fs *c, +static int check_bucket_ref(struct btree_trans *trans, struct bkey_s_c k, const struct bch_extent_ptr *ptr, s64 sectors, enum bch_data_type ptr_data_type, u8 b_gen, u8 bucket_data_type, u32 dirty_sectors, u32 cached_sectors) { + struct bch_fs *c = trans->c; struct bch_dev *ca = bch_dev_bkey_exists(c, ptr->dev); size_t bucket_nr = PTR_BUCKET_NR(ca, ptr); u16 bucket_sectors = !ptr->cached @@ -726,7 +727,7 @@ static int check_bucket_ref(struct bch_fs *c, if (b_gen != ptr->gen) { ret = 1; - goto err; + goto out; } if (!data_type_is_empty(bucket_data_type) && @@ -756,9 +757,12 @@ static int check_bucket_ref(struct bch_fs *c, ret = -EIO; goto err; } -err: +out: printbuf_exit(&buf); return ret; +err: + bch2_dump_trans_updates(trans); + goto out; } static int mark_stripe_bucket(struct btree_trans *trans, @@ -800,7 +804,7 @@ static int mark_stripe_bucket(struct btree_trans *trans, bucket_lock(g); old = *g; - ret = check_bucket_ref(c, k, ptr, sectors, data_type, + ret = check_bucket_ref(trans, k, ptr, sectors, data_type, g->gen, g->data_type, g->dirty_sectors, g->cached_sectors); if (ret) @@ -832,7 +836,7 @@ static int __mark_pointer(struct btree_trans *trans, u32 *dst_sectors = !ptr->cached ? dirty_sectors : cached_sectors; - int ret = check_bucket_ref(trans->c, k, ptr, sectors, ptr_data_type, + int ret = check_bucket_ref(trans, k, ptr, sectors, ptr_data_type, bucket_gen, *bucket_data_type, *dirty_sectors, *cached_sectors); @@ -1557,7 +1561,7 @@ static int bch2_trans_mark_stripe_bucket(struct btree_trans *trans, if (IS_ERR(a)) return PTR_ERR(a); - ret = check_bucket_ref(c, s.s_c, ptr, sectors, data_type, + ret = check_bucket_ref(trans, s.s_c, ptr, sectors, data_type, a->v.gen, a->v.data_type, a->v.dirty_sectors, a->v.cached_sectors); if (ret) |