aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Sangwan <a.sangwan@samsung.com>2013-05-11 09:12:13 +0530
committerTheodore Ts'o <tytso@mit.edu>2013-06-20 22:53:49 -0400
commitfd73a1d254556fce65d03e74ee5a97304f496caa (patch)
treec49ea7267d80691a7aa93aa7041cfc6edac80e37
parent80391dcd2ec853981a11e1178ff7a19598a4e81c (diff)
downloade2fsprogs-fd73a1d254556fce65d03e74ee5a97304f496caa.tar.gz
e2fsprogs-fd73a1d254556fce65d03e74ee5a97304f496caa.tar.xz
e2fsprogs-fd73a1d254556fce65d03e74ee5a97304f496caa.zip
mke2fs: calculate journal blocks just after fs initialize
We can calculate journal blocks as soon as blocksize is set. It will help to figure out wrong journal blocks count earlier. This will save some un-necessary initialization. Without patch output => mke2fs /dev/sdc1 -J size=1048576 mke2fs 1.42.7 (21-Jan-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 61312 inodes, 244936 blocks 12246 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=251658240 8 block groups 32768 blocks per group, 32768 fragments per group 7664 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Allocating group tables: done Writing inode tables: done The requested journal size is 268435456 blocks; it must be between 1024 and 10240000 blocks. Aborting. With patch output => mke2fs /dev/sdc1 -J size=1048576 mke2fs 1.42.7 (21-Jan-2013) The requested journal size is 268435456 blocks; it must be between 1024 and 10240000 blocks. Aborting. Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--misc/mke2fs.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index eae17b80..22c2815d 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2361,6 +2361,12 @@ int main (int argc, char *argv[])
exit(1);
}
+ /* Calculate journal blocks */
+ if (!journal_device && ((journal_size) ||
+ (fs_param.s_feature_compat &
+ EXT3_FEATURE_COMPAT_HAS_JOURNAL)))
+ journal_blocks = figure_journal_size(journal_size, fs);
+
/* Can't undo discard ... */
if (!noaction && discard && (io_ptr != undo_io_manager)) {
retval = mke2fs_discard_device(fs);
@@ -2611,8 +2617,6 @@ int main (int argc, char *argv[])
} else if ((journal_size) ||
(fs_param.s_feature_compat &
EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
- journal_blocks = figure_journal_size(journal_size, fs);
-
if (super_only) {
printf(_("Skipping journal creation in super-only mode\n"));
fs->super->s_journal_inum = EXT2_JOURNAL_INO;