linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5][64-BIT] ext2fs_block_alloc_stats2: fix size comparison for 64-bit compatibility.
@ 2009-04-08 21:46 Nick Dokos
  2009-04-15 19:53 ` Valerie Aurora Henson
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Dokos @ 2009-04-08 21:46 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: nicholas.dokos, linux-ext4, Valerie Aurora

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-15 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 21:46 [PATCH 1/5][64-BIT] ext2fs_block_alloc_stats2: fix size comparison for 64-bit compatibility Nick Dokos
2009-04-15 19:53 ` Valerie Aurora Henson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).