All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size
@ 2011-06-05 10:30 Lukas Czerner
  2011-06-05 10:30 ` [PATCH 2/2 v4] mke2fs: use binary units in the man page Lukas Czerner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-06-05 10:30 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, Lukas Czerner

mke2fs and resize2fs allows specifying filesystem size as a parameter,
former called as blocks-count. However it has been a little bit messy so
this commit fixes it mainly by updating man pages.

We can not specify filesystem size in blocks count without specifying
blocksize as well. It is because we need blocks count to determine
filesystem type, and we need filesystem type to determine blocksize. So
it should not be allowed, however due to compatibility reason it should
be still possible, so at least print warning message for now, so we can
easily restrict that later.

Filesystem size can be specified using units as suffixes. This was not
documented for mke2fs, so this commits adds proper documentation into
mke2fs man page.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
[v2]: do not spell units - mebibytes etc... - but rather use just abbrev.
[v3]: Change some phrasing in man pages, mainly with the help from Eric Sandeen
[v4]: Remove 'b' unit designator.
 lib/e2p/parse_num.c   |    1 -
 misc/mke2fs.8.in      |   34 ++++++++++++++++++++++++++++------
 resize/resize2fs.8.in |   23 ++++++++---------------
 3 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/lib/e2p/parse_num.c b/lib/e2p/parse_num.c
index 83a329a..8e2751b 100644
--- a/lib/e2p/parse_num.c
+++ b/lib/e2p/parse_num.c
@@ -37,7 +37,6 @@ unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
 		num >>= (1+log_block_size);
 		break;
 	case '\0':
-		break;
 	default:
 		return 0;
 	}
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 4a3b0c3..f315910 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -108,7 +108,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
 ]
 .I device
 [
-.I blocks-count
+.I filesystem-size
 ]
 @JDEV@.sp
 @JDEV@.B "mke2fs \-O journal_dev"
@@ -136,7 +136,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
 @JDEV@]
 @JDEV@.I external-journal
 @JDEV@[
-@JDEV@.I blocks-count
+@JDEV@.I filesystem-size
 @JDEV@]
 .SH DESCRIPTION
 .B mke2fs
@@ -145,10 +145,32 @@ partition.
 .I device
 is the special file corresponding to the device (e.g
 .IR /dev/hdXX ).
-.I blocks-count
-is the number of blocks on the device.  If omitted,
-.B mke2fs
-automagically figures the file system size.  If called as
+.I filesystem-size
+is the size of the filesystem you want to create. Optionally, the
+.I filesystem-size
+parameter may be suffixed by one of the following unit
+designators: 's', 'K', 'M', 'G', or 'T',
+for  512 byte sectors, KiB (2^10 Bytes), MiB (2^20 Bytes),
+GiB (2^30 Bytes), or TiB (2^40 Bytes) respectively, which are binary (power-of-2),
+not decimal, units. If no units are specified, then the
+.I filesystem-size
+parameter shall specify the number of filesystem blocks.
+Note that you should not specify
+.I filesystem-size
+in block units (or without any units at all) without also specifying block
+size with the
+.B \-b
+option. This will be allowed for now due to compatibility reasons,
+however it may be restricted in the future. For now, 1024-byte blocks will
+be assumed in this case, regardless of the filesystem blocksize ultimately
+chosen by mke2fs.
+The
+.I filesystem-size
+may never be larger than the size of the partition.
+If the
+.I filesystem-size
+parameter is not specified, it will default to the size of the partition.
+If called as
 .B mkfs.ext3
 a journal is created as if the
 .B \-j
diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
index e02345d..0f4153c 100644
--- a/resize/resize2fs.8.in
+++ b/resize/resize2fs.8.in
@@ -36,29 +36,22 @@ filesystems mounted using ext3 and ext4.).
 The 
 .I size
 parameter specifies the requested new size of the filesystem.
-If no units are specified, the units of the
-.I size
-parameter shall be the filesystem blocksize of the filesystem.
 Optionally, the 
 .I size
-parameter may be suffixed by one of the following the units 
-designators: 's', 'K', 'M', or 'G',
-for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively.
-The 
+parameter may be suffixed by one of the following the unit
+designators: 's', 'K', 'M', 'G', or 'T',
+for 512 byte sectors, KiB (2^10 Bytes), MiB (2^20 Bytes),
+GiB (2^30 Bytes), or TiB (2^40 Bytes) respectively, which are binary (power-of-2),
+not decimal, units.
+If no units are specified, then the
+.I size
+parameter shall specify the number of filesystem blocks. The
 .I size
 of the filesystem may never be larger than the size of the partition.
 If 
 .I size
 parameter is not specified, it will default to the size of the partition.
 .PP
-Note: when kilobytes is used above, I mean
-.IR real ,
-power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct
-folks insist should be the stupid-sounding ``kibibytes''.  The same
-holds true for megabytes, also sometimes known as ``mebibytes'', or
-gigabytes, as the amazingly silly ``gibibytes''.  Makes you want to
-gibber, doesn't it?
-.PP
 The
 .B resize2fs
 program does not manipulate the size of partitions.  If you wish to enlarge
-- 
1.7.4.4


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

* [PATCH 2/2 v4] mke2fs: use binary units in the man page
  2011-06-05 10:30 [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
@ 2011-06-05 10:30 ` Lukas Czerner
  2011-08-11 15:02 ` [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
  2011-09-03 15:10 ` Ted Ts'o
  2 siblings, 0 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-06-05 10:30 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, Lukas Czerner

