mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V4 1/6] fs: befs: Move useless assignment
@ 2016-05-26  1:41 Salah Triki
  2016-05-26  1:41 ` [PATCH V4 2/6] fs: befs: Check silent flag before logging errors Salah Triki
  0 siblings, 1 reply; 6+ messages in thread
From: Salah Triki @ 2016-05-26  1:41 UTC (permalink / raw)
  To: akpm, joe; +Cc: Salah Triki, linux-kernel

Control is transfered to unacquire_none when sb->s_fs_info is equal to NULL,
so the assignment to NULL is useless and it is moved above unacquire_none.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 7da05b1..75ec9a7 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -870,9 +870,9 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
       unacquire_priv_sbp:
 	kfree(befs_sb->mount_opts.iocharset);
 	kfree(sb->s_fs_info);
+	sb->s_fs_info = NULL;
 
       unacquire_none:
-	sb->s_fs_info = NULL;
 	return ret;
 }
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V4 2/6] fs: befs: Check silent flag before logging errors
  2016-05-26  1:41 [PATCH V4 1/6] fs: befs: Move useless assignment Salah Triki
@ 2016-05-26  1:41 ` Salah Triki
  2016-05-26  1:41   ` [PATCH V4 3/6] fs: befs: Remove useless pr_err Salah Triki
  0 siblings, 1 reply; 6+ messages in thread
From: Salah Triki @ 2016-05-26  1:41 UTC (permalink / raw)
  To: akpm, joe; +Cc: Salah Triki, linux-kernel

Log errors only when silent flag is not set.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 75ec9a7..edee857 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -772,7 +772,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	befs_sb = BEFS_SB(sb);
 
 	if (!parse_options((char *) data, &befs_sb->mount_opts)) {
-		befs_error(sb, "cannot parse mount options");
+		if (!silent)
+			befs_error(sb, "cannot parse mount options");
 		goto unacquire_priv_sbp;
 	}
 
@@ -796,7 +797,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	sb_min_blocksize(sb, 1024);
 
 	if (!(bh = sb_bread(sb, sb_block))) {
-		befs_error(sb, "unable to read superblock");
+		if (!silent)
+			befs_error(sb, "unable to read superblock");
 		goto unacquire_priv_sbp;
 	}
 
@@ -820,9 +822,9 @@ 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);
 		goto unacquire_priv_sbp;
 	}
 
@@ -841,7 +843,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	}
 	sb->s_root = d_make_root(root);
 	if (!sb->s_root) {
-		befs_error(sb, "get root inode failed");
+		if (!silent)
+			befs_error(sb, "get root inode failed");
 		goto unacquire_priv_sbp;
 	}
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V4 3/6] fs: befs: Remove useless pr_err
  2016-05-26  1:41 ` [PATCH V4 2/6] fs: befs: Check silent flag before logging errors Salah Triki
@ 2016-05-26  1:41   ` Salah Triki
  2016-05-26  1:41     ` [PATCH V4 4/6] fs: befs: Remove useless befs_error Salah Triki
  0 siblings, 1 reply; 6+ messages in thread
From: Salah Triki @ 2016-05-26  1:41 UTC (permalink / raw)
  To: akpm, joe; +Cc: Salah Triki, linux-kernel

Remove pr_err since when kzalloc fails there is a generic out of memory
and stack dump.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index edee857..5b47b0f 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -764,11 +764,9 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	save_mount_options(sb, data);
 
 	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 (sb->s_fs_info == NULL)
 		goto unacquire_none;
-	}
+
 	befs_sb = BEFS_SB(sb);
 
 	if (!parse_options((char *) data, &befs_sb->mount_opts)) {
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V4 4/6] fs: befs: Remove useless befs_error
  2016-05-26  1:41   ` [PATCH V4 3/6] fs: befs: Remove useless pr_err Salah Triki
@ 2016-05-26  1:41     ` Salah Triki
  2016-05-26  1:41       ` [PATCH V4 5/6] fs: befs: Remove useless pr_err Salah Triki
  0 siblings, 1 reply; 6+ messages in thread
From: Salah Triki @ 2016-05-26  1:41 UTC (permalink / raw)
  To: akpm, joe; +Cc: Salah Triki, linux-kernel

Remove befs_error since when kmalloc fails there is a generic out of
memory and stack dump.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 5b47b0f..04541f3 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -524,7 +524,6 @@ befs_utf2nls(struct super_block *sb, const char *in,
 
 	*out = result = kmalloc(maxlen, GFP_NOFS);
 	if (!*out) {
-		befs_error(sb, "%s cannot allocate memory", __func__);
 		*out_len = 0;
 		return -ENOMEM;
 	}
@@ -604,7 +603,6 @@ befs_nls2utf(struct super_block *sb, const char *in,
 
 	*out = result = kmalloc(maxlen, GFP_NOFS);
 	if (!*out) {
-		befs_error(sb, "%s cannot allocate memory", __func__);
 		*out_len = 0;
 		return -ENOMEM;
 	}
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V4 5/6] fs: befs: Remove useless pr_err
  2016-05-26  1:41     ` [PATCH V4 4/6] fs: befs: Remove useless befs_error Salah Triki
