[rfc, patch 3/3] larger block group descriptors

Alexandre Ratchov <[email protected]>
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
add to mke2fs a new '-D' option that specifies the descriptor size.
This patch is for testing purposes only; indeed we need to create a
file system in order to test the above patches :-)


Index: e2fsprogs-1.39/misc/mke2fs.c
===================================================================
--- e2fsprogs-1.39.orig/misc/mke2fs.c	2006-06-07 13:41:04.000000000 +0200
+++ e2fsprogs-1.39/misc/mke2fs.c	2006-06-07 13:43:24.000000000 +0200
@@ -676,6 +676,7 @@ static void show_stats(ext2_filsys fs)
 		s->s_log_block_size);
 	printf(_("Fragment size=%u (log=%u)\n"), fs->fragsize,
 		s->s_log_frag_size);
+	printf(_("Descriptor size=%u\n"), fs->desc_size);
 	printf(_("%u inodes, %u blocks\n"), s->s_inodes_count,
 	       s->s_blocks_count);
 	printf(_("%u blocks (%2.2f%%) reserved for the super user\n"),
@@ -892,6 +893,7 @@ static void PRS(int argc, char *argv[])
 	int		blocksize = 0;
 	int		inode_ratio = 0;
 	int		inode_size = 0;
+	int		desc_size = 0;
 	double		reserved_ratio = 5.0;
 	int		sector_size = 0;
 	int		show_version_only = 0;
@@ -967,7 +969,7 @@ static void PRS(int argc, char *argv[])
 	}
 
 	while ((c = getopt (argc, argv,
-		    "b:cf:g:i:jl:m:no:qr:s:tvE:FI:J:L:M:N:O:R:ST:V")) != EOF) {
+		    "b:cf:g:i:jl:m:no:qr:s:tvD:E:FI:J:L:M:N:O:R:ST:V")) != EOF) {
 		switch (c) {
 		case 'b':
 			blocksize = strtol(optarg, &tmp, 0);
@@ -1089,6 +1091,14 @@ static void PRS(int argc, char *argv[])
 		case 'v':
 			verbose = 1;
 			break;
+		case 'D':
+			desc_size = strtoul(optarg, &tmp, 0);
+			if (*tmp) {
+				com_err(program_name, 0,
+					_("invalid inode size - %s"), optarg);
+				exit(1);
+			}
+			break;
 		case 'F':
 			force = 1;
 			break;
@@ -1430,6 +1440,23 @@ static void PRS(int argc, char *argv[])
 		fs_param.s_inode_size = inode_size;
 	}
 
+	if (desc_size) {
+		if (desc_size < EXT2_MIN_DESC_SIZE ||
+		    desc_size > EXT2_MAX_DESC_SIZE ||
+		    desc_size & (desc_size - 1)) {
+			com_err(program_name, 0,
+				_("invalid descriptor size %d (min %d/max %d)"),
+				desc_size, EXT2_MIN_DESC_SIZE,
+				EXT2_MAX_DESC_SIZE);
+			exit(1);
+		}
+		fs_param.s_desc_size = desc_size;
+		if (desc_size != EXT2_MIN_DESC_SIZE) {
+			fs_param.s_feature_incompat |= 
+			    EXT3_FEATURE_INCOMPAT_DESC_SIZE;
+		}
+	}
+
 	/*
 	 * Calculate number of inodes based on the inode ratio
 	 */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.