From patchwork Tue Oct 22 07:39:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akira Fujita X-Patchwork-Id: 285375 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 19AA62C0196 for ; Tue, 22 Oct 2013 18:46:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700Ab3JVHqA (ORCPT ); Tue, 22 Oct 2013 03:46:00 -0400 Received: from TYO200.gate.nec.co.jp ([202.32.8.215]:38172 "EHLO tyo200.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753645Ab3JVHp7 (ORCPT ); Tue, 22 Oct 2013 03:45:59 -0400 Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r9M7jwIP013849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Oct 2013 16:45:58 +0900 (JST) Received: from mailgate3.nec.co.jp ([10.7.69.160]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r9M7dpE5020123; Tue, 22 Oct 2013 16:39:51 +0900 (JST) Received: from mailsv4.nec.co.jp (imss62.nec.co.jp [10.7.69.157]) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) with ESMTP id r9M7dpS05513; Tue, 22 Oct 2013 16:39:51 +0900 (JST) Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id r9M7dpAN003324; Tue, 22 Oct 2013 16:39:51 +0900 (JST) Received: from shikibu.jp.nec.com ([10.26.220.2] [10.26.220.2]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-377397; Tue, 22 Oct 2013 16:39:38 +0900 Received: from [10.64.168.93] ([10.64.168.93] [10.64.168.93]) by mail.jp.nec.com with ESMTP; Tue, 22 Oct 2013 16:39:38 +0900 Message-ID: <52662BBA.70503@rs.jp.nec.com> Date: Tue, 22 Oct 2013 16:39:38 +0900 From: Akira Fujita User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Theodore Tso , ext4 development Subject: [PATCH] mke2fs: Fix block bitmaps initalization with -O ^resize_inode Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If we create ext4 filesystem without resize_inode feature, mke2fs command does not initialize block groups which have backup superblock and/or group descriptor block (With meta_bg feature, backup superblock and group descriptor block are located separately). So we have to fix block bitmaps when we run "e2fsck -b superblock device". This patch fixes the issue by initializing block bitmaps correctly. Steps to reproduce: 1. mke2fs -t ext4 -b 4096 -O ^resize_inode device 2. e2fsck -b 32768 DEV Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: +(32768--32769) +(98304--98305) +(163840--163841) Fix? Signed-off-by: Akira Fujita --- lib/ext2fs/alloc_sb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/ext2fs/alloc_sb.c b/lib/ext2fs/alloc_sb.c index 223ec51..5419d0d 100644 --- a/lib/ext2fs/alloc_sb.c +++ b/lib/ext2fs/alloc_sb.c @@ -58,23 +58,25 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs, old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; - if (super_blk || (group == 0)) + if (super_blk || (group == 0)) { + ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT); ext2fs_mark_block_bitmap2(bmap, super_blk); + } if ((group == 0) && (fs->blocksize == 1024) && EXT2FS_CLUSTER_RATIO(fs) > 1) ext2fs_mark_block_bitmap2(bmap, 0); if (old_desc_blk) { - if (fs->super->s_reserved_gdt_blocks && fs->block_map == bmap) - ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT); num_blocks = old_desc_blocks; if (old_desc_blk + num_blocks >= ext2fs_blocks_count(fs->super)) num_blocks = ext2fs_blocks_count(fs->super) - old_desc_blk; ext2fs_mark_block_bitmap_range2(bmap, old_desc_blk, num_blocks); } - if (new_desc_blk) + if (new_desc_blk) { + ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT); ext2fs_mark_block_bitmap2(bmap, new_desc_blk); + } num_blocks = ext2fs_group_blocks_count(fs, group); num_blocks -= 2 + fs->inode_blocks_per_group + used_blks;