* [PATCH 1/2] fat: add fat_msg_ratelimit.
@ 2012-05-13 11:03 Namjae Jeon
2012-05-13 14:24 ` OGAWA Hirofumi
2012-05-13 15:45 ` Joe Perches
0 siblings, 2 replies; 7+ messages in thread
From: Namjae Jeon @ 2012-05-13 11:03 UTC (permalink / raw)
To: hirofumi; +Cc: linux-kernel, Namjae Jeon, Amit Sahrawat
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)
extern int fat_clusters_flush(struct super_block *sb);
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 6d93360..dcdb091 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -45,19 +45,21 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
EXPORT_SYMBOL_GPL(__fat_fs_error);
/**
- * fat_msg() - print preformated FAT specific messages. Every thing what is
+ * __fat_msg() - print preformated FAT specific messages. Every thing what is
* not fat_fs_error() should be fat_msg().
*/
-void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
+void __fat_msg(struct super_block *sb, int report, const char *level,
+ const char *fmt, ...)
{
struct va_format vaf;
va_list args;
-
- va_start(args, fmt);
- vaf.fmt = fmt;
- vaf.va = &args;
- printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
- va_end(args);
+ if (report) {
+ va_start(args, fmt);
+ vaf.fmt = fmt;
+ vaf.va = &args;
+ printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
+ va_end(args);
+ }
}
/* Flushes the number of free clusters on FAT32 */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] fat: add fat_msg_ratelimit.
2012-05-13 11:03 Namjae Jeon
@ 2012-05-13 14:24 ` OGAWA Hirofumi
2012-05-13 15:45 ` Joe Perches
1 sibling, 0 replies; 7+ messages in thread
From: OGAWA Hirofumi @ 2012-05-13 14:24 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-kernel, Amit Sahrawat, Andrew Morton
Namjae Jeon <linkinjeon@gmail.com> writes:
> 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>
Looks fine.
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thanks.
> ---
> 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)
> extern int fat_clusters_flush(struct super_block *sb);
> extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
> extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 6d93360..dcdb091 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -45,19 +45,21 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
> EXPORT_SYMBOL_GPL(__fat_fs_error);
>
> /**
> - * fat_msg() - print preformated FAT specific messages. Every thing what is
> + * __fat_msg() - print preformated FAT specific messages. Every thing what is
> * not fat_fs_error() should be fat_msg().
> */
> -void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
> +void __fat_msg(struct super_block *sb, int report, const char *level,
> + const char *fmt, ...)
> {
> struct va_format vaf;
> va_list args;
> -
> - va_start(args, fmt);
> - vaf.fmt = fmt;
> - vaf.va = &args;
> - printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
> - va_end(args);
> + if (report) {
> + va_start(args, fmt);
> + vaf.fmt = fmt;
> + vaf.va = &args;
> + printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
> + va_end(args);
> + }
> }
>
> /* Flushes the number of free clusters on FAT32 */
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] fat: add fat_msg_ratelimit.
2012-05-13 11:03 Namjae Jeon
2012-05-13 14:24 ` OGAWA Hirofumi
@ 2012-05-13 15:45 ` Joe Perches
2012-05-13 16:10 ` OGAWA Hirofumi
1 sibling, 1 reply; 7+ messages in thread
From: Joe Perches @ 2012-05-13 15:45 UTC (permalink / raw)
To: Namjae Jeon; +Cc: hirofumi, linux-kernel, Amit Sahrawat
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)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] fat: add fat_msg_ratelimit.
2012-05-13 15:45 ` Joe Perches
@ 2012-05-13 16:10 ` OGAWA Hirofumi
2012-05-13 18:11 ` Joe Perches
0 siblings, 1 reply; 7+ messages in thread
From: OGAWA Hirofumi @ 2012-05-13 16:10 UTC (permalink / raw)
To: Joe Perches; +Cc: Namjae Jeon, linux-kernel, Amit Sahrawat
Joe Perches <joe@perches.com> writes:
> 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)
Looks sane. I myself don't care either "fat_fs_error vs yours" style.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] fat: add fat_msg_ratelimit.
2012-05-13 16:10 ` OGAWA Hirofumi
@ 2012-05-13 18:11 ` Joe Perches
0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2012-05-13 18:11 UTC (permalink / raw)
To: OGAWA Hirofumi; +Cc: Namjae Jeon, linux-kernel, Amit Sahrawat
On Mon, 2012-05-14 at 01:10 +0900, OGAWA Hirofumi wrote:
> Joe Perches <joe@perches.com> writes:
> > 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.
[]
> > #define fat_msg_ratelimit(sb, level, fmt, args...) \
> > do { \
> > if (! __ratelimit(&MSDOS_SB(sb)->ratelimit)) \
This should be
if (__ratelimit(etc..))
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] fat: add fat_msg_ratelimit.
@ 2012-05-15 14:46 Namjae Jeon
2012-05-15 15:10 ` OGAWA Hirofumi
0 siblings, 1 reply; 7+ messages in thread
From: Namjae Jeon @ 2012-05-15 14:46 UTC (permalink / raw)
To: hirofumi; +Cc: linux-kernel, joe, Namjae Jeon, Amit Sahrawat
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>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
fs/fat/fat.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 951d12b..1708d9a 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -335,6 +335,11 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
__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, ...);
+#define fat_msg_ratelimit(sb, level, fmt, args...) \
+ do { \
+ if (__ratelimit(&MSDOS_SB(sb)->ratelimit)) \
+ fat_msg(sb, level, fmt, ## args); \
+ } while (0)
extern int fat_clusters_flush(struct super_block *sb);
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] fat: add fat_msg_ratelimit.
2012-05-15 14:46 [PATCH 1/2] fat: add fat_msg_ratelimit Namjae Jeon
@ 2012-05-15 15:10 ` OGAWA Hirofumi
0 siblings, 0 replies; 7+ messages in thread
From: OGAWA Hirofumi @ 2012-05-15 15:10 UTC (permalink / raw)
To: Andrew Morton; +Cc: Namjae Jeon, linux-kernel, joe, Amit Sahrawat
Namjae Jeon <linkinjeon@gmail.com> writes:
> 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>
> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thanks.
Please handle those patches, Andrew.
> fs/fat/fat.h | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index 951d12b..1708d9a 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -335,6 +335,11 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
> __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, ...);
> +#define fat_msg_ratelimit(sb, level, fmt, args...) \
> + do { \
> + if (__ratelimit(&MSDOS_SB(sb)->ratelimit)) \
> + fat_msg(sb, level, fmt, ## args); \
> + } while (0)
> extern int fat_clusters_flush(struct super_block *sb);
> extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
> extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-15 15:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 14:46 [PATCH 1/2] fat: add fat_msg_ratelimit Namjae Jeon
2012-05-15 15:10 ` OGAWA Hirofumi
-- strict thread matches above, loose matches on Subject: below --
2012-05-13 11:03 Namjae Jeon
2012-05-13 14:24 ` OGAWA Hirofumi
2012-05-13 15:45 ` Joe Perches
2012-05-13 16:10 ` OGAWA Hirofumi
2012-05-13 18:11 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox