diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-02-28 14:07:22 -0500 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-14 21:02:16 -0400 |
| commit | 3526bca36b31731eb468cddaa3ad0f6ebc5d7520 (patch) | |
| tree | 6af763aef30a92b8afac2b65406df6cada98879d /fs/bcachefs/error.h | |
| parent | 3480aecd5f4d65fffd775929d1de7349fa6b95c1 (diff) | |
bcachefs: bch2_account_io_completion()
We need to start accounting successes for every IO, not just failures,
so introduce a unified hook for io completion accounting and convert
io_read.c.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/error.h')
| -rw-r--r-- | fs/bcachefs/error.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/bcachefs/error.h b/fs/bcachefs/error.h index b3cc69f29fd9..e055b606fb6f 100644 --- a/fs/bcachefs/error.h +++ b/fs/bcachefs/error.h @@ -216,6 +216,26 @@ void bch2_io_error_work(struct work_struct *); /* Does the error handling without logging a message */ void bch2_io_error(struct bch_dev *, enum bch_member_error_type); +#ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT +void bch2_latency_acct(struct bch_dev *, u64, int); +#else +static inline void bch2_latency_acct(struct bch_dev *ca, u64 submit_time, int rw) {} +#endif + +static inline void bch2_account_io_completion(struct bch_dev *ca, + enum bch_member_error_type type, + u64 submit_time, bool success) +{ + if (unlikely(!ca)) + return; + + if (type != BCH_MEMBER_ERROR_checksum) + bch2_latency_acct(ca, submit_time, type); + + if (!success) + bch2_io_error(ca, type); +} + #define bch2_dev_io_err_on(cond, ca, _type, ...) \ ({ \ bool _ret = (cond); \ |
