Re: [PATCH 2/2] fs: befs: Check silent flag before logging errors

From: Joe Perches
Date: Wed May 25 2016 - 19:00:49 EST


On Wed, 2016-05-25 at 22:58 +0100, Salah Triki wrote:
> Log errors only when silent flag is not set.
[]
> diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
[]
> @@ -765,14 +765,16 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
>  
>   sb->s_fs_info = kzalloc(sizeof(*befs_sb), GFP_KERNEL);
>   if (sb->s_fs_info == NULL) {
> - pr_err("(%s): Unable to allocate memory for private "
> -        "portion of superblock. Bailing.\n", sb->s_id);
> + if (!silent)
> + pr_err("(%s): Unable to allocate memory for private "
> + "portion of superblock. Bailing.\n", sb->s_id);

Might as well remove this pr_err instead as
there's already a generic OOM and stack dump.

> @@ -820,9 +823,10 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
>   brelse(bh);
>  
>   if( befs_sb->num_blocks > ~((sector_t)0) ) {
> - befs_error(sb, "blocks count: %llu "
> - "is larger than the host can use",
> - befs_sb->num_blocks);
> + if (!silent)
> + befs_error(sb, "blocks count: %llu "
> + "is larger than the host can use",
> + befs_sb->num_blocks);

Coalesce format too?