linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix incorrect error-message of ext2
@ 2011-04-23 13:36 Robin Dong
  2011-04-23 14:10 ` Eric Sandeen
  2011-04-23 14:23 ` Coly Li
  0 siblings, 2 replies; 4+ messages in thread
From: Robin Dong @ 2011-04-23 13:36 UTC (permalink / raw)
  To: linux-ext4; +Cc: Robin Dong

From: Robin Dong <sanbai@taobao.com>

After "mkfs.ext2 -b 8192" on a new partition, I mount it with a error dmesg:
"error: blocksize is too small"
That's not correct.

Signed-off-by: Robin Dong <sanbai@taobao.com>
---
 fs/ext2/super.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 0a78dae..f3008c1 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -758,6 +758,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	unsigned long def_mount_opts;
 	long ret = -EINVAL;
 	int blocksize = BLOCK_SIZE;
+	int hblock;
 	int db_count;
 	int i, j;
 	__le32 features;
@@ -893,12 +894,25 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 		goto failed_mount;
 	}
 
+	hblock = bdev_logical_block_size(sb->s_bdev);
 	/* If the blocksize doesn't match, re-read the thing.. */
 	if (sb->s_blocksize != blocksize) {
+		/*
+		 * Make sure the blocksize for the filesystem is larger
+		 * than the hardware sectorsize for the machine.
+		 */
+		if (blocksize < hblock) {
+			ext2_msg(sb, KERN_ERR,
+				"error: fsblocksize %d too small for "
+				"hardware sectorsize %d", blocksize, hblock);
+			goto failed_mount;
+		}
+
 		brelse(bh);
 
 		if (!sb_set_blocksize(sb, blocksize)) {
-			ext2_msg(sb, KERN_ERR, "error: blocksize is too small");
+			ext2_msg(sb, KERN_ERR,
+				"error: bad blocksize %d", blocksize);
 			goto failed_sbi;
 		}
 
-- 
1.7.3.2


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

end of thread, other threads:[~2011-04-23 14:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-23 13:36 [PATCH] fix incorrect error-message of ext2 Robin Dong
2011-04-23 14:10 ` Eric Sandeen
2011-04-23 14:23 ` Coly Li
2011-04-23 14:12   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).