From 77dc4eb04c21664cef8d4fb048ccb952ccef778c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 27 Jul 2001 22:00:18 -0400 Subject: [PATCH] mke2fs.c (PRS): If the blocksize is not specified, and the journal device is specified, user it to determine the blocksize of the filesystem. --- misc/ChangeLog | 6 ++++++ misc/mke2fs.c | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index b2092fa..4aaf749 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,9 @@ +2001-07-27 Theodore Tso + + * mke2fs.c (PRS): If the blocksize is not specified and the + journal device is specified, use it to determine the + blocksize of the new filesystem. + 2001-07-20 Theodore Tso * fsck.8.in: Add much more explicit language documenting how the diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 238a703..f67e6e7 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -971,6 +971,28 @@ static void PRS(int argc, char *argv[]) if (raid_opts) parse_raid_opts(raid_opts); + /* + * If there's no blocksize specified and there is a journal + * device, use it to figure out the blocksize + */ + if (blocksize == 0 && journal_device) { + ext2_filsys jfs; + + retval = ext2fs_open(journal_device, + EXT2_FLAG_JOURNAL_DEV_OK, 0, + 0, unix_io_manager, &jfs); + if (retval) { + com_err(program_name, retval, + _("while trying to open journal device %s\n"), + journal_device); + exit(1); + } + blocksize = jfs->blocksize; + param.s_log_block_size = + int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE); + ext2fs_close(jfs); + } + /* Parse the user-supplied feature_set, if any. */ if (feature_set && !strncasecmp(feature_set, "none", 4)) feature_set = NULL; @@ -1050,6 +1072,7 @@ static void PRS(int argc, char *argv[]) fs_type = "journal"; reserved_ratio = 0; } + set_fs_defaults(fs_type, ¶m, blocksize, &inode_ratio); if (param.s_blocks_per_group) { @@ -1233,7 +1256,7 @@ int main (int argc, char *argv[]) exit(1); } if (!quiet) { - printf(_("Creating journal on device %s: "), + printf(_("Adding journal to device %s: "), journal_device); fflush(stdout); } -- 1.8.3.1