Skip to contentSkip to conversation

BIG_BG: larger block bitmaps

RFC PATCH In review Valerie Clement 1 participant 1 message Nov 24, 2006 ext4 file system

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/4 BIG_BG: larger block bitmaps

This patch modifies the read_block_bitmap() and the block allocation functions to take into account that the block bitmap can be stored on several consecutive blocks.

 fs/ext4/balloc.c        |  150 ++++++++++++++++++++++++++++++++++--------------
 fs/ext4/super.c         |   36 ++++++-----
 include/linux/ext4_fs.h |    6 +
 3 files changed, 133 insertions(+), 59 deletions(-)
include/linux/ext4_fs.h +6 -0
Index: linux-2.6.19-rc6/include/linux/ext4_fs.h
===================================================================
@@ -151,6 +151,12 @@ struct ext4_group_desc
 # define EXT4_DESC_PER_BLOCK(s)		(EXT4_SB(s)->s_desc_per_block)
 # define EXT4_INODES_PER_GROUP(s)	(EXT4_SB(s)->s_inodes_per_group)
 # define EXT4_DESC_PER_BLOCK_BITS(s)	(EXT4_SB(s)->s_desc_per_block_bits)
+# define EXT4_BITS_PER_BLOCK(s)		(EXT4_BLOCK_SIZE(s) << 3)
+# define EXT4_BITS_PER_BLOCK_BITS(s)	(EXT4_BLOCK_SIZE_BITS(s) + 3)
+# define EXT4_BLOCK_BITMAP_NBYTES(s)	((EXT4_BLOCKS_PER_GROUP(s) + 7) >> 3)
+# define EXT4_BLOCK_BITMAP_PER_GROUP(s)	((EXT4_BLOCK_BITMAP_NBYTES(s) + (EXT4_BLOCK_SIZE(s) - 1)) >> EXT4_BLOCK_SIZE_BITS(s))
+# define EXT4_INODE_BITMAP_NBYTES(s)	((EXT4_INODES_PER_GROUP(s) + 7) >> 3)
+# define EXT4_INODE_BITMAP_PER_GROUP(s)	((EXT4_INODE_BITMAP_NBYTES(s) + (EXT4_BLOCK_SIZE(s) - 1)) >> EXT4_BLOCK_SIZE_BITS(s))
 #else
 # define EXT4_BLOCKS_PER_GROUP(s)	((s)->s_blocks_per_group)
 # define EXT4_DESC_PER_BLOCK(s)		(EXT4_BLOCK_SIZE(s) / EXT4_DESC_SIZE(s))
fs/ext4/balloc.c +108 -42

328 lines not on this page · raw message

fs/ext4/super.c +19 -17
Index: linux-2.6.19-rc6/fs/ext4/super.c
===================================================================
@@ -1665,23 +1665,25 @@ static int ext4_fill_super (struct super
 		sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
 	sbi->s_def_hash_version = es->s_def_hash_version;
 
-	if (sbi->s_blocks_per_group > blocksize * 8) {
-		printk (KERN_ERR
-			"EXT4-fs: #blocks per group too big: %lu\n",
-			sbi->s_blocks_per_group);
-		goto failed_mount;
-	}
-	if (sbi->s_frags_per_group > blocksize * 8) {
-		printk (KERN_ERR
-			"EXT4-fs: #fragments per group too big: %lu\n",
-			sbi->s_frags_per_group);
-		goto failed_mount;
-	}
-	if (sbi->s_inodes_per_group > blocksize * 8) {
-		printk (KERN_ERR
-			"EXT4-fs: #inodes per group too big: %lu\n",
-			sbi->s_inodes_per_group);
-		goto failed_mount;
+	if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
+		if (sbi->s_blocks_per_group > blocksize * 8) {
+			printk (KERN_ERR
+				"EXT4-fs: #blocks per group too big: %lu\n",
+				sbi->s_blocks_per_group);
+			goto failed_mount;
+		}
+		if (sbi->s_frags_per_group > blocksize * 8) {
+			printk (KERN_ERR
+				"EXT4-fs: #fragments per group too big: %lu\n",
+				sbi->s_frags_per_group);
+			goto failed_mount;
+		}
+		if (sbi->s_inodes_per_group > blocksize * 8) {
+			printk (KERN_ERR
+				"EXT4-fs: #inodes per group too big: %lu\n",
+				sbi->s_inodes_per_group);
+			goto failed_mount;
+		}
 	}
 
 	if (ext4_blocks_count(es) >