All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: nicholas.dokos@hp.com, linux-ext4@vger.kernel.org,
	Valerie Aurora <vaurora@redhat.com>
Subject: [PATCH 1/5][64-BIT] ext2fs_block_alloc_stats2: fix size comparison for 64-bit compatibility.
Date: Wed, 08 Apr 2009 17:46:05 -0400	[thread overview]
Message-ID: <11636.1239227165@alphaville.usa.hp.com> (raw)

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 <nicholas.dokos@hp.com>
---
 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;
-- 
1.6.0.6


             reply	other threads:[~2009-04-08 21:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 21:46 Nick Dokos [this message]
2009-04-15 19:53 ` [PATCH 1/5][64-BIT] ext2fs_block_alloc_stats2: fix size comparison for 64-bit compatibility Valerie Aurora Henson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11636.1239227165@alphaville.usa.hp.com \
    --to=nicholas.dokos@hp.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=vaurora@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.