Re: [PATCH] scsi: core: Rate limit "rejecting I/O" messages

From: James Bottomley
Date: Wed Apr 08 2020 - 13:36:14 EST


On Wed, 2020-04-08 at 19:10 +0200, Daniel Wagner wrote:
> +#define sdev_printk_ratelimited(l, sdev, fmt, a...)
> \
> +({
> \
> + static DEFINE_RATELIMIT_STATE(_rs,
> \
> + DEFAULT_RATELIMIT_INTERVAL,
> \
> + DEFAULT_RATELIMIT_BURST);
> \
> +
> \
> + if (__ratelimit(&_rs))
> \
> + sdev_prefix_printk(l, sdev, NULL, fmt, ##a);

If we do go with a ratelimit architecture for sdev_printk, I would
think the limit has to be per sdev, because we wouldn't want a burst of
messages on one sdev to suppress messages on another.

For this particular issue, I suppose one target can have many sdevs, so
you'd prefer to rate limit by target?

James