diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-09 22:48:54 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:50 +0300 |
commit | 60b5538877a2d34396280615484b995911e09b69 (patch) | |
tree | 5b77bae3dfe5a41c745e91da6474e694d3f964e1 /fs | |
parent | d94189ad568f6cbd80d372cf7aa6e4898b6c5c17 (diff) | |
download | linux-60b5538877a2d34396280615484b995911e09b69.tar.xz |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/btree_locking.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/btree_types.h | 1 | ||||
-rw-r--r-- | fs/bcachefs/io.c | 6 |
4 files changed, 11 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 7bb7b5ffe001..21f12e522360 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -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; diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index 56489e7b0ac2..cf138cd9d431 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -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; } diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 5660d076c678..a815cd5a072e 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -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; diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index bd55c4b41d7c..b57187ce1f65 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -2375,6 +2375,12 @@ get_bio: 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)) { |