linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 11/12] mke2fs: store checksum seed at format time
Date: Mon, 12 Oct 2015 14:57:37 -0700	[thread overview]
Message-ID: <20151012215737.29065.99187.stgit@birch.djwong.org> (raw)
In-Reply-To: <20151012215629.29065.24418.stgit@birch.djwong.org>

Allow users to turn on metadata_csum_seed at format time so that UUIDs
can be live-changed at any time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 misc/mke2fs.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)


diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 9a2a6cc..0c344ae 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1074,7 +1074,8 @@ static __u32 ok_features[3] = {
 		EXT4_FEATURE_INCOMPAT_MMP |
 		EXT4_FEATURE_INCOMPAT_64BIT|
 		EXT4_FEATURE_INCOMPAT_INLINE_DATA|
-		EXT4_FEATURE_INCOMPAT_ENCRYPT,
+		EXT4_FEATURE_INCOMPAT_ENCRYPT |
+		EXT4_FEATURE_INCOMPAT_CSUM_SEED,
 	/* R/O compat */
 	EXT2_FEATURE_RO_COMPAT_LARGE_FILE|
 		EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
@@ -2775,6 +2776,13 @@ int main (int argc, char *argv[])
 				 "Pass -O 64bit to rectify.\n"));
 	}
 
+	if (ext2fs_has_feature_csum_seed(fs->super) &&
+	    !ext2fs_has_feature_metadata_csum(fs->super)) {
+		printf("%s", _("The metadata_csum_seed feature "
+			       "requres the metadata_csum feature.\n"));
+		exit(1);
+	}
+
 	/* Calculate journal blocks */
 	if (!journal_device && ((journal_size) ||
 	    ext2fs_has_feature_journal(&fs_param)))
@@ -2830,6 +2838,11 @@ int main (int argc, char *argv[])
 		}
 	} else
 		uuid_generate(fs->super->s_uuid);
+
+	if (ext2fs_has_feature_csum_seed(fs->super))
+		fs->super->s_checksum_seed = ext2fs_crc32c_le(~0,
+				fs->super->s_uuid, sizeof(fs->super->s_uuid));
+
 	ext2fs_init_csum_seed(fs);
 
 	/*


  parent reply	other threads:[~2015-10-12 21:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 21:56 [PATCH 00/12] e2fsprogs: misc fixes and cleanups; save checksum seeds Darrick J. Wong
2015-10-12 21:56 ` [PATCH 01/12] libext2fs: fix maximum bg overhead calculation with meta_bg enabled Darrick J. Wong
2015-10-24  4:37   ` Theodore Ts'o
2015-10-12 21:56 ` [PATCH 02/12] libext2fs: automatically enable meta_bg to avoid filling up BG 0 Darrick J. Wong
2015-10-13  2:34   ` Andreas Dilger
2015-10-13  7:08     ` Darrick J. Wong
2015-10-24  4:38   ` Theodore Ts'o
2015-10-12 21:56 ` [PATCH 03/12] libext2fs: clean up feature test macros with predicate functions Darrick J. Wong
2015-10-24  4:41   ` Theodore Ts'o
2015-10-12 21:56 ` [PATCH 04/12] e2fsck: " Darrick J. Wong
2015-10-24  4:49   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 05/12] misc: " Darrick J. Wong
2015-10-24  5:24   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 06/12] resize2fs: " Darrick J. Wong
2015-10-24  5:24   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 07/12] debugfs: " Darrick J. Wong
2015-10-24  5:26   ` Theodore Ts'o
2015-10-12 21:57 ` [PATCH 08/12] libext2fs: store checksum seed in superblock Darrick J. Wong
2015-10-12 21:57 ` [PATCH 09/12] tune2fs: allow user to turn on saving the checksum seed Darrick J. Wong
2015-10-12 21:57 ` [PATCH 10/12] e2fsck: check the checksum seed feature flag is set correctly Darrick J. Wong
2015-10-12 21:57 ` Darrick J. Wong [this message]
2015-10-12 21:57 ` [PATCH 12/12] tests: check proper operation of metadata_csum_seed Darrick J. Wong

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=20151012215737.29065.99187.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).