Decimal units (kilobyte 10^3, megabyte 10^6 etc...) were used in
mke2fs manual page, however they was really meant to be binary units
(kibibyte 2^10, mebibyte 2^20 etc...), so change the man pages to
reflect that fact, even if it sounds weird.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
[v2]: do not spell units - mebibytes etc... - but rather use just abbrev
[v3]: add Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[v4]: nothing
 misc/mke2fs.8.in |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index f315910..8a349ff 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -356,9 +356,9 @@ The following journal options are supported:
 .BI size= journal-size
 Create an internal journal (i.e., stored inside the filesystem) of size
 .I journal-size
-megabytes.
+MiB.
 The size of the journal must be at least 1024 filesystem blocks
-(i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.)
+(i.e., 1MiB if using 1024 byte blocks, 4MiB if using 4096 byte blocks, etc.)
 and may be no more than 102,400 filesystem blocks.
 @JDEV@.TP
 @JDEV@.BI device= external-journal
@@ -635,21 +635,21 @@ using a comma separated list.
 If this option is is not specified,
 .B mke2fs
 will pick a single default usage type based on the size of the filesystem to
-be created.  If the filesystem size is less than or equal to 3 megabytes,
+be created.  If the filesystem size is less than or equal to 3 MiB,
 .B mke2fs
 will use the filesystem type
 .IR floppy .
 If the filesystem size is greater than 3 but less than or equal to
-512 megabytes,
+512 MiB,
 .BR mke2fs (8)
 will use the filesystem type
 .IR small .
-If the filesystem size is greater than or equal to 4 terabytes but less than
-16 terabytes,
+If the filesystem size is greater than or equal to 4 TiB but less than
+16 TiB,
 .BR mke2fs (8)
 will use the filesystem type
 .IR big .
-If the filesystem size is greater than or equal to 16 terabytes,
+If the filesystem size is greater than or equal to 16 TiB,
 .BR mke2fs (8)
 will use the filesystem type
 .IR huge .
-- 
1.7.4.4


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

