public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e2fsprogs: play with 8TB to 16TB fs's better
@ 2008-01-08 19:33 Josef Bacik
  2008-01-08 23:02 ` Andreas Dilger
  0 siblings, 1 reply; 5+ messages in thread
From: Josef Bacik @ 2008-01-08 19:33 UTC (permalink / raw)
  To: linux-ext4

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 "

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-10 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 19:33 [PATCH] e2fsprogs: play with 8TB to 16TB fs's better Josef Bacik
2008-01-08 23:02 ` Andreas Dilger
2008-01-09 21:04   ` Josef Bacik
2008-01-10  3:59     ` Andreas Dilger
2008-01-10 21:53       ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox