linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] dumpe2fs: complain if extra arguments are given on the command line
@ 2014-08-25  3:59 Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 2/5] resize2fs.8.in: clarify when on-line resizing is supported Theodore Ts'o
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-08-25  3:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Addresses-Debian-Bug: #758074

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/dumpe2fs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index cc18ad8..1eae5a3 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -575,8 +575,10 @@ int main (int argc, char ** argv)
 			usage();
 		}
 	}
-	if (optind > argc - 1)
+	if (argc - 1 > optind) {
 		usage();
+		exit(1);
+	}
 	device_name = argv[optind++];
 	flags = EXT2_FLAG_JOURNAL_DEV_OK | EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_64BITS;
 	if (force)
-- 
2.1.0


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

* [PATCH 2/5] resize2fs.8.in: clarify when on-line resizing is supported
  2014-08-25  3:59 [PATCH 1/5] dumpe2fs: complain if extra arguments are given on the command line Theodore Ts'o
@ 2014-08-25  3:59 ` Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 3/5] resize2fs: clarify the size of blocks in resize2fs's messages Theodore Ts'o
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-08-25  3:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Addresses-Debian-Bug: #726760

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 resize/resize2fs.8.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
index a1f3099..86495c6 100644
--- a/resize/resize2fs.8.in
+++ b/resize/resize2fs.8.in
@@ -29,9 +29,10 @@ program will resize ext2, ext3, or ext4 file systems.  It can be used to
 enlarge or shrink an unmounted file system located on
 .IR device .
 If the filesystem is mounted, it can be used to expand the size of the
-mounted filesystem, assuming the kernel supports on-line resizing.  (As
-of this writing, the Linux 2.6 kernel supports on-line resize for
-filesystems mounted using ext3 and ext4.).
+mounted filesystem, assuming the kernel and the file system supports
+on-line resizing.  (Modern Linux 2.6 kernels will support on-line resize
+for file systems mounted using ext3 and ext4; ext3 file systems will
+require the use of file systems with the resize_inode feature enabled.)
 .PP
 The
 .I size
-- 
2.1.0


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

* [PATCH 3/5] resize2fs: clarify the size of blocks in resize2fs's messages
  2014-08-25  3:59 [PATCH 1/5] dumpe2fs: complain if extra arguments are given on the command line Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 2/5] resize2fs.8.in: clarify when on-line resizing is supported Theodore Ts'o
@ 2014-08-25  3:59 ` Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 4/5] mke2fs.8.in: explain how the fs-size parameter is interpreted Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 5/5] mke2fs: improve the error message when a non-existent file is specified Theodore Ts'o
  3 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-08-25  3:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Addresses-Debian-Bug: #758029

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 resize/main.c               | 9 +++++----
 tests/r_inline_xattr/expect | 2 +-
 tests/r_min_itable/expect   | 2 +-
 tests/r_move_itable/expect  | 8 ++++----
 tests/r_resize_inode/expect | 6 +++---
 5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/resize/main.c b/resize/main.c
index ef2a810..c107028 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -441,8 +441,9 @@ int main (int argc, char ** argv)
 		exit(1);
 	}
 	if (new_size == ext2fs_blocks_count(fs->super)) {
-		fprintf(stderr, _("The filesystem is already %llu blocks "
-			"long.  Nothing to do!\n\n"), new_size);
+		fprintf(stderr, _("The filesystem is already %llu (%dk) "
+			"blocks long.  Nothing to do!\n\n"), new_size,
+			fs->blocksize / 1024);
 		exit(0);
 	}
 	if (mount_flags & EXT2_MF_MOUNTED) {
@@ -468,8 +469,8 @@ int main (int argc, char ** argv)
 		ext2fs_close_free(&fs);
 		exit(1);
 	}
