Message ID | 20180127142406.89741-7-colyli@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 01/27/2018 06:23 AM, Coly Li wrote: > Struct cache uses io_errors for two purposes, > - Error decay: when cache set error_decay is set, io_errors is used to > generate a small piece of delay when I/O error happens. > - I/O errors counter: in order to generate big enough value for error > decay, I/O errors counter value is stored by left shifting 20 bits (a.k.a > IO_ERROR_SHIFT). This LGTM Reviewed-by: Michael Lyle <mlyle@lyle.org>
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 88d938c8d027..7d7512fa4f09 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -663,6 +663,7 @@ struct cache_set { ON_ERROR_UNREGISTER, ON_ERROR_PANIC, } on_error; +#define DEFAULT_IO_ERROR_LIMIT 8 unsigned error_limit; unsigned error_decay; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 6d888e8fea8c..a373648b5d4b 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1583,7 +1583,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) c->congested_read_threshold_us = 2000; c->congested_write_threshold_us = 20000; - c->error_limit = 8 << IO_ERROR_SHIFT; + c->error_limit = DEFAULT_IO_ERROR_LIMIT; return c; err: diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index b7166c504cdb..ba62e987b503 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -560,7 +560,7 @@ SHOW(__bch_cache_set) /* See count_io_errors for why 88 */ sysfs_print(io_error_halflife, c->error_decay * 88); - sysfs_print(io_error_limit, c->error_limit >> IO_ERROR_SHIFT); + sysfs_print(io_error_limit, c->error_limit); sysfs_hprint(congested, ((uint64_t) bch_get_congested(c)) << 9); @@ -660,7 +660,7 @@ STORE(__bch_cache_set) } if (attr == &sysfs_io_error_limit) - c->error_limit = strtoul_or_return(buf) << IO_ERROR_SHIFT; + c->error_limit = strtoul_or_return(buf); /* See count_io_errors() for why 88 */ if (attr == &sysfs_io_error_halflife)