aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2012-04-29 18:29:10 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-04-29 18:29:10 -0400
commita9c4731780544d52b243bf46e4dd635c67fa9f84 (patch)
treedc735f2f59fa2107e8fed8e3d26f259557e34008 /fs/ext4/ext4.h
parent0441984a3398970ab4820410b9cf4ff85bf3a6b0 (diff)
ext4: calculate and verify superblock checksum
Calculate and verify the superblock checksum. Since the UUID and block group number are embedded in each copy of the superblock, we need only checksum the entire block. Refactor some of the code to eliminate open-coding of the checksum update call. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f19192bde094..5adbce519b66 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1280,6 +1280,9 @@ struct ext4_sb_info {
1280 1280
1281 /* Reference to checksum algorithm driver via cryptoapi */ 1281 /* Reference to checksum algorithm driver via cryptoapi */
1282 struct crypto_shash *s_chksum_driver; 1282 struct crypto_shash *s_chksum_driver;
1283
1284 /* Precomputed FS UUID checksum for seeding other checksums */
1285 __u32 s_csum_seed;
1283}; 1286};
1284 1287
1285static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) 1288static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
@@ -2004,6 +2007,10 @@ extern int ext4_group_extend(struct super_block *sb,
2004extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count); 2007extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count);
2005 2008
2006/* super.c */ 2009/* super.c */
2010extern int ext4_superblock_csum_verify(struct super_block *sb,
2011 struct ext4_super_block *es);
2012extern void ext4_superblock_csum_set(struct super_block *sb,
2013 struct ext4_super_block *es);
2007extern void *ext4_kvmalloc(size_t size, gfp_t flags); 2014extern void *ext4_kvmalloc(size_t size, gfp_t flags);
2008extern void *ext4_kvzalloc(size_t size, gfp_t flags); 2015extern void *ext4_kvzalloc(size_t size, gfp_t flags);
2009extern void ext4_kvfree(void *ptr); 2016extern void ext4_kvfree(void *ptr);
@@ -2279,6 +2286,9 @@ static inline void ext4_unlock_group(struct super_block *sb,
2279 2286
2280static inline void ext4_mark_super_dirty(struct super_block *sb) 2287static inline void ext4_mark_super_dirty(struct super_block *sb)
2281{ 2288{
2289 struct ext4_super_block *es = EXT4_SB(sb)->s_es;
2290
2291 ext4_superblock_csum_set(sb, es);
2282 if (EXT4_SB(sb)->s_journal == NULL) 2292 if (EXT4_SB(sb)->s_journal == NULL)
2283 sb->s_dirt =1; 2293 sb->s_dirt =1;
2284} 2294}