From patchwork Thu Dec 24 00:10:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elliott, Robert (Servers)" X-Patchwork-Id: 560760 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 C43A9140BC5 for ; Thu, 24 Dec 2015 10:08:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754955AbbLWXIp (ORCPT ); Wed, 23 Dec 2015 18:08:45 -0500 Received: from g4t3425.houston.hp.com ([15.201.208.53]:4309 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752895AbbLWXIo (ORCPT ); Wed, 23 Dec 2015 18:08:44 -0500 Received: from g4t3433.houston.hp.com (g4t3433.houston.hp.com [16.210.25.219]) by g4t3425.houston.hp.com (Postfix) with ESMTP id 6B33A2B; Wed, 23 Dec 2015 23:08:43 +0000 (UTC) Received: from s17.americas.hpqcorp.net (s17.americas.hpqcorp.net [16.84.26.22]) by g4t3433.houston.hp.com (Postfix) with ESMTP id EDBEE4B; Wed, 23 Dec 2015 23:08:42 +0000 (UTC) From: Robert Elliott To: jack@suse.com, tytso@mit.edu, adilger.kernel@dilger.ca, dan.j.williams@intel.com, choleraehyq@gmail.com Cc: david@fromorbit.com, linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Elliott Subject: [PATCH] ext2, ext4: include filesystem block size in error messages Date: Wed, 23 Dec 2015 18:10:01 -0600 Message-Id: <1450915801-2320-1-git-send-email-elliott@hpe.com> X-Mailer: git-send-email 2.4.3 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Print the problematic value in messages about the filesystem block size. Normalize all of the blocksize messages that use "blocksize" to use "filesystem block size". This helps distinguish this block size from the underlying block device's logical block size (i.e., sector size) and physical block size. Example old messages: EXT2-fs (pmem0): unable to set blocksize EXT4-fs (pmem0): error: unsupported blocksize for dax EXT4-fs (pmem0): unsupported blocksize for fs encryption EXT2-fs (pmem0): bad blocksize %d Example new message: EXT4-fs (pmem0): error: unsupported filesystem block size 2048 for dax Signed-off-by: Robert Elliott Reviewed-by: Jan Kara --- fs/ext2/super.c | 17 +++++++++++------ fs/ext4/super.c | 33 ++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 748d35a..1186a5b 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "ext2.h" #include "xattr.h" @@ -822,7 +823,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) */ blocksize = sb_min_blocksize(sb, BLOCK_SIZE); if (!blocksize) { - ext2_msg(sb, KERN_ERR, "error: unable to set blocksize"); + ext2_msg(sb, KERN_ERR, + "error: unable to set filesystem block size " + __stringify(BLOCK_SIZE)); goto failed_sbi; } @@ -921,7 +924,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) if (sbi->s_mount_opt & EXT2_MOUNT_DAX) { if (blocksize != PAGE_SIZE) { ext2_msg(sb, KERN_ERR, - "error: unsupported blocksize for dax"); + "error: unsupported filesystem block size %d for dax", + blocksize); goto failed_mount; } if (!sb->s_bdev->bd_disk->fops->direct_access) { @@ -937,7 +941,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) if (!sb_set_blocksize(sb, blocksize)) { ext2_msg(sb, KERN_ERR, - "error: bad blocksize %d", blocksize); + "error: bad filesystem block size %d", blocksize); goto failed_sbi; } @@ -1007,14 +1011,15 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) if (sb->s_blocksize != bh->b_size) { if (!silent) - ext2_msg(sb, KERN_ERR, "error: unsupported blocksize"); + ext2_msg(sb, KERN_ERR, + "error: unsupported filesystem block size %lu", + sb->s_blocksize); goto failed_mount; } if (sb->s_blocksize != sbi->s_frag_size) { ext2_msg(sb, KERN_ERR, - "error: fragsize %lu != blocksize %lu" - "(not supported yet)", + "error: fragsize %lu != filesystem block size %lu (not supported yet)", sbi->s_frag_size, sb->s_blocksize); goto failed_mount; } diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c9ab67d..9e1c049 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -42,6 +42,7 @@ #include #include +#include #include "ext4.h" #include "ext4_extents.h" /* Needed for trace points definition */ @@ -1750,8 +1751,9 @@ static int parse_options(char *options, struct super_block *sb, BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); if (blocksize < PAGE_CACHE_SIZE) { - ext4_msg(sb, KERN_ERR, "can't mount with " - "dioread_nolock if block size != PAGE_SIZE"); + ext4_msg(sb, KERN_ERR, + "can't mount with dioread_nolock if filesystem block size %d != PAGE_SIZE", + blocksize); return 0; } } @@ -3147,7 +3149,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ret = -EINVAL; blocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE); if (!blocksize) { - ext4_msg(sb, KERN_ERR, "unable to set blocksize"); + ext4_msg(sb, KERN_ERR, + "unable to set filesystem block size " + __stringify(EXT4_MIN_BLOCK_SIZE)); goto out_fail; } @@ -3367,14 +3371,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if (blocksize < EXT4_MIN_BLOCK_SIZE || blocksize > EXT4_MAX_BLOCK_SIZE) { ext4_msg(sb, KERN_ERR, - "Unsupported filesystem blocksize %d", blocksize); + "Unsupported filesystem block size %d", blocksize); goto failed_mount; } if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { if (blocksize != PAGE_SIZE) { ext4_msg(sb, KERN_ERR, - "error: unsupported blocksize for dax"); + "error: unsupported filesystem block size %d for dax", + blocksize); goto failed_mount; } if (!sb->s_bdev->bd_disk->fops->direct_access) { @@ -3393,7 +3398,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if (sb->s_blocksize != blocksize) { /* Validate the filesystem blocksize */ if (!sb_set_blocksize(sb, blocksize)) { - ext4_msg(sb, KERN_ERR, "bad block size %d", + ext4_msg(sb, KERN_ERR, "bad filesystem block size %d", blocksize); goto failed_mount; } @@ -3495,8 +3500,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if (has_bigalloc) { if (clustersize < blocksize) { ext4_msg(sb, KERN_ERR, - "cluster size (%d) smaller than " - "block size (%d)", clustersize, blocksize); + "cluster size (%d) smaller than filesystem block size (%d)", + clustersize, blocksize); goto failed_mount; } sbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) - @@ -3519,9 +3524,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) } } else { if (clustersize != blocksize) { - ext4_warning(sb, "fragment/cluster size (%d) != " - "block size (%d)", clustersize, - blocksize); + ext4_warning(sb, + "fragment/cluster size (%d) != filesystem block size (%d)", + clustersize, blocksize); clustersize = blocksize; } if (sbi->s_blocks_per_group > blocksize * 8) { @@ -3769,7 +3774,8 @@ no_journal: if ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) && (blocksize != PAGE_CACHE_SIZE)) { ext4_msg(sb, KERN_ERR, - "Unsupported blocksize for fs encryption"); + "Unsupported filesystem block size %d for fs encryption", + blocksize); goto failed_mount_wq; } @@ -4112,7 +4118,8 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb, hblock = bdev_logical_block_size(bdev); if (blocksize < hblock) { ext4_msg(sb, KERN_ERR, - "blocksize too small for journal device"); + "filesystem block size %d too small for journal device", + blocksize); goto out_bdev; }