From patchwork Sat Apr 23 13:36:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dong X-Patchwork-Id: 92617 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6640BB6FDC for ; Sat, 23 Apr 2011 23:37:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754035Ab1DWNhQ (ORCPT ); Sat, 23 Apr 2011 09:37:16 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:40973 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754067Ab1DWNhP (ORCPT ); Sat, 23 Apr 2011 09:37:15 -0400 Received: by pwi15 with SMTP id 15so661314pwi.19 for ; Sat, 23 Apr 2011 06:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=m6YcW9UQpNfOARqsc93/77bG8zy/HJJZYSxd4dCMDvE=; b=KCzmkGMilra4mnzrUBwuE+4/GpSMS3WJxaKjD7LltgUOIZAjkPb1AJZkvPFCdLGGIJ 6M7OPON310dV8wgjdjas/atmcdBPPrBoliJQAtC2DxrR/7AKynm9kPuNZwqRr3gnIxrE Z7VWFIOWKOY8d1daqKHnNPc6r8yPKZWYJ1Eys= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=Z3lC0zSkcRaN3nyleKJRIGxM/btYOXRrpSb9+/qEmWpqshWGioonZnygwH+1WGTYg0 uev8MvLKtizMg2asNVrdtmSN9Rju4+7JWgMCs4r3CMea+ohWUytYkCWAnFnVTvDbJH+z 5s6v+7Yi1nrJ7aYjT90g15+bfbEikZ0LgfjJg= Received: by 10.68.18.3 with SMTP id s3mr3425793pbd.246.1303565835108; Sat, 23 Apr 2011 06:37:15 -0700 (PDT) Received: from localhost.localdomain ([110.75.120.247]) by mx.google.com with ESMTPS id h7sm2659120pbg.74.2011.04.23.06.37.12 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 23 Apr 2011 06:37:14 -0700 (PDT) From: Robin Dong To: linux-ext4@vger.kernel.org Cc: Robin Dong Subject: [PATCH] fix incorrect error-message of ext2 Date: Sat, 23 Apr 2011 21:36:58 +0800 Message-Id: <1303565818-19512-1-git-send-email-hao.bigrat@gmail.com> X-Mailer: git-send-email 1.7.3.5 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Robin Dong 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 --- 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; }