From patchwork Wed Apr 8 21:46:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Dokos X-Patchwork-Id: 25739 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 8C4F4DDDFF for ; Thu, 9 Apr 2009 07:46:08 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763006AbZDHVqH (ORCPT ); Wed, 8 Apr 2009 17:46:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755587AbZDHVqH (ORCPT ); Wed, 8 Apr 2009 17:46:07 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:21656 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763006AbZDHVqG (ORCPT ); Wed, 8 Apr 2009 17:46:06 -0400 Received: from smtp1.fc.hp.com (smtp.cnd.hp.com [15.15.136.127]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 8730582F3; Wed, 8 Apr 2009 21:46:04 +0000 (UTC) Received: from alphaville.usa.hp.com (alphaville.usa.hp.com [16.118.120.205]) by smtp1.fc.hp.com (Postfix) with ESMTP id E27B524DD11; Wed, 8 Apr 2009 21:15:56 +0000 (UTC) Received: from alphaville.usa.hp.com (localhost [127.0.0.1]) by alphaville.usa.hp.com (Postfix) with ESMTP id 1CCFF341EB; Wed, 8 Apr 2009 17:46:05 -0400 (EDT) From: Nick Dokos To: Theodore Ts'o Cc: nicholas.dokos@hp.com, linux-ext4@vger.kernel.org, Valerie Aurora Reply-To: nicholas.dokos@hp.com Subject: [PATCH 1/5][64-BIT] ext2fs_block_alloc_stats2: fix size comparison for 64-bit compatibility. X-Mailer: MH-E 8.1; nmh 1.2; GNU Emacs 23.0.91 Date: Wed, 08 Apr 2009 17:46:05 -0400 Message-ID: <11636.1239227165@alphaville.usa.hp.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The block number comparison in ext2fs_block_alloc_stats2() is invalid for 64-bit filesystems: it compares the block number to the low 32-bits of the blocks_count in the superblock. That caused the journal file for a 32TiB filesystem to be malformed and the resulting filesystem could not be mounted. The function now uses ext2fs_blocks_count() [from blknum.c] to calculate the number of blocks. With this change, the journal looks sane and the filesystem could be mounted. Signed-off-by: Nick Dokos Signed-off-by: Valerie Aurora (Henson) --- lib/ext2fs/alloc_stats.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/ext2fs/alloc_stats.c b/lib/ext2fs/alloc_stats.c index 7895aee..f0c5a64 100644 --- a/lib/ext2fs/alloc_stats.c +++ b/lib/ext2fs/alloc_stats.c @@ -65,7 +65,7 @@ void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse) int group = ext2fs_group_of_blk2(fs, blk); #ifndef OMIT_COM_ERR - if (blk >= fs->super->s_blocks_count) { + if (blk >= ext2fs_blocks_count(fs->super)) { com_err("ext2fs_block_alloc_stats2", 0, "Illegal block number: %lu", blk); return;