]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: change EXT2_MAX_BLOCKS_PER_GROUP() to be cluster size aware
authorTheodore Ts'o <tytso@mit.edu>
Sat, 4 Jun 2011 20:40:26 +0000 (16:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 4 Jun 2011 20:40:26 +0000 (16:40 -0400)
Change the EXT2_MAX_BLOCKS_PER_GROUP so that it takes the cluster size
into account.  This way we can open bigalloc file systems without
ext2fs_open() thinking that they are corrupt.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ext2_fs.h

index a6c70de58c77fa33f41619e46019abbdcd4782d4..2d960910c540812cc94e1047274f390036a43eb2 100644 (file)
@@ -225,9 +225,13 @@ struct ext2_dx_countlimit {
 
 #define EXT2_BLOCKS_PER_GROUP(s)       (EXT2_SB(s)->s_blocks_per_group)
 #define EXT2_INODES_PER_GROUP(s)       (EXT2_SB(s)->s_inodes_per_group)
+#define EXT2_CLUSTERS_PER_GROUP(s)     (EXT2_SB(s)->s_clusters_per_group)
 #define EXT2_INODES_PER_BLOCK(s)       (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
 /* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
-#define EXT2_MAX_BLOCKS_PER_GROUP(s)   ((1 << 16) - 8)
+#define EXT2_MAX_BLOCKS_PER_GROUP(s)   (((1 << 16) - 8) *      \
+                                        (EXT2_CLUSTER_SIZE(s) / \
+                                         EXT2_BLOCK_SIZE(s)))
+#define EXT2_MAX_CLUSTERS_PER_GROUP(s) ((1 << 16) - 8)
 #define EXT2_MAX_INODES_PER_GROUP(s)   ((1 << 16) - EXT2_INODES_PER_BLOCK(s))
 #ifdef __KERNEL__
 #define EXT2_DESC_PER_BLOCK(s)         (EXT2_SB(s)->s_desc_per_block)