public inbox for linux-ext4@vger.kernel.org
 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 4/8] mke2fs: store checksum seed at format time
Date: Fri, 04 Dec 2015 18:44:42 -0800	[thread overview]
Message-ID: <20151205024442.31087.42715.stgit@birch.djwong.org> (raw)
In-Reply-To: <20151205024416.31087.14808.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 dd467f2..7d31e42 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|
@@ -2774,6 +2775,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)))
@@ -2829,6 +2837,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-12-05  2:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-05  2:44 [PATCH 0/8] e2fsprogs: save checksum seeds; misc fixes Darrick J. Wong
2015-12-05  2:44 ` [PATCH 1/8] libext2fs: store checksum seed in superblock Darrick J. Wong
2015-12-05  2:44 ` [PATCH 2/8] tune2fs: allow user to turn on saving the checksum seed Darrick J. Wong
2015-12-05  2:44 ` [PATCH 3/8] e2fsck: check the checksum seed feature flag is set correctly Darrick J. Wong
2015-12-05  2:44 ` Darrick J. Wong [this message]
2015-12-05  2:44 ` [PATCH 5/8] tests: check proper operation of metadata_csum_seed Darrick J. Wong
2015-12-05  2:44 ` [PATCH 6/8] filefrag: accommodate holes when calculating expected values Darrick J. Wong
2015-12-05  2:45 ` [PATCH 7/8] tune2fs: confirm dangerous operations Darrick J. Wong
2015-12-05  2:45 ` [PATCH 8/8] tune2fs: recover the journal Darrick J. Wong
2015-12-05  5:15 ` [PATCH 0/8] e2fsprogs: save checksum seeds; misc fixes 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=20151205024442.31087.42715.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