| To: | raghu.prabhu13@xxxxxxxxx |
|---|---|
| Subject: | Re: [PATCH 1/3] Add ratelimited printk for different alert levels |
| From: | Joe Perches <joe@xxxxxxxxxxx> |
| Date: | Tue, 11 Sep 2012 20:22:39 -0700 |
| Cc: | xfs@xxxxxxxxxxx, david@xxxxxxxxxxxxx, Raghavendra D Prabhu <rprabhu@xxxxxxxxxxx>, Ben Myers <bpm@xxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, open list <linux-kernel@xxxxxxxxxxxxxxx> |
| In-reply-to: | <ef779779fdfb84c7c1216b374216246d4de83233.1347396641.git.rprabhu@xxxxxxxxxxx> |
| References: | <cover.1347396641.git.rprabhu@xxxxxxxxxxx> <ef779779fdfb84c7c1216b374216246d4de83233.1347396641.git.rprabhu@xxxxxxxxxxx> |
On Wed, 2012-09-12 at 03:43 +0530, raghu.prabhu13@xxxxxxxxx wrote:
> Ratelimited printk will be useful in printing xfs messages which are otherwise
> not required to be printed always due to their high rate (to prevent kernel
> ring
> buffer from overflowing), while at the same time required to be printed.
[]
> diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
[]
> @@ -30,6 +32,32 @@ void xfs_debug(const struct xfs_mount *mp, const char
> *fmt, ...)
> }
> #endif
>
> +#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...) \
> +do { \
> + static DEFINE_RATELIMIT_STATE(_rs, \
> + DEFAULT_RATELIMIT_INTERVAL, \
> + DEFAULT_RATELIMIT_BURST); \
> + if (__ratelimit(&_rs)) \
> + xfs_printk(dev, fmt, ##__VA_ARGS__); \
> +} while (0)
It might be better to use an xfs singleton RATELIMIT_STATE
DEFINE_RATELIMIT_STATE(xfs_rs);
...
#define xfs_printk_ratelimited(xfs_printk, dev, fmt, ...) \
do { \
if (__ratelimit(&xfs_rs)) \
xfs_printk(dev, fmt, ##__VA_ARGS__); \
} while (0)
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH 3/3] XFS: Print error when unable to allocate inodes or out of free inodes., Dave Chinner |
|---|---|
| Next by Date: | Evento de Hacking y Seguridad Informatica, Claudia Rodriguez |
| Previous by Thread: | Re: [PATCH 1/3] Add ratelimited printk for different alert levels, Dave Chinner |
| Next by Thread: | Re: [PATCH 1/3] Add ratelimited printk for different alert levels, Dave Chinner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |