lkml.org 
[lkml]   [2012]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] fat: add fat_msg_ratelimit.
From
Date
On Sun, 2012-05-13 at 07:03 -0400, Namjae Jeon wrote:
> I tried to add fat_msg_ratelimit to limit many message at once.
>
> Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
> Signed-off-by: Amit Sahrawat <amit.sahrawat83@gmail.com>
> ---
> fs/fat/fat.h | 9 +++++++--
> fs/fat/misc.c | 18 ++++++++++--------
> 2 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index 951d12b..3c581c7 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -333,8 +333,13 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
> __fat_fs_error(sb, 1, fmt , ## args)
> #define fat_fs_error_ratelimit(sb, fmt, args...) \
> __fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
> -__printf(3, 4) __cold
> -void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
> +__printf(4, 5) __cold
> +void __fat_msg(struct super_block *sb, int report, const char *level,
> + const char *fmt, ...);
> +#define fat_msg(sb, level, fmt, args...) \
> + __fat_msg(sb, 1, level, fmt, ## args)
> +#define fat_msg_ratelimit(sb, level, fmt, args...) \
> + __fat_msg(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), level, fmt, ## args)

I think it better to move the test above the call
and not change the fat_msg function at all.

#define fat_msg_ratelimit(sb, level, fmt, args...) \
do { \
if (! __ratelimit(&MSDOS_SB(sb)->ratelimit)) \
fsg_msg(sb, level, fmt, ##args); \
} while (0)




\
 
 \ /
  Last update: 2012-05-13 18:21    [W:0.069 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site