public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems
@ 2007-06-21 15:04 Valerie Clement
  2007-06-21 19:08 ` Andreas Dilger
  2007-06-25 14:54 ` Aneesh Kumar K.V
  0 siblings, 2 replies; 4+ messages in thread
From: Valerie Clement @ 2007-06-21 15:04 UTC (permalink / raw)
  To: Theodore Tso, ext4 development

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

This patch adds a new option '-D' to mkfs to allow creating ext4 filesystem.

  lib/ext2fs/ext2_fs.h    |    7 +++++++
  lib/ext2fs/initialize.c |    1 +
  misc/mke2fs.c           |   18 ++++++++++++++++--
  3 files changed, 24 insertions(+), 2 deletions(-)





[-- Attachment #2: 01-new-desc-size-option --]
[-- Type: text/plain, Size: 3555 bytes --]

Index: e2fsprogs-1.39-tyt3-v7/misc/mke2fs.c
===================================================================
--- e2fsprogs-1.39-tyt3-v7.orig/misc/mke2fs.c	2007-04-30 07:10:05.000000000 +0200
+++ e2fsprogs-1.39-tyt3-v7/misc/mke2fs.c	2007-06-14 12:03:48.000000000 +0200
@@ -96,7 +96,7 @@ static void usage(void)
 {
 	fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] "
 	"[-f fragment-size]\n\t[-i bytes-per-inode] [-I inode-size] "
-	"[-j] [-J journal-options]\n"
+	"[-D descriptor-size] [-j] [-J journal-options]\n"
 	"\t[-N number-of-inodes] [-m reserved-blocks-percentage] "
 	"[-o creator-os]\n\t[-g blocks-per-group] [-L volume-label] "
 	"[-M last-mounted-directory]\n\t[-O feature[,...]] "
@@ -899,6 +899,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;
@@ -977,7 +978,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);
@@ -1094,6 +1095,14 @@ static void PRS(int argc, char *argv[])
 				exit(1);
 			}
 			break;
+		case 'D':
+			desc_size = strtoul(optarg, &tmp, 0);
+			if (*tmp) {
+				com_err(program_name, 0,
+					_("invalid descriptor size - %s"), optarg);
+				exit(1);
+			}
+			break;
 		case 'v':
 			verbose = 1;
 			break;
@@ -1422,6 +1431,11 @@ static void PRS(int argc, char *argv[])
 		}
 	}
 
