All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valerie Clement <valerie.clement@bull.net>
To: Theodore Tso <tytso@mit.edu>,
	ext4 development <linux-ext4@vger.kernel.org>
Subject: [RFC][PATCH 10/11][take 2] convert blk_t to 64-bit for ext4 FS in e2fsprogs
Date: Thu, 21 Jun 2007 17:42:23 +0200	[thread overview]
Message-ID: <467A9C5F.3080004@bull.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

This patch converts blk_t type to __u64 when compiling code with 
"_EXT4FS_" option.
Force the 64-bit feature when the filesystem is greater than 2**32 blocks.

Changes from the previous version:
- ask for confirmation before creating the ext4 filesystem

  lib/ext2fs/ext2_fs.h |    3 ++-
  lib/ext2fs/ext2fs.h  |   15 +++++++++++----
  misc/mke2fs.c        |   14 +++++++++++++-
  3 files changed, 26 insertions(+), 6 deletions(-)




[-- Attachment #2: 10-allow_larger_fs --]
[-- Type: text/plain, Size: 4009 bytes --]

Index: e2fsprogs-1.39-tyt3-v7/misc/mke2fs.c
===================================================================
--- e2fsprogs-1.39-tyt3-v7.orig/misc/mke2fs.c	2007-06-21 13:16:34.000000000 +0200
+++ e2fsprogs-1.39-tyt3-v7/misc/mke2fs.c	2007-06-21 13:16:47.000000000 +0200
@@ -1273,6 +1273,17 @@ static void PRS(int argc, char *argv[])
 				  ));
 				exit(1);
 			}
+			if (dev_size > ((unsigned) 1 << 31) &&
+				desc_size < EXT2_MIN_DESC_SIZE_64BIT) {
+				fprintf(stderr, _("\nWarning: "
+				"Filesystem greater than 2**32 blocks.\n"
+				"Force 64-bit incompatible feature ?\n\n"));
+				proceed_question();
+				fs_param.s_feature_incompat |=
+					EXT4_FEATURE_INCOMPAT_64BIT;
+				fs_param.s_desc_size =
+					EXT2_MIN_DESC_SIZE_64BIT;
+			}
 			EXT2_BLOCKS_COUNT_SET(&fs_param, dev_size);
 			if (sys_page_size > EXT2_BLOCK_SIZE(&fs_param))
 				fs_param.s_blocks_count &= ~((sys_page_size /
@@ -1445,7 +1456,8 @@ static void PRS(int argc, char *argv[])
 		fs_param.s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;
 	}
 
-	if (!force && EXT2_BLOCKS_COUNT(&fs_param) >= ((unsigned) 1 << 31)) {
+	if (!force && (fs_param.s_desc_size < EXT2_MIN_DESC_SIZE_64BIT)
+		&& EXT2_BLOCKS_COUNT(&fs_param) >= ((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."));
Index: e2fsprogs-1.39-tyt3-v7/lib/ext2fs/ext2fs.h
===================================================================
--- e2fsprogs-1.39-tyt3-v7.orig/lib/ext2fs/ext2fs.h	2007-06-21 13:16:45.000000000 +0200
+++ e2fsprogs-1.39-tyt3-v7/lib/ext2fs/ext2fs.h	2007-06-21 13:16:47.000000000 +0200
@@ -73,7 +73,12 @@ extern "C" {
 #endif /* EXT2_FLAT_INCLUDES */
 
 typedef __u32		ext2_ino_t;
+#ifdef _EXT4FS_
+#define _EXT2_64BIT_BLK_T	1
+typedef __u64		blk_t;
+#else
 typedef __u32		blk_t;
+#endif
 typedef __u64		blk64_t;
 typedef __u32		dgrp_t;
 typedef __u32		ext2_off_t;
@@ -491,13 +496,15 @@ struct ext2fs_extent {
 					 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
 					 EXT2_FEATURE_INCOMPAT_META_BG|\
 					 EXT3_FEATURE_INCOMPAT_RECOVER|\
-					 EXT3_FEATURE_INCOMPAT_EXTENTS)
+					 EXT3_FEATURE_INCOMPAT_EXTENTS|\
+					 EXT4_FEATURE_INCOMPAT_64BIT)
 #else
 #define EXT2_LIB_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE|\
 					 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
 					 EXT2_FEATURE_INCOMPAT_META_BG|\
 					 EXT3_FEATURE_INCOMPAT_RECOVER|\
-					 EXT3_FEATURE_INCOMPAT_EXTENTS)
+					 EXT3_FEATURE_INCOMPAT_EXTENTS|\
+					 EXT4_FEATURE_INCOMPAT_64BIT)
 #endif
 #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
 					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE)
@@ -1263,7 +1270,7 @@ _INLINE_ int ext2fs_group_of_ino(ext2_fi
 _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
 {
 	return fs->super->s_first_data_block +
-		(group * fs->super->s_blocks_per_group);
+		(group * (blk_t) EXT2_BLOCKS_PER_GROUP(fs->super));
 }
 
 /*
@@ -1274,7 +1281,7 @@ _INLINE_ blk_t ext2fs_group_last_block(e
 	return (group == fs->group_desc_count - 1 ?
 		EXT2_BLOCKS_COUNT(fs->super) - 1 :
 		ext2fs_group_first_block(fs, group) +
-			(fs->super->s_blocks_per_group - 1));
+			(EXT2_BLOCKS_PER_GROUP(fs->super) - 1));
 }
 
 _INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
Index: e2fsprogs-1.39-tyt3-v7/lib/ext2fs/ext2_fs.h
===================================================================
--- e2fsprogs-1.39-tyt3-v7.orig/lib/ext2fs/ext2_fs.h	2007-06-21 13:15:40.000000000 +0200
+++ e2fsprogs-1.39-tyt3-v7/lib/ext2fs/ext2_fs.h	2007-06-21 13:16:47.000000000 +0200
@@ -678,7 +678,8 @@ struct ext2_super_block {
 
 
 #define EXT2_FEATURE_COMPAT_SUPP	0
-#define EXT2_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE)
+#define EXT2_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE| \
+					 EXT4_FEATURE_INCOMPAT_64BIT)
 #define EXT2_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
 					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
 					 EXT2_FEATURE_RO_COMPAT_BTREE_DIR)

             reply	other threads:[~2007-06-21 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-21 15:42 Valerie Clement [this message]
2007-06-21 21:27 ` [RFC][PATCH 10/11][take 2] convert blk_t to 64-bit for ext4 FS in e2fsprogs Andreas Dilger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=467A9C5F.3080004@bull.net \
    --to=valerie.clement@bull.net \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.