-	printf(_("The filesystem on %s is now %llu blocks long.\n\n"),
-	       device_name, new_size);
+	printf(_("The filesystem on %s is now %llu (%dk) blocks long.\n\n"),
+	       device_name, new_size, fs->blocksize / 1024);
 
 	if ((st_buf.st_size > new_file_size) &&
 	    (fd > 0)) {
diff --git a/tests/r_inline_xattr/expect b/tests/r_inline_xattr/expect
index 9e71264..b2f1ccd 100644
--- a/tests/r_inline_xattr/expect
+++ b/tests/r_inline_xattr/expect
@@ -6,7 +6,7 @@ Extended attributes stored in inode body:
 Exit status is 0
 resize2fs test.img 5M
 Resizing the filesystem on test.img to 5120 (1k) blocks.
-The filesystem on test.img is now 5120 blocks long.
+The filesystem on test.img is now 5120 (1k) blocks long.
 
 Exit status is 0
 debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|name = ''
diff --git a/tests/r_min_itable/expect b/tests/r_min_itable/expect
index 2d8ecb4..e01041c 100644
--- a/tests/r_min_itable/expect
+++ b/tests/r_min_itable/expect
@@ -1,7 +1,7 @@
 resize2fs test
 resize2fs -M test.img
 Resizing the filesystem on test.img to 1124 (1k) blocks.
-The filesystem on test.img is now 1124 blocks long.
+The filesystem on test.img is now 1124 (1k) blocks long.
 
 Exit status is 0
  
diff --git a/tests/r_move_itable/expect b/tests/r_move_itable/expect
index b4b089b..cec0038 100644
--- a/tests/r_move_itable/expect
+++ b/tests/r_move_itable/expect
@@ -3,7 +3,7 @@ resize2fs -p test.img 10000
 Resizing the filesystem on test.img to 10000 (1k) blocks.
 Begin pass 1 (max = 35)
 Extending the inode table     ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on test.img is now 9985 blocks long.
+The filesystem on test.img is now 9985 (1k) blocks long.
 
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
@@ -299,7 +299,7 @@ resize2fs -p test.img 20000
 Resizing the filesystem on test.img to 20000 (1k) blocks.
 Begin pass 1 (max = 39)
 Extending the inode table     ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on test.img is now 19969 blocks long.
+The filesystem on test.img is now 19969 (1k) blocks long.
 
 Filesystem did not have a UUID; generating one.
 
@@ -833,7 +833,7 @@ resize2fs -p test.img 30000
 Resizing the filesystem on test.img to 30000 (1k) blocks.
 Begin pass 1 (max = 39)
 Extending the inode table     ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on test.img is now 29953 blocks long.
+The filesystem on test.img is now 29953 (1k) blocks long.
 
 Filesystem did not have a UUID; generating one.
 
@@ -1603,7 +1603,7 @@ resize2fs -p test.img 40000
 Resizing the filesystem on test.img to 40000 (1k) blocks.
 Begin pass 1 (max = 40)
 Extending the inode table     ----------------------------------------\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-The filesystem on test.img is now 40000 blocks long.
+The filesystem on test.img is now 40000 (1k) blocks long.
 
 Filesystem did not have a UUID; generating one.
 
diff --git a/tests/r_resize_inode/expect b/tests/r_resize_inode/expect
index 786fe13..ba1647e 100644
--- a/tests/r_resize_inode/expect
+++ b/tests/r_resize_inode/expect
@@ -1,7 +1,7 @@
 mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384
 resize2fs test.img 65536
 Resizing the filesystem on test.img to 65536 (1k) blocks.
-The filesystem on test.img is now 65536 blocks long.
+The filesystem on test.img is now 65536 (1k) blocks long.
 
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
@@ -448,7 +448,7 @@ Group 63: (Blocks 64513-65535)
 mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 65536
 resize2fs test.img 16384
 Resizing the filesystem on test.img to 16384 (1k) blocks.
-The filesystem on test.img is now 16384 blocks long.
+The filesystem on test.img is now 16384 (1k) blocks long.
 
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
@@ -600,7 +600,7 @@ Group 15: (Blocks 15361-16383)
 --------------------------------
 resize2fs test.img 165536
 Resizing the filesystem on test.img to 165536 (1k) blocks.
-The filesystem on test.img is now 165536 blocks long.
+The filesystem on test.img is now 165536 (1k) blocks long.
 
 Filesystem did not have a UUID; generating one.
 
-- 
2.1.0


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

* [PATCH 4/5] mke2fs.8.in: explain how the fs-size parameter is interpreted
  2014-08-25  3:59 [PATCH 1/5] dumpe2fs: complain if extra arguments are given on the command line Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 2/5] resize2fs.8.in: clarify when on-line resizing is supported Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 3/5] resize2fs: clarify the size of blocks in resize2fs's messages Theodore Ts'o
@ 2014-08-25  3:59 ` Theodore Ts'o
  2014-08-25  3:59 ` [PATCH 5/5] mke2fs: improve the error message when a non-existent file is specified Theodore Ts'o
  3 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-08-25  3:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/mke2fs.8.in | 53 +++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 41 insertions(+), 12 deletions(-)

diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 9c38e20..50d10ec 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -111,7 +111,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
 ]
 .I device
 [
-.I blocks-count
+.I fs-size
 ]
 @JDEV@.sp
 @JDEV@.B "mke2fs \-O journal_dev"
@@ -139,23 +139,52 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
 @JDEV@]
 @JDEV@.I external-journal
 @JDEV@[
-@JDEV@.I blocks-count
+@JDEV@.I fs-size
 @JDEV@]
 .SH DESCRIPTION
 .B mke2fs
 is used to create an ext2, ext3, or ext4 filesystem, usually in a disk
