[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1347420159.2456.15.camel@joe2Laptop>
Date: Tue, 11 Sep 2012 20:22:39 -0700
From: Joe Perches <joe@...ches.com>
To: raghu.prabhu13@...il.com
Cc: xfs@....sgi.com, david@...morbit.com,
Raghavendra D Prabhu <rprabhu@...hang.net>,
Ben Myers <bpm@....com>, Alex Elder <elder@...nel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] Add ratelimited printk for different alert levels
On Wed, 2012-09-12 at 03:43 +0530, raghu.prabhu13@...il.com 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists