From 20953129e6d280c3bb46ced5e8cab18faeca7cbc Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 27 Jan 2005 19:07:26 -0500 Subject: [PATCH] mke2fs.c (PRS): If the device size is too big to be expressed using a 1k blocksize, retry with a 4k blocksize. (Addresses Sourceforge bug #1106631) --- misc/ChangeLog | 6 ++++++ misc/mke2fs.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index 1372ba64..65387a14 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,9 @@ +2005-01-27 Theodore Ts'o + + * mke2fs.c (PRS): If the device size is too big to be expressed + using a 1k blocksize, retry with a 4k blocksize. + (Addresses Sourceforge bug #1106631) + 2005-01-26 Theodore Ts'o * Makefile.in (uninstall): Make sure "make uninstall" removes diff --git a/misc/mke2fs.c b/misc/mke2fs.c index c7afeae1..4a428e74 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -702,7 +702,7 @@ static void show_stats(ext2_filsys fs) case EXT2_OS_LINUX: fputs("Linux", stdout); break; case EXT2_OS_HURD: fputs("GNU/Hurd", stdout); break; case EXT2_OS_MASIX: fputs ("Masix", stdout); break; - case EXT2_OS_FREEBSD: fputs ("FerrBSD", stdout); break; + case EXT2_OS_FREEBSD: fputs ("FreeBSD", stdout); break; case EXT2_OS_LITES: fputs ("Lites", stdout); break; default: fputs(_("(unknown os)"), stdout); } @@ -1252,10 +1252,20 @@ static void PRS(int argc, char *argv[]) if (noaction && param.s_blocks_count) { dev_size = param.s_blocks_count; retval = 0; - } else + } else { + retry: retval = ext2fs_get_device_size(device_name, EXT2_BLOCK_SIZE(¶m), &dev_size); + if ((retval == EFBIG) && + (blocksize == 0) && + (param.s_log_block_size == 0)) { + param.s_log_block_size = 2; + blocksize = 4096; + goto retry; + } + } + if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) { com_err(program_name, retval, _("while trying to determine filesystem size"));