Hello,

Currently in order to mkfs a >8TB fs with 4k blocks you have to do -F, which is
kind of dumb since you can go to 16TB-4k.  This patch removes that one check
that won't let you go above 8TB and fixes getsize so that if you have a 16TB fs
instead of complaining that the device is too big just -1 from the size and go
ahead on business as usual.  Tested this with my box and it works fine (yay
having >16tb to play with).  Thank you,

Josef


Index: e2fsprogs/lib/ext2fs/getsize.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/getsize.c
+++ e2fsprogs/lib/ext2fs/getsize.c
@@ -190,8 +190,13 @@ errcode_t ext2fs_get_device_size(const c
            ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
                if ((sizeof(*retblocks) < sizeof(unsigned long long)) &&
                    ((size64 / blocksize) > 0xFFFFFFFF)) {
-                       rc = EFBIG;
-                       goto out;
+                       /* 16tb fs is fine, just adjust slightly */
+                       if ((size64 / blocksize) == 0x100000000) {
+                               size64--;
+                       } else {
+                               rc = EFBIG;
+                               goto out;
+                       }
                }
                *retblocks = size64 / blocksize;
                goto out;
@@ -252,13 +257,19 @@ errcode_t ext2fs_get_device_size(const c
                struct stat     st;
                if (fstat(fd, &st) == 0)
 #endif
+                       size64 = st.st_size;
                        if (S_ISREG(st.st_mode)) {
                                if ((sizeof(*retblocks) < sizeof(unsigned long 
long)) &&
-                                   ((st.st_size / blocksize) > 0xFFFFFFFF)) {
-                                       rc = EFBIG;
-                                       goto out;
+                                   ((size64 / blocksize) > 0xFFFFFFFF)) {
+                                       /* 16tb fs is fine, just adjust 
slightly */
+                                       if ((size64 / blocksize) > 0x100000000) 
{
+                                               size64--;
+                                       } else {
+                                               rc = EFBIG;
+                                               goto out;
+                                       }
                                }
-                               *retblocks = st.st_size / blocksize;
+                               *retblocks = size64 / blocksize;
                                goto out;
                        }
        }
@@ -284,8 +295,13 @@ errcode_t ext2fs_get_device_size(const c
        size64 = low + 1;
        if ((sizeof(*retblocks) < sizeof(unsigned long long))
            && ((size64 / blocksize) > 0xFFFFFFFF)) {
-               rc = EFBIG;
-               goto out;
+               /* 16tb fs is fine, just adjust slightly */
+               if ((size64 / blocksize) > 0x100000000) {
+                       size64--;
+               } else {
+                       rc = EFBIG;
+                       goto out;
+               }
        }
        *retblocks = size64 / blocksize;
 out:
Index: e2fsprogs/misc/mke2fs.c
===================================================================
--- e2fsprogs.orig/misc/mke2fs.c
+++ e2fsprogs/misc/mke2fs.c
@@ -1455,13 +1455,6 @@ static void PRS(int argc, char *argv[])
                }
        }
 
-       if (!force && fs_param.s_blocks_count >= ((unsigned) 1 << 31)) {
-               com_err(program_name, 0,
-                       _("Filesystem too large.  No more than 2**31-1 blocks\n"
-                         "\t (8TB using a blocksize of 4k) are currently 
supported."));
-             exit(1);
-       }
-
        if ((blocksize > 4096) &&
            (fs_param.s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
                fprintf(stderr, _("\nWarning: some 2.4 kernels do not support "
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to