mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 19:51:27 +00:00
scst_vdisk: Rate-limit block I/O error messages
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6810 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -365,6 +365,28 @@ static inline __attribute__ ((format (printf, 1, 2)))
|
||||
int no_printk(const char *s, ...) { return 0; }
|
||||
#endif
|
||||
|
||||
/* <linux/ratelimit.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
|
||||
/* See also commit 717115e1a585 */
|
||||
|
||||
#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
|
||||
#define DEFAULT_RATELIMIT_BURST 10
|
||||
|
||||
struct ratelimit_state {
|
||||
int interval;
|
||||
int burst;
|
||||
};
|
||||
|
||||
#define DEFINE_RATELIMIT_STATE(name, interval, burst) \
|
||||
struct ratelimit_state name = {interval, burst,}
|
||||
|
||||
static inline int __ratelimit(struct ratelimit_state *rs)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/rcupdate.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && !defined(kfree_rcu)
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
#include <linux/bug.h> /* for WARN_ON_ONCE */
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27)
|
||||
#include <linux/ratelimit.h>
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
|
||||
/*
|
||||
* See also the following commits:
|
||||
@@ -284,6 +288,16 @@ do { \
|
||||
|
||||
#endif /* CONFIG_SCST_DEBUG || CONFIG_SCST_TRACING */
|
||||
|
||||
#define PRINT_ERROR_RATELIMITED(format, args...) \
|
||||
do { \
|
||||
static DEFINE_RATELIMIT_STATE(_rs, \
|
||||
DEFAULT_RATELIMIT_INTERVAL, \
|
||||
DEFAULT_RATELIMIT_BURST); \
|
||||
\
|
||||
if (__ratelimit(&_rs)) \
|
||||
PRINT_ERROR(format, ##args); \
|
||||
} while (0)
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG
|
||||
|
||||
#define TRACE_DBG_FLAG(trace, format, args...) \
|
||||
|
||||
@@ -6486,7 +6486,8 @@ static void blockio_endio(struct bio *bio)
|
||||
if (unlikely(error != 0)) {
|
||||
unsigned long flags;
|
||||
|
||||
PRINT_ERROR("BLOCKIO for cmd %p finished with error %d",
|
||||
PRINT_ERROR_RATELIMITED(
|
||||
"BLOCKIO for cmd %p finished with error %d",
|
||||
blockio_work->cmd, error);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user