+	if (desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
+		fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT;
+		fs_param.s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;
+	}
+
 	if (!force && fs_param.s_blocks_count >= ((unsigned) 1 << 31)) {
 		com_err(program_name, 0,
 			_("Filesystem too large.  No more than 2**31-1 blocks\n"
Index: e2fsprogs-1.39-tyt3-v7/lib/ext2fs/ext2_fs.h
===================================================================
--- e2fsprogs-1.39-tyt3-v7.orig/lib/ext2fs/ext2_fs.h	2007-04-30 07:10:05.000000000 +0200
+++ e2fsprogs-1.39-tyt3-v7/lib/ext2fs/ext2_fs.h	2007-06-14 12:03:48.000000000 +0200
@@ -217,6 +217,13 @@ struct ext2_dx_countlimit {
 /*
  * Macro-instructions used to manage group descriptors
  */
+#define EXT2_MIN_DESC_SIZE		32
+#define EXT2_MIN_DESC_SIZE_64BIT	64
+#define EXT2_MAX_DESC_SIZE		EXT2_MIN_BLOCK_SIZE
+#define EXT2_DESC_SIZE(s)						\
+	((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \
+	 EXT2_MIN_DESC_SIZE_64BIT : EXT2_MIN_DESC_SIZE)
+
 #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_INODES_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
Index: e2fsprogs-1.39-tyt3-v7/lib/ext2fs/initialize.c
===================================================================
--- e2fsprogs-1.39-tyt3-v7.orig/lib/ext2fs/initialize.c	2007-04-30 07:10:05.000000000 +0200
+++ e2fsprogs-1.39-tyt3-v7/lib/ext2fs/initialize.c	2007-06-14 12:03:48.000000000 +0200
@@ -149,6 +149,7 @@ errcode_t ext2fs_initialize(const char *
 
 	set_field(s_log_block_size, 0);	/* default blocksize: 1024 bytes */
 	set_field(s_log_frag_size, 0); /* default fragsize: 1024 bytes */
+	set_field(s_desc_size, 0);
 	set_field(s_first_data_block, super->s_log_block_size ? 0 : 1);
 	set_field(s_max_mnt_count, EXT2_DFL_MAX_MNT_COUNT);
 	set_field(s_errors, EXT2_ERRORS_DEFAULT);

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

* Re: [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems
  2007-06-21 15:04 [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems Valerie Clement
@ 2007-06-21 19:08 ` Andreas Dilger
  2007-06-25 14:54 ` Aneesh Kumar K.V
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2007-06-21 19:08 UTC (permalink / raw)
  To: Valerie Clement; +Cc: Theodore Tso, ext4 development

On Jun 21, 2007  17:04 +0200, Valerie Clement wrote:
> @@ -1094,6 +1095,14 @@ static void PRS(int argc, char *argv[])
>  				exit(1);
>  			}
>  			break;
> +		case 'D':
> +			desc_size = strtoul(optarg, &tmp, 0);
> +			if (*tmp) {
> +				com_err(program_name, 0,
> +					_("invalid descriptor size - %s"), optarg);
> +				exit(1);
> +			}

I think we should limit the descriptor size to a power-of-two value so that
we can access it with only shift operations instead of division, and we do
not need to worry about descriptors crossing blocks.

Also, the upper limit should be the filesystem blocksize.

> @@ -1422,6 +1431,11 @@ static void PRS(int argc, char *argv[])
> +	if (desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
> +		fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT;
> +		fs_param.s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;
> +	}

This should be "if (desc_size > EXT2_MIN_DESC_SIZE)" I think, even though
the two are (currently) equivalent.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

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

* Re: [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems
  2007-06-21 15:04 [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems Valerie Clement
  2007-06-21 19:08 ` Andreas Dilger
@ 2007-06-25 14:54 ` Aneesh Kumar K.V
  2007-06-25 21:59   ` Andreas Dilger
  1 sibling, 1 reply; 4+ messages in thread
From: Aneesh Kumar K.V @ 2007-06-25 14:54 UTC (permalink / raw)
  To: Valerie Clement; +Cc: Theodore Tso, ext4 development



Valerie Clement wrote:
> This patch adds a new option '-D' to mkfs to allow creating ext4 
> filesystem.
> 
>  lib/ext2fs/ext2_fs.h    |    7 +++++++
>  lib/ext2fs/initialize.c |    1 +
>  misc/mke2fs.c           |   18 ++++++++++++++++--
>  3 files changed, 24 insertions(+), 2 deletions(-)
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: e2fsprogs-1.39-tyt3-v7/misc/mke2fs.c
> ===================================================================
> --- e2fsprogs-1.39-tyt3-v7.orig/misc/mke2fs.c	2007-04-30 07:10:05.000000000 +0200
> +++ e2fsprogs-1.39-tyt3-v7/misc/mke2fs.c	2007-06-14 12:03:48.000000000 +0200
> @@ -96,7 +96,7 @@ static void usage(void)
>  {
>  	fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] "
>  	"[-f fragment-size]\n\t[-i bytes-per-inode] [-I inode-size] "
> -	"[-j] [-J journal-options]\n"
> +	"[-D descriptor-size] [-j] [-J journal-options]\n"
>  	"\t[-N number-of-inodes] [-m reserved-blocks-percentage] "
>  	"[-o creator-os]\n\t[-g blocks-per-group] [-L volume-label] "
>  	"[-M last-mounted-directory]\n\t[-O feature[,...]] "
> @@ -899,6 +899,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;
> @@ -977,7 +978,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);
> @@ -1094,6 +1095,14 @@ static void PRS(int argc, char *argv[])
>  				exit(1);
>  			}
>  			break;
> +		case 'D':
> +			desc_size = strtoul(optarg, &tmp, 0);
> +			if (*tmp) {
> +				com_err(program_name, 0,
> +					_("invalid descriptor size - %s"), optarg);
> +				exit(1);
> +			}
> +			break;
>  		case 'v':
>  			verbose = 1;
>  			break;
> @@ -1422,6 +1431,11 @@ static void PRS(int argc, char *argv[])
>  		}
>  	}
> 
> +	if (desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
> +		fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT;
> +		fs_param.s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;
> +	}
> +
>  	if (!force && fs_param.s_blocks_count >= ((unsigned) 1 << 31)) {
>

Why would one need variable descriptor size. Right now we have only two descriptor sizes right (32 and 64 ).  Can't we figure out
the descriptor size we should use by looking at the partition size ? What is that i am missing ?. 

-aneesh

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

* Re: [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems
  2007-06-25 14:54 ` Aneesh Kumar K.V
@ 2007-06-25 21:59   ` Andreas Dilger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2007-06-25 21:59 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: Valerie Clement, Theodore Tso, ext4 development

On Jun 25, 2007  20:24 +0530, Aneesh Kumar K.V wrote:
> Why would one need variable descriptor size. Right now we have only two 
> descriptor sizes right (32 and 64 ).  Can't we figure out
> the descriptor size we should use by looking at the partition size ? What 
> is that i am missing ?. 

Because one may want to expand an ext4 filesystem over 16TB after format
time, and this would require a 64-byte descriptor.  In ext4 the descriptor
is almost completely full already (to deal with BIG_BG changes, and possibly
large blocksize changes), so we may even need 128-byte descriptors soon.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

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

end of thread, other threads:[~2007-06-25 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 15:04 [RFC][PATCH 1/11][take 2] add new mkfs option to create ext4 filesystems Valerie Clement
2007-06-21 19:08 ` Andreas Dilger
2007-06-25 14:54 ` Aneesh Kumar K.V
2007-06-25 21:59   ` Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox