]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: If the device size is exactly 16TB treat it as if it had 16TB - 1 block
authorTheodore Ts'o <tytso@mit.edu>
Tue, 20 Jan 2009 19:03:03 +0000 (14:03 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Jan 2009 19:03:03 +0000 (14:03 -0500)
This allows users who create a 16TB LVM to have mke2fs do (mostly) the
right thing automatcally.

misc/mke2fs.c

index 0f9238ed1631436aa45a4d114071b6936aeba11e..c5f4da11d1ad173fdd7897591c795ed94f22eaef 100644 (file)
@@ -1442,17 +1442,33 @@ static void PRS(int argc, char *argv[])
        }
 
        if (retval == EFBIG) {
+               blk64_t big_dev_size;
+
+               if (blocksize < 4096) {
+                       fs_param.s_log_block_size = 2;
+                       blocksize = 4096;
+               }
+               retval = ext2fs_get_device_size2(device_name,
+                                EXT2_BLOCK_SIZE(&fs_param), &big_dev_size);
+               if (retval)
+                       goto get_size_failure;
+               if (big_dev_size == (1ULL << 32)) {
+                       dev_size = (blk_t) (big_dev_size - 1);
+                       goto got_size;
+               }
                fprintf(stderr, _("%s: Size of device %s too big "
                                  "to be expressed in 32 bits\n\t"
                                  "using a blocksize of %d.\n"),
                        program_name, device_name, EXT2_BLOCK_SIZE(&fs_param));
                exit(1);
        }
+get_size_failure:
        if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) {
                com_err(program_name, retval,
                        _("while trying to determine filesystem size"));
                exit(1);
        }
+got_size:
        if (!fs_param.s_blocks_count) {
                if (retval == EXT2_ET_UNIMPLEMENTED) {
                        com_err(program_name, 0,