aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2012-04-29 18:25:10 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-04-29 18:25:10 -0400
commitd25425f8e0ed01fc0167c043aee7e619fc3f6ab2 (patch)
tree1c88b9de530a45bc79bf96d7acd045114cab480e
parente615391896064eb5a0c760d086b8e1c6ecfffeab (diff)
ext4: record the checksum algorithm in use in the superblock
Record the type of checksum algorithm we're using for metadata in the superblock, in case we ever want/need to change the algorithm. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/super.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e1fb1d5de58e..f489ffb3605d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -112,6 +112,16 @@ static struct file_system_type ext3_fs_type = {
112#define IS_EXT3_SB(sb) (0) 112#define IS_EXT3_SB(sb) (0)
113#endif 113#endif
114 114
115static int ext4_verify_csum_type(struct super_block *sb,
116 struct ext4_super_block *es)
117{
118 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
119 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
120 return 1;
121
122 return es->s_checksum_type == EXT4_CRC32C_CHKSUM;
123}
124
115void *ext4_kvmalloc(size_t size, gfp_t flags) 125void *ext4_kvmalloc(size_t size, gfp_t flags)
116{ 126{
117 void *ret; 127 void *ret;
@@ -3025,6 +3035,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3025 goto cantfind_ext4; 3035 goto cantfind_ext4;
3026 sbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written); 3036 sbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);
3027 3037
3038 /* Check for a known checksum algorithm */
3039 if (!ext4_verify_csum_type(sb, es)) {
3040 ext4_msg(sb, KERN_ERR, "VFS: Found ext4 filesystem with "
3041 "unknown checksum algorithm.");
3042 silent = 1;
3043 goto cantfind_ext4;
3044 }
3045
3028 /* Set defaults before we parse the mount options */ 3046 /* Set defaults before we parse the mount options */
3029 def_mount_opts = le32_to_cpu(es->s_default_mount_opts); 3047 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
3030 set_opt(sb, INIT_INODE_TABLE); 3048 set_opt(sb, INIT_INODE_TABLE);