* Re: [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size
  2011-06-05 10:30 [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
  2011-06-05 10:30 ` [PATCH 2/2 v4] mke2fs: use binary units in the man page Lukas Czerner
@ 2011-08-11 15:02 ` Lukas Czerner
  2011-09-01  8:38   ` Lukas Czerner
  2011-09-03 15:10 ` Ted Ts'o
  2 siblings, 1 reply; 6+ messages in thread
From: Lukas Czerner @ 2011-08-11 15:02 UTC (permalink / raw)
  To: Lukas Czerner; +Cc: linux-ext4, tytso

On Sun, 5 Jun 2011, Lukas Czerner wrote:

> mke2fs and resize2fs allows specifying filesystem size as a parameter,
> former called as blocks-count. However it has been a little bit messy so
> this commit fixes it mainly by updating man pages.
> 
> We can not specify filesystem size in blocks count without specifying
> blocksize as well. It is because we need blocks count to determine
> filesystem type, and we need filesystem type to determine blocksize. So
> it should not be allowed, however due to compatibility reason it should
> be still possible, so at least print warning message for now, so we can
> easily restrict that later.
> 
> Filesystem size can be specified using units as suffixes. This was not
> documented for mke2fs, so this commits adds proper documentation into
> mke2fs man page.

Hi Ted,

any chance merging that ?

Thanks!
-Lukas

> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> [v2]: do not spell units - mebibytes etc... - but rather use just abbrev.
> [v3]: Change some phrasing in man pages, mainly with the help from Eric Sandeen
> [v4]: Remove 'b' unit designator.
>  lib/e2p/parse_num.c   |    1 -
>  misc/mke2fs.8.in      |   34 ++++++++++++++++++++++++++++------
>  resize/resize2fs.8.in |   23 ++++++++---------------
>  3 files changed, 36 insertions(+), 22 deletions(-)
> 
> diff --git a/lib/e2p/parse_num.c b/lib/e2p/parse_num.c
> index 83a329a..8e2751b 100644
> --- a/lib/e2p/parse_num.c
> +++ b/lib/e2p/parse_num.c
> @@ -37,7 +37,6 @@ unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
>  		num >>= (1+log_block_size);
>  		break;
>  	case '\0':
> -		break;
>  	default:
>  		return 0;
>  	}
> diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
> index 4a3b0c3..f315910 100644
> --- a/misc/mke2fs.8.in
> +++ b/misc/mke2fs.8.in
> @@ -108,7 +108,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
>  ]
>  .I device
>  [
> -.I blocks-count
> +.I filesystem-size
>  ]
>  @JDEV@.sp
>  @JDEV@.B "mke2fs \-O journal_dev"
> @@ -136,7 +136,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
>  @JDEV@]
>  @JDEV@.I external-journal
>  @JDEV@[
> -@JDEV@.I blocks-count
> +@JDEV@.I filesystem-size
>  @JDEV@]
>  .SH DESCRIPTION
>  .B mke2fs
> @@ -145,10 +145,32 @@ partition.
>  .I device
>  is the special file corresponding to the device (e.g
>  .IR /dev/hdXX ).
> -.I blocks-count
> -is the number of blocks on the device.  If omitted,
> -.B mke2fs
> -automagically figures the file system size.  If called as
> +.I filesystem-size
> +is the size of the filesystem you want to create. Optionally, the
> +.I filesystem-size
> +parameter may be suffixed by one of the following unit
> +designators: 's', 'K', 'M', 'G', or 'T',
> +for  512 byte sectors, KiB (2^10 Bytes), MiB (2^20 Bytes),
> +GiB (2^30 Bytes), or TiB (2^40 Bytes) respectively, which are binary (power-of-2),
> +not decimal, units. If no units are specified, then the
> +.I filesystem-size
> +parameter shall specify the number of filesystem blocks.
> +Note that you should not specify
> +.I filesystem-size
> +in block units (or without any units at all) without also specifying block
> +size with the
> +.B \-b
> +option. This will be allowed for now due to compatibility reasons,
> +however it may be restricted in the future. For now, 1024-byte blocks will
> +be assumed in this case, regardless of the filesystem blocksize ultimately
> +chosen by mke2fs.
> +The
> +.I filesystem-size
> +may never be larger than the size of the partition.
> +If the
> +.I filesystem-size
> +parameter is not specified, it will default to the size of the partition.
> +If called as
>  .B mkfs.ext3
>  a journal is created as if the
>  .B \-j
> diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
> index e02345d..0f4153c 100644
> --- a/resize/resize2fs.8.in
> +++ b/resize/resize2fs.8.in
> @@ -36,29 +36,22 @@ filesystems mounted using ext3 and ext4.).
>  The 
>  .I size
>  parameter specifies the requested new size of the filesystem.
> -If no units are specified, the units of the
> -.I size
> -parameter shall be the filesystem blocksize of the filesystem.
>  Optionally, the 
>  .I size
> -parameter may be suffixed by one of the following the units 
> -designators: 's', 'K', 'M', or 'G',
> -for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively.
> -The 
> +parameter may be suffixed by one of the following the unit
> +designators: 's', 'K', 'M', 'G', or 'T',
> +for 512 byte sectors, KiB (2^10 Bytes), MiB (2^20 Bytes),
> +GiB (2^30 Bytes), or TiB (2^40 Bytes) respectively, which are binary (power-of-2),
> +not decimal, units.
> +If no units are specified, then the
> +.I size
> +parameter shall specify the number of filesystem blocks. The
>  .I size
>  of the filesystem may never be larger than the size of the partition.
>  If 
>  .I size
>  parameter is not specified, it will default to the size of the partition.
>  .PP
> -Note: when kilobytes is used above, I mean
> -.IR real ,
> -power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct
> -folks insist should be the stupid-sounding ``kibibytes''.  The same
> -holds true for megabytes, also sometimes known as ``mebibytes'', or
> -gigabytes, as the amazingly silly ``gibibytes''.  Makes you want to
> -gibber, doesn't it?
> -.PP
>  The
>  .B resize2fs
>  program does not manipulate the size of partitions.  If you wish to enlarge
> 

