[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151205024442.31087.42715.stgit@birch.djwong.org>
Date: Fri, 04 Dec 2015 18:44:42 -0800
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: tytso@....edu, darrick.wong@...cle.com
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 4/8] 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 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);
/*
--
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