mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-23 22:34:21 +08:00
bcachefs: Fix __btree_iter_next() when all iters are in use_next() when all iters are in use
Also, print out more information on btree transaction iterator overflow. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
d5b98fe2d7
commit
cc578a36f9
@ -2017,9 +2017,10 @@ static void btree_trans_iter_alloc_fail(struct btree_trans *trans)
|
||||
{
|
||||
|
||||
struct btree_iter *iter;
|
||||
struct btree_insert_entry *i;
|
||||
|
||||
trans_for_each_iter(trans, iter)
|
||||
pr_err("iter: btree %s pos %llu:%llu%s%s%s %ps",
|
||||
printk(KERN_ERR "iter: btree %s pos %llu:%llu%s%s%s %ps\n",
|
||||
bch2_btree_ids[iter->btree_id],
|
||||
iter->pos.inode,
|
||||
iter->pos.offset,
|
||||
@ -2027,6 +2028,14 @@ static void btree_trans_iter_alloc_fail(struct btree_trans *trans)
|
||||
(trans->iters_touched & (1ULL << iter->idx)) ? " touched" : "",
|
||||
iter->flags & BTREE_ITER_KEEP_UNTIL_COMMIT ? " keep" : "",
|
||||
(void *) iter->ip_allocated);
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
char buf[300];
|
||||
|
||||
bch2_bkey_val_to_text(&PBUF(buf), trans->c, bkey_i_to_s_c(i->k));
|
||||
printk(KERN_ERR "update: btree %s %s\n",
|
||||
bch2_btree_ids[i->iter->btree_id], buf);
|
||||
}
|
||||
panic("trans iter oveflow\n");
|
||||
}
|
||||
|
||||
|
@ -51,11 +51,17 @@ static inline int btree_iter_err(const struct btree_iter *iter)
|
||||
static inline struct btree_iter *
|
||||
__trans_next_iter(struct btree_trans *trans, unsigned idx)
|
||||
{
|
||||
u64 l = trans->iters_linked >> idx;
|
||||
u64 l;
|
||||
|
||||
if (idx == BTREE_ITER_MAX)
|
||||
return NULL;
|
||||
|
||||
l = trans->iters_linked >> idx;
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
idx += __ffs64(l);
|
||||
EBUG_ON(idx >= BTREE_ITER_MAX);
|
||||
EBUG_ON(trans->iters[idx].idx != idx);
|
||||
return &trans->iters[idx];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user