@ 2016-05-26  1:41       ` Salah Triki
  2016-05-26  1:41         ` [PATCH V4 6/6] fs: befs: Coalesce format in log messages Salah Triki
  0 siblings, 1 reply; 6+ messages in thread
From: Salah Triki @ 2016-05-26  1:41 UTC (permalink / raw)
  To: akpm, joe; +Cc: Salah Triki, linux-kernel

Remove pr_err since kmem_cache_create log error and dump stack.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 04541f3..c734f21 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -436,10 +436,9 @@ befs_init_inodecache(void)
 					      0, (SLAB_RECLAIM_ACCOUNT|
 						SLAB_MEM_SPREAD|SLAB_ACCOUNT),
 					      init_once);
-	if (befs_inode_cachep == NULL) {
-		pr_err("%s: Couldn't initialize inode slabcache\n", __func__);
+	if (befs_inode_cachep == NULL)
 		return -ENOMEM;
-	}
+
 	return 0;
 }
 
@@ -524,7 +523,6 @@ befs_utf2nls(struct super_block *sb, const char *in,
 
 	*out = result = kmalloc(maxlen, GFP_NOFS);
 	if (!*out) {
-		*out_len = 0;
 		return -ENOMEM;
 	}
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V4 6/6] fs: befs: Coalesce format in log messages
  2016-05-26  1:41       ` [PATCH V4 5/6] fs: befs: Remove useless pr_err Salah Triki
@ 2016-05-26  1:41         ` Salah Triki
  0 siblings, 0 replies; 6+ messages in thread
From: Salah Triki @ 2016-05-26  1:41 UTC (permalink / raw)
  To: akpm, joe; +Cc: Salah Triki, linux-kernel

Coalese format is more readable, even if it goes over 80 column width,
so group format snippets together.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c734f21..74b377a 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -683,8 +683,7 @@ parse_options(char *options, struct befs_mount_options *opts)
 			if (option >= 0)
 				uid = make_kuid(current_user_ns(), option);
 			if (!uid_valid(uid)) {
-				pr_err("Invalid uid %d, "
-				       "using default\n", option);
+				pr_err("Invalid uid %d, using default\n", option);
 				break;
 			}
 			opts->uid = uid;
@@ -697,8 +696,7 @@ parse_options(char *options, struct befs_mount_options *opts)
 			if (option >= 0)
 				gid = make_kgid(current_user_ns(), option);
 			if (!gid_valid(gid)) {
-				pr_err("Invalid gid %d, "
-				       "using default\n", option);
+				pr_err("Invalid gid %d, using default\n", option);
 				break;
 			}
 			opts->gid = gid;
@@ -708,8 +706,7 @@ parse_options(char *options, struct befs_mount_options *opts)
 			kfree(opts->iocharset);
 			opts->iocharset = match_strdup(&args[0]);
 			if (!opts->iocharset) {
-				pr_err("allocation failure for "
-				       "iocharset string\n");
+				pr_err("allocation failure for iocharset string\n");
 				return 0;
 			}
 			break;
@@ -717,8 +714,7 @@ parse_options(char *options, struct befs_mount_options *opts)
 			opts->debug = 1;
 			break;
 		default:
-			pr_err("Unrecognized mount option \"%s\" "
-			       "or missing value\n", p);
+			pr_err("Unrecognized mount option \"%s\" or missing value\n", p);
 			return 0;
 		}
 	}
@@ -774,8 +770,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	befs_debug(sb, "---> %s", __func__);
 
 	if (!(sb->s_flags & MS_RDONLY)) {
-		befs_warning(sb,
-			     "No write support. Marking filesystem read-only");
+		befs_warning(sb, "No write support. Marking filesystem read-only");
 		sb->s_flags |= MS_RDONLY;
 	}
 
@@ -844,12 +839,10 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 
 	/* load nls library */
 	if (befs_sb->mount_opts.iocharset) {
-		befs_debug(sb, "Loading nls: %s",
-			   befs_sb->mount_opts.iocharset);
+		befs_debug(sb, "Loading nls: %s", befs_sb->mount_opts.iocharset);
 		befs_sb->nls = load_nls(befs_sb->mount_opts.iocharset);
 		if (!befs_sb->nls) {
-			befs_warning(sb, "Cannot load nls %s"
-					" loading default nls",
+			befs_warning(sb, "Cannot load nls %s loading default nls",
 					befs_sb->mount_opts.iocharset);
 			befs_sb->nls = load_nls_default();
 		}
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-26  1:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-26  1:41 [PATCH V4 1/6] fs: befs: Move useless assignment Salah Triki
2016-05-26  1:41 ` [PATCH V4 2/6] fs: befs: Check silent flag before logging errors Salah Triki
2016-05-26  1:41   ` [PATCH V4 3/6] fs: befs: Remove useless pr_err Salah Triki
2016-05-26  1:41     ` [PATCH V4 4/6] fs: befs: Remove useless befs_error Salah Triki
2016-05-26  1:41       ` [PATCH V4 5/6] fs: befs: Remove useless pr_err Salah Triki
2016-05-26  1:41         ` [PATCH V4 6/6] fs: befs: Coalesce format in log messages Salah Triki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®