-- 

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

* Re: [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size
  2011-08-11 15:02 ` [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
@ 2011-09-01  8:38   ` Lukas Czerner
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-09-01  8:38 UTC (permalink / raw)
  To: Lukas Czerner; +Cc: linux-ext4, tytso

On Thu, 11 Aug 2011, Lukas Czerner wrote:

> On Sun, 5 Jun 2011, Lukas Czerner wrote:
> 
> > mke2fs and resize2fs allows specifying filesystem size as a parameter,
> > former called as blocks-count. However it has been a little bit messy so
> > this commit fixes it mainly by updating man pages.
> > 
> > We can not specify filesystem size in blocks count without specifying
> > blocksize as well. It is because we need blocks count to determine
> > filesystem type, and we need filesystem type to determine blocksize. So
> > it should not be allowed, however due to compatibility reason it should
> > be still possible, so at least print warning message for now, so we can
> > easily restrict that later.
> > 
> > Filesystem size can be specified using units as suffixes. This was not
> > documented for mke2fs, so this commits adds proper documentation into
> > mke2fs man page.
> 
> Hi Ted,
> 
> any chance merging that ?
> 
> Thanks!
> -Lukas

ping^2

> 
> > 
> > Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> > Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> > ---
> > [v2]: do not spell units - mebibytes etc... - but rather use just abbrev.
> > [v3]: Change some phrasing in man pages, mainly with the help from Eric Sandeen
> > [v4]: Remove 'b' unit designator.
> >  lib/e2p/parse_num.c   |    1 -
> >  misc/mke2fs.8.in      |   34 ++++++++++++++++++++++++++++------
> >  resize/resize2fs.8.in |   23 ++++++++---------------
> >  3 files changed, 36 insertions(+), 22 deletions(-)
> > 
> > diff --git a/lib/e2p/parse_num.c b/lib/e2p/parse_num.c
> > index 83a329a..8e2751b 100644
> > --- a/lib/e2p/parse_num.c
> > +++ b/lib/e2p/parse_num.c
> > @@ -37,7 +37,6 @@ unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
> >  		num >>= (1+log_block_size);
> >  		break;
> >  	case '\0':
> > -		break;
> >  	default:
> >  		return 0;
> >  	}
> > diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
> > index 4a3b0c3..f315910 100644
> > --- a/misc/mke2fs.8.in
> > +++ b/misc/mke2fs.8.in
> > @@ -108,7 +108,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
> >  ]
> >  .I device
> >  [
> > -.I blocks-count
> > +.I filesystem-size
> >  ]
> >  @JDEV@.sp
> >  @JDEV@.B "mke2fs \-O journal_dev"
> > @@ -136,7 +136,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
> >  @JDEV@]
> >  @JDEV@.I external-journal
> >  @JDEV@[
> > -@JDEV@.I blocks-count
> > +@JDEV@.I filesystem-size
> >  @JDEV@]
> >  .SH DESCRIPTION
> >  .B mke2fs
> > @@ -145,10 +145,32 @@ partition.
> >  .I device
> >  is the special file corresponding to the device (e.g
> >  .IR /dev/hdXX ).
> > -.I blocks-count
> > -is the number of blocks on the device.  If omitted,
> > -.B mke2fs
> > -automagically figures the file system size.  If called as
> > +.I filesystem-size
> > +is the size of the filesystem you want to create. Optionally, the
> > +.I filesystem-size
> > +parameter may be suffixed by one of the following unit
> > +designators: 's', 'K', 'M', 'G', or 'T',
> > +for  512 byte sectors, KiB (2^10 Bytes), MiB (2^20 Bytes),
> > +GiB (2^30 Bytes), or TiB (2^40 Bytes) respectively, which are binary (power-of-2),
> > +not decimal, units. If no units are specified, then the
> > +.I filesystem-size
> > +parameter shall specify the number of filesystem blocks.
> > +Note that you should not specify
> > +.I filesystem-size
> > +in block units (or without any units at all) without also specifying block
> > +size with the
> > +.B \-b
> > +option. This will be allowed for now due to compatibility reasons,
> > +however it may be restricted in the future. For now, 1024-byte blocks will
> > +be assumed in this case, regardless of the filesystem blocksize ultimately
> > +chosen by mke2fs.
> > +The
> > +.I filesystem-size
> > +may never be larger than the size of the partition.
> > +If the
> > +.I filesystem-size
> > +parameter is not specified, it will default to the size of the partition.
> > +If called as
> >  .B mkfs.ext3
> >  a journal is created as if the
> >  .B \-j
> > diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
> > index e02345d..0f4153c 100644
> > --- a/resize/resize2fs.8.in
> > +++ b/resize/resize2fs.8.in
> > @@ -36,29 +36,22 @@ filesystems mounted using ext3 and ext4.).
> >  The 
> >  .I size
> >  parameter specifies the requested new size of the filesystem.
> > -If no units are specified, the units of the
> > -.I size
> > -parameter shall be the filesystem blocksize of the filesystem.
> >  Optionally, the 
> >  .I size
> > -parameter may be suffixed by one of the following the units 
> > -designators: 's', 'K', 'M', or 'G',
> > -for 512 byte sectors, kilobytes, megabytes, or gigabytes, respectively.
> > -The 
> > +parameter may be suffixed by one of the following the unit
> > +designators: 's', 'K', 'M', 'G', or 'T',
> > +for 512 byte sectors, KiB (2^10 Bytes), MiB (2^20 Bytes),
> > +GiB (2^30 Bytes), or TiB (2^40 Bytes) respectively, which are binary (power-of-2),
> > +not decimal, units.
> > +If no units are specified, then the
> > +.I size
> > +parameter shall specify the number of filesystem blocks. The
> >  .I size
> >  of the filesystem may never be larger than the size of the partition.
> >  If 
> >  .I size
> >  parameter is not specified, it will default to the size of the partition.
> >  .PP
> > -Note: when kilobytes is used above, I mean
> > -.IR real ,
> > -power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct
> > -folks insist should be the stupid-sounding ``kibibytes''.  The same
> > -holds true for megabytes, also sometimes known as ``mebibytes'', or
> > -gigabytes, as the amazingly silly ``gibibytes''.  Makes you want to
> > -gibber, doesn't it?
> > -.PP
> >  The
> >  .B resize2fs
> >  program does not manipulate the size of partitions.  If you wish to enlarge
> > 
> 
> 

