[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151012215737.29065.99187.stgit@birch.djwong.org>
Date: Mon, 12 Oct 2015 14:57:37 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: tytso@....edu, darrick.wong@...cle.com
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 11/12] mke2fs: store checksum seed at format time
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@...cle.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);
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists