summaryrefslogtreecommitdiff
path: root/libbcache/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcache/error.c')
-rw-r--r--libbcache/error.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/libbcache/error.c b/libbcache/error.c
index 814c0eb7..ba46d2d1 100644
--- a/libbcache/error.c
+++ b/libbcache/error.c
@@ -4,7 +4,7 @@
#include "notify.h"
#include "super.h"
-void bch_inconsistent_error(struct cache_set *c)
+void bch_inconsistent_error(struct bch_fs *c)
{
set_bit(BCH_FS_ERROR, &c->flags);
@@ -27,7 +27,7 @@ void bch_inconsistent_error(struct cache_set *c)
}
}
-void bch_fatal_error(struct cache_set *c)
+void bch_fatal_error(struct bch_fs *c)
{
if (bch_fs_emergency_read_only(c))
bch_err(c, "emergency read only");
@@ -36,20 +36,20 @@ void bch_fatal_error(struct cache_set *c)
/* Nonfatal IO errors, IO error/latency accounting: */
/* Just does IO error accounting: */
-void bch_account_io_completion(struct cache *ca)
+void bch_account_io_completion(struct bch_dev *ca)
{
/*
* The halflife of an error is:
* log2(1/2)/log2(127/128) * refresh ~= 88 * refresh
*/
- if (ca->set->error_decay) {
+ if (ca->fs->error_decay) {
unsigned count = atomic_inc_return(&ca->io_count);
- while (count > ca->set->error_decay) {
+ while (count > ca->fs->error_decay) {
unsigned errors;
unsigned old = count;
- unsigned new = count - ca->set->error_decay;
+ unsigned new = count - ca->fs->error_decay;
/*
* First we subtract refresh from count; each time we
@@ -74,16 +74,16 @@ void bch_account_io_completion(struct cache *ca)
}
/* IO error accounting and latency accounting: */
-void bch_account_io_completion_time(struct cache *ca,
+void bch_account_io_completion_time(struct bch_dev *ca,
unsigned submit_time_us, int op)
{
- struct cache_set *c;
+ struct bch_fs *c;
unsigned threshold;
if (!ca)
return;
- c = ca->set;
+ c = ca->fs;
threshold = op_is_write(op)
? c->congested_write_threshold_us
: c->congested_read_threshold_us;
@@ -109,10 +109,9 @@ void bch_account_io_completion_time(struct cache *ca,
void bch_nonfatal_io_error_work(struct work_struct *work)
{
- struct cache *ca = container_of(work, struct cache, io_error_work);
- struct cache_set *c = ca->set;
+ struct bch_dev *ca = container_of(work, struct bch_dev, io_error_work);
+ struct bch_fs *c = ca->fs;
unsigned errors = atomic_read(&ca->io_errors);
- char buf[BDEVNAME_SIZE];
bool dev;
if (errors < c->error_limit) {
@@ -127,15 +126,14 @@ void bch_nonfatal_io_error_work(struct work_struct *work)
? __bch_dev_set_state(c, ca, BCH_MEMBER_STATE_RO,
BCH_FORCE_IF_DEGRADED)
: bch_fs_emergency_read_only(c))
- bch_err(c,
- "too many IO errors on %s, setting %s RO",
- bdevname(ca->disk_sb.bdev, buf),
+ bch_err(ca,
+ "too many IO errors, setting %s RO",
dev ? "device" : "filesystem");
mutex_unlock(&c->state_lock);
}
}
-void bch_nonfatal_io_error(struct cache *ca)
+void bch_nonfatal_io_error(struct bch_dev *ca)
{
atomic_add(1 << IO_ERROR_SHIFT, &ca->io_errors);
queue_work(system_long_wq, &ca->io_error_work);