bcachefs: trans->notrace_relock_fail

When we unlock in order to submit IO, the next relock event is likely to
fail if submit_bio() blocked - we shouldn't those events in our _fail
stats, since those are expected events and shouldn't cause test
failures.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-02-09 14:48:54 -05:00
parent d94189ad56
commit 60b5538877
4 changed files with 11 additions and 2 deletions

View file

@ -2854,8 +2854,10 @@ u32 bch2_trans_begin(struct btree_trans *trans)
bch2_trans_reset_srcu_lock(trans);
trans->last_restarted_ip = _RET_IP_;
if (trans->restarted)
if (trans->restarted) {
bch2_btree_path_traverse_all(trans);
trans->notrace_relock_fail = false;
}
trans->last_begin_time = local_clock();
return trans->restart_count;

View file

@ -473,7 +473,7 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
return true;
}
fail:
if (trace)
if (trace && !trans->notrace_relock_fail)
trace_and_count(trans->c, btree_path_relock_fail, trans, _RET_IP_, path, level);
return false;
}

View file

@ -425,6 +425,7 @@ struct btree_trans {
bool memory_allocation_failure:1;
bool journal_transaction_names:1;
bool journal_replay_not_finished:1;
bool notrace_relock_fail:1;
enum bch_errcode restarted:16;
u32 restart_count;
unsigned long last_restarted_ip;

View file

@ -2375,6 +2375,12 @@ int __bch2_read_extent(struct btree_trans *trans, struct bch_read_bio *orig,
else
submit_bio_wait(&rbio->bio);
}
/*
* We just submitted IO which may block, we expect relock fail
* events and shouldn't count them:
*/
trans->notrace_relock_fail = true;
} else {
/* Attempting reconstruct read: */
if (bch2_ec_read_extent(c, rbio)) {