-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,
+partition (or file) named by
+.IR device .
+.PP
+The file system size is specified by
+.IR fs-size .
+If
+.I fs-size
+does not have a suffix, it is interpreted as power-of-two kilobytes,
+unless the
+.B \-b
+.I blocksize
+option is specified, in which case
+.I fs-size
+is interpreted as the number of
+.I blocksize
+blocks.   If the fs-size is suffixed by 'k', 'm', 'g', 't'
+(either upper-case or lower-case), then it is interpreted in
+power-of-two kilobytes, megabytes, gigabytes, terabytes, etc.
+If
+.I fs-size
+is omitted,
 .B mke2fs
-automagically figures the file system size.  If called as
+will create the file system based on the device size.
+.PP
+If
+.B mke2fs
+is run as
+.B mkfs.XXX
+(i.e.,
+.BR mkfs.ext2 ,
+.BR mkfs.ext3 ,
+or
+.BR mkfs.ext4 )
+the option
+.B \-t
+.I XXX
+is implied; so
 .B mkfs.ext3
-a journal is created as if the
-.B \-j
-option was specified.
+will create a file system for use with ext3,
+.B mkfs.ext4
+will create a file system for use with ext4, and so on.
 .PP
 The defaults of the parameters for the newly created filesystem, if not
 overridden by the options listed below, are controlled by the
-- 
2.1.0


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

* [PATCH 5/5] mke2fs: improve the error message when a non-existent file is specified
  2014-08-25  3:59 [PATCH 1/5] dumpe2fs: complain if extra arguments are given on the command line Theodore Ts'o
                   ` (2 preceding siblings ...)
  2014-08-25  3:59 ` [PATCH 4/5] mke2fs.8.in: explain how the fs-size parameter is interpreted Theodore Ts'o
@ 2014-08-25  3:59 ` Theodore Ts'o
  3 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-08-25  3:59 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

If the user does not specify the file system size, and the file does
not exist, give an error message like this:

   The file /tmp/foo.img does not exist and no size was specified.

instead of this:

    Creating regular file /tmp/foo.img
    mke2fs: Device size reported to be zero.  Invalid partition specified, or
	    partition table wasn't reread after running fdisk, due to
	    a modified partition being busy and in use.  You may need to reboot
	    to re-read your partition table.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/mke2fs.c | 2 ++
 misc/util.c   | 5 +++++
 misc/util.h   | 1 +
 3 files changed, 8 insertions(+)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index da77e3a..550e886 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1796,6 +1796,8 @@ profile_error:
 		flags |= CHECK_FS_EXIST;
 	if (!quiet)
 		flags |= VERBOSE_CREATE;
+	if (fs_blocks_count == 0)
+		flags |= NO_SIZE;
 	if (!check_plausibility(device_name, flags, &is_device) && !force)
 		proceed_question(proceed_delay);
 
diff --git a/misc/util.c b/misc/util.c
index 1fcae1d..2898830 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -198,6 +198,11 @@ int check_plausibility(const char *device, int flags, int *ret_is_dev)
 	char *fs_label = NULL;
 
 	fd = ext2fs_open_file(device, fl, 0666);
+	if ((fd < 0) && (errno == ENOENT) && (flags & NO_SIZE)) {
+		fprintf(stderr, _("The file %s does not exist and no "
+				  "size was specified.\n"), device);
+		exit(1);
+	}
 	if ((fd < 0) && (errno == ENOENT) && (flags & CREATE_FILE)) {
 		fl |= O_CREAT;
 		fd = ext2fs_open_file(device, fl, 0666);
diff --git a/misc/util.h b/misc/util.h
index 476164b..f3827dd 100644
--- a/misc/util.h
+++ b/misc/util.h
@@ -22,6 +22,7 @@ extern char	*journal_location_string;
 #define CREATE_FILE	0x0002
 #define CHECK_FS_EXIST	0x0004
 #define VERBOSE_CREATE	0x0008
+#define NO_SIZE		0x0010
 
 #ifndef HAVE_STRCASECMP
 extern int strcasecmp (char *s1, char *s2);
-- 
2.1.0


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

end of thread, other threads:[~2014-08-25  3:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25  3:59 [PATCH 1/5] dumpe2fs: complain if extra arguments are given on the command line Theodore Ts'o
2014-08-25  3:59 ` [PATCH 2/5] resize2fs.8.in: clarify when on-line resizing is supported Theodore Ts'o
2014-08-25  3:59 ` [PATCH 3/5] resize2fs: clarify the size of blocks in resize2fs's messages Theodore Ts'o
2014-08-25  3:59 ` [PATCH 4/5] mke2fs.8.in: explain how the fs-size parameter is interpreted Theodore Ts'o
2014-08-25  3:59 ` [PATCH 5/5] mke2fs: improve the error message when a non-existent file is specified Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).