-- 

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

* Re: [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size
  2011-06-05 10:30 [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
  2011-06-05 10:30 ` [PATCH 2/2 v4] mke2fs: use binary units in the man page Lukas Czerner
  2011-08-11 15:02 ` [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
@ 2011-09-03 15:10 ` Ted Ts'o
  2011-09-05 11:58   ` Lukas Czerner
  2 siblings, 1 reply; 6+ messages in thread
From: Ted Ts'o @ 2011-09-03 15:10 UTC (permalink / raw)
  To: Lukas Czerner; +Cc: linux-ext4

On Sun, Jun 05, 2011 at 12:30:44PM +0200, Lukas Czerner wrote:
> We can not specify filesystem size in blocks count without specifying
> blocksize as well. It is because we need blocks count to determine
> filesystem type, and we need filesystem type to determine blocksize. So
> it should not be allowed, however due to compatibility reason it should
> be still possible, so at least print warning message for now, so we can
> easily restrict that later.

What we currently have is actually very well defined.  The fs-size
parameter is either an absolute size, if a suffixed value (i.e., 12k,
64M, 128G, 2T) is specified.  If the value does not have a suffix,
then it is either interpreted as a block count if a blocksize is
specified, or as kilobytes if no blocksize is explicitly specified.

And this is really only a problem with mke2fs; it's not a problem with
resize2fs, since we know what the blocksize is.

> diff --git a/lib/e2p/parse_num.c b/lib/e2p/parse_num.c
> index 83a329a..8e2751b 100644
> --- a/lib/e2p/parse_num.c
> +++ b/lib/e2p/parse_num.c
> @@ -37,7 +37,6 @@ unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
>  		num >>= (1+log_block_size);
>  		break;
>  	case '\0':
> -		break;
>  	default:
>  		return 0;
>  	}

and this doesn't do what the commit description claims.  This change
actually breaks the use of a number that does not have a suffix.

I'd rather not break resize2fs at all.  If script wants to specify a
block count, that's fine.  If we want to add a warning which gets
printed by mke2fs in the case where there is no explicit blockcount
specified by the user and no explicit size suffix to the fs-size
parameter stating that parameter was interpreted as kilobytes, that's
fine.

Basically, how mke2fs parses that field has been the way it has been
for over a decade, and it's really not caused any problems for users.

    	   	       	    	       - Ted

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

* Re: [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size
  2011-09-03 15:10 ` Ted Ts'o
@ 2011-09-05 11:58   ` Lukas Czerner
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-09-05 11:58 UTC (permalink / raw)
  To: Ted Ts'o; +Cc: Lukas Czerner, linux-ext4

On Sat, 3 Sep 2011, Ted Ts'o wrote:

> On Sun, Jun 05, 2011 at 12:30:44PM +0200, Lukas Czerner wrote:
> > We can not specify filesystem size in blocks count without specifying
> > blocksize as well. It is because we need blocks count to determine
> > filesystem type, and we need filesystem type to determine blocksize. So
> > it should not be allowed, however due to compatibility reason it should
> > be still possible, so at least print warning message for now, so we can
> > easily restrict that later.
> 
> What we currently have is actually very well defined.  The fs-size
> parameter is either an absolute size, if a suffixed value (i.e., 12k,
> 64M, 128G, 2T) is specified.  If the value does not have a suffix,
> then it is either interpreted as a block count if a blocksize is
> specified, or as kilobytes if no blocksize is explicitly specified.
> 
> And this is really only a problem with mke2fs; it's not a problem with
> resize2fs, since we know what the blocksize is.
> 
> > diff --git a/lib/e2p/parse_num.c b/lib/e2p/parse_num.c
> > index 83a329a..8e2751b 100644
> > --- a/lib/e2p/parse_num.c
> > +++ b/lib/e2p/parse_num.c
> > @@ -37,7 +37,6 @@ unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
> >  		num >>= (1+log_block_size);
> >  		break;
> >  	case '\0':
> > -		break;
> >  	default:
> >  		return 0;
> >  	}
> 
> and this doesn't do what the commit description claims.  This change
> actually breaks the use of a number that does not have a suffix.
> 
> I'd rather not break resize2fs at all.  If script wants to specify a
> block count, that's fine.  If we want to add a warning which gets
> printed by mke2fs in the case where there is no explicit blockcount
> specified by the user and no explicit size suffix to the fs-size
> parameter stating that parameter was interpreted as kilobytes, that's
> fine.
> 
> Basically, how mke2fs parses that field has been the way it has been
> for over a decade, and it's really not caused any problems for users.
> 
>     	   	       	    	       - Ted
> 

Ok, than. We can drop the patch.

Thanks!
-Lukas

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

end of thread, other threads:[~2011-09-05 11:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05 10:30 [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
2011-06-05 10:30 ` [PATCH 2/2 v4] mke2fs: use binary units in the man page Lukas Czerner
2011-08-11 15:02 ` [PATCH 1/2 v4] e2fsprogs: Fix how we treat user-spcified filesystem size Lukas Czerner
2011-09-01  8:38   ` Lukas Czerner
2011-09-03 15:10 ` Ted Ts'o
2011-09-05 11:58   ` Lukas Czerner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.