diff options
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 134 |
1 files changed, 119 insertions, 15 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 0e01e90add8..cfc4e01b3c8 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | #include <linux/blockgroup_lock.h> | 30 | #include <linux/blockgroup_lock.h> |
31 | #include <linux/percpu_counter.h> | 31 | #include <linux/percpu_counter.h> |
32 | #include <crypto/hash.h> | ||
32 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
33 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
34 | #endif | 35 | #endif |
@@ -298,7 +299,9 @@ struct ext4_group_desc | |||
298 | __le16 bg_free_inodes_count_lo;/* Free inodes count */ | 299 | __le16 bg_free_inodes_count_lo;/* Free inodes count */ |
299 | __le16 bg_used_dirs_count_lo; /* Directories count */ | 300 | __le16 bg_used_dirs_count_lo; /* Directories count */ |
300 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ | 301 | __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ |
301 | __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */ | 302 | __le32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ |
303 | __le16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bbitmap) LE */ | ||
304 | __le16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+ibitmap) LE */ | ||
302 | __le16 bg_itable_unused_lo; /* Unused inodes count */ | 305 | __le16 bg_itable_unused_lo; /* Unused inodes count */ |
303 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ | 306 | __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ |
304 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ | 307 | __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ |
@@ -308,9 +311,19 @@ struct ext4_group_desc | |||
308 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ | 311 | __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */ |
309 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ | 312 | __le16 bg_used_dirs_count_hi; /* Directories count MSB */ |
310 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ | 313 | __le16 bg_itable_unused_hi; /* Unused inodes count MSB */ |
311 | __u32 bg_reserved2[3]; | 314 | __le32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */ |
315 | __le16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bbitmap) BE */ | ||
316 | __le16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+ibitmap) BE */ | ||
317 | __u32 bg_reserved; | ||
312 | }; | 318 | }; |
313 | 319 | ||
320 | #define EXT4_BG_INODE_BITMAP_CSUM_HI_END \ | ||
321 | (offsetof(struct ext4_group_desc, bg_inode_bitmap_csum_hi) + \ | ||
322 | sizeof(__le16)) | ||
323 | #define EXT4_BG_BLOCK_BITMAP_CSUM_HI_END \ | ||
324 | (offsetof(struct ext4_group_desc, bg_block_bitmap_csum_hi) + \ | ||
325 | sizeof(__le16)) | ||
326 | |||
314 | /* | 327 | /* |
315 | * Structure of a flex block group info | 328 | * Structure of a flex block group info |
316 | */ | 329 | */ |
@@ -650,7 +663,8 @@ struct ext4_inode { | |||
650 | __le16 l_i_file_acl_high; | 663 | __le16 l_i_file_acl_high; |
651 | __le16 l_i_uid_high; /* these 2 fields */ | 664 | __le16 l_i_uid_high; /* these 2 fields */ |
652 | __le16 l_i_gid_high; /* were reserved2[0] */ | 665 | __le16 l_i_gid_high; /* were reserved2[0] */ |
653 | __u32 l_i_reserved2; | 666 | __le16 l_i_checksum_lo;/* crc32c(uuid+inum+inode) LE */ |
667 | __le16 l_i_reserved; | ||
654 | } linux2; | 668 | } linux2; |
655 | struct { | 669 | struct { |
656 | __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ | 670 | __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ |
@@ -666,7 +680,7 @@ struct ext4_inode { | |||
666 | } masix2; | 680 | } masix2; |
667 | } osd2; /* OS dependent 2 */ | 681 | } osd2; /* OS dependent 2 */ |
668 | __le16 i_extra_isize; | 682 | __le16 i_extra_isize; |
669 | __le16 i_pad1; | 683 | __le16 i_checksum_hi; /* crc32c(uuid+inum+inode) BE */ |
670 | __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ | 684 | __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ |
671 | __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */ | 685 | __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */ |
672 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ | 686 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ |
@@ -768,7 +782,7 @@ do { \ | |||
768 | #define i_gid_low i_gid | 782 | #define i_gid_low i_gid |
769 | #define i_uid_high osd2.linux2.l_i_uid_high | 783 | #define i_uid_high osd2.linux2.l_i_uid_high |
770 | #define i_gid_high osd2.linux2.l_i_gid_high | 784 | #define i_gid_high osd2.linux2.l_i_gid_high |
771 | #define i_reserved2 osd2.linux2.l_i_reserved2 | 785 | #define i_checksum_lo osd2.linux2.l_i_checksum_lo |
772 | 786 | ||
773 | #elif defined(__GNU__) | 787 | #elif defined(__GNU__) |
774 | 788 | ||
@@ -908,6 +922,9 @@ struct ext4_inode_info { | |||
908 | */ | 922 | */ |
909 | tid_t i_sync_tid; | 923 | tid_t i_sync_tid; |
910 | tid_t i_datasync_tid; | 924 | tid_t i_datasync_tid; |
925 | |||
926 | /* Precomputed uuid+inum+igen checksum for seeding inode checksums */ | ||
927 | __u32 i_csum_seed; | ||
911 | }; | 928 | }; |
912 | 929 | ||
913 | /* | 930 | /* |
@@ -1001,6 +1018,9 @@ extern void ext4_set_bits(void *bm, int cur, int len); | |||
1001 | #define EXT4_ERRORS_PANIC 3 /* Panic */ | 1018 | #define EXT4_ERRORS_PANIC 3 /* Panic */ |
1002 | #define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE | 1019 | #define EXT4_ERRORS_DEFAULT EXT4_ERRORS_CONTINUE |
1003 | 1020 | ||
1021 | /* Metadata checksum algorithm codes */ | ||
1022 | #define EXT4_CRC32C_CHKSUM 1 | ||
1023 | |||
1004 | /* | 1024 | /* |
1005 | * Structure of the super block | 1025 | * Structure of the super block |
1006 | */ | 1026 | */ |
@@ -1087,7 +1107,7 @@ struct ext4_super_block { | |||
1087 | __le64 s_mmp_block; /* Block for multi-mount protection */ | 1107 | __le64 s_mmp_block; /* Block for multi-mount protection */ |
1088 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ | 1108 | __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ |
1089 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ | 1109 | __u8 s_log_groups_per_flex; /* FLEX_BG group size */ |
1090 | __u8 s_reserved_char_pad; | 1110 | __u8 s_checksum_type; /* metadata checksum algorithm used */ |
1091 | __le16 s_reserved_pad; | 1111 | __le16 s_reserved_pad; |
1092 | __le64 s_kbytes_written; /* nr of lifetime kilobytes written */ | 1112 | __le64 s_kbytes_written; /* nr of lifetime kilobytes written */ |
1093 | __le32 s_snapshot_inum; /* Inode number of active snapshot */ | 1113 | __le32 s_snapshot_inum; /* Inode number of active snapshot */ |
@@ -1113,7 +1133,8 @@ struct ext4_super_block { | |||
1113 | __le32 s_usr_quota_inum; /* inode for tracking user quota */ | 1133 | __le32 s_usr_quota_inum; /* inode for tracking user quota */ |
1114 | __le32 s_grp_quota_inum; /* inode for tracking group quota */ | 1134 | __le32 s_grp_quota_inum; /* inode for tracking group quota */ |
1115 | __le32 s_overhead_clusters; /* overhead blocks/clusters in fs */ | 1135 | __le32 s_overhead_clusters; /* overhead blocks/clusters in fs */ |
1116 | __le32 s_reserved[109]; /* Padding to the end of the block */ | 1136 | __le32 s_reserved[108]; /* Padding to the end of the block */ |
1137 | __le32 s_checksum; /* crc32c(superblock) */ | ||
1117 | }; | 1138 | }; |
1118 | 1139 | ||
1119 | #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) | 1140 | #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) |
@@ -1153,8 +1174,8 @@ struct ext4_sb_info { | |||
1153 | unsigned int s_mount_flags; | 1174 | unsigned int s_mount_flags; |
1154 | unsigned int s_def_mount_opt; | 1175 | unsigned int s_def_mount_opt; |
1155 | ext4_fsblk_t s_sb_block; | 1176 | ext4_fsblk_t s_sb_block; |
1156 | uid_t s_resuid; | 1177 | kuid_t s_resuid; |
1157 | gid_t s_resgid; | 1178 | kgid_t s_resgid; |
1158 | unsigned short s_mount_state; | 1179 | unsigned short s_mount_state; |
1159 | unsigned short s_pad; | 1180 | unsigned short s_pad; |
1160 | int s_addr_per_block_bits; | 1181 | int s_addr_per_block_bits; |
@@ -1176,6 +1197,7 @@ struct ext4_sb_info { | |||
1176 | struct proc_dir_entry *s_proc; | 1197 | struct proc_dir_entry *s_proc; |
1177 | struct kobject s_kobj; | 1198 | struct kobject s_kobj; |
1178 | struct completion s_kobj_unregister; | 1199 | struct completion s_kobj_unregister; |
1200 | struct super_block *s_sb; | ||
1179 | 1201 | ||
1180 | /* Journaling */ | 1202 | /* Journaling */ |
1181 | struct journal_s *s_journal; | 1203 | struct journal_s *s_journal; |
@@ -1266,6 +1288,12 @@ struct ext4_sb_info { | |||
1266 | 1288 | ||
1267 | /* record the last minlen when FITRIM is called. */ | 1289 | /* record the last minlen when FITRIM is called. */ |
1268 | atomic_t s_last_trim_minblks; | 1290 | atomic_t s_last_trim_minblks; |
1291 | |||
1292 | /* Reference to checksum algorithm driver via cryptoapi */ | ||
1293 | struct crypto_shash *s_chksum_driver; | ||
1294 | |||
1295 | /* Precomputed FS UUID checksum for seeding other checksums */ | ||
1296 | __u32 s_csum_seed; | ||
1269 | }; | 1297 | }; |
1270 | 1298 | ||
1271 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 1299 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
@@ -1414,6 +1442,12 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | |||
1414 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 | 1442 | #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 |
1415 | #define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 | 1443 | #define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 |
1416 | #define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 | 1444 | #define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 |
1445 | /* | ||
1446 | * METADATA_CSUM also enables group descriptor checksums (GDT_CSUM). When | ||
1447 | * METADATA_CSUM is set, group descriptor checksums use the same algorithm as | ||
1448 | * all other data structures' checksums. However, the METADATA_CSUM and | ||
1449 | * GDT_CSUM bits are mutually exclusive. | ||
1450 | */ | ||
1417 | #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 | 1451 | #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 |
1418 | 1452 | ||
1419 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 | 1453 | #define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 |
@@ -1461,7 +1495,8 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) | |||
1461 | EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ | 1495 | EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ |
1462 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\ | 1496 | EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\ |
1463 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\ | 1497 | EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\ |
1464 | EXT4_FEATURE_RO_COMPAT_BIGALLOC) | 1498 | EXT4_FEATURE_RO_COMPAT_BIGALLOC |\ |
1499 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) | ||
1465 | 1500 | ||
1466 | /* | 1501 | /* |
1467 | * Default values for user and/or group using reserved blocks | 1502 | * Default values for user and/or group using reserved blocks |
@@ -1527,6 +1562,18 @@ struct ext4_dir_entry_2 { | |||
1527 | }; | 1562 | }; |
1528 | 1563 | ||
1529 | /* | 1564 | /* |
1565 | * This is a bogus directory entry at the end of each leaf block that | ||
1566 | * records checksums. | ||
1567 | */ | ||
1568 | struct ext4_dir_entry_tail { | ||
1569 | __le32 det_reserved_zero1; /* Pretend to be unused */ | ||
1570 | __le16 det_rec_len; /* 12 */ | ||
1571 | __u8 det_reserved_zero2; /* Zero name length */ | ||
1572 | __u8 det_reserved_ft; /* 0xDE, fake file type */ | ||
1573 | __le32 det_checksum; /* crc32c(uuid+inum+dirblock) */ | ||
1574 | }; | ||
1575 | |||
1576 | /* | ||
1530 | * Ext4 directory file types. Only the low 3 bits are used. The | 1577 | * Ext4 directory file types. Only the low 3 bits are used. The |
1531 | * other bits are reserved for now. | 1578 | * other bits are reserved for now. |
1532 | */ | 1579 | */ |
@@ -1541,6 +1588,8 @@ struct ext4_dir_entry_2 { | |||
1541 | 1588 | ||
1542 | #define EXT4_FT_MAX 8 | 1589 | #define EXT4_FT_MAX 8 |
1543 | 1590 | ||
1591 | #define EXT4_FT_DIR_CSUM 0xDE | ||
1592 | |||
1544 | /* | 1593 | /* |
1545 | * EXT4_DIR_PAD defines the directory entries boundaries | 1594 | * EXT4_DIR_PAD defines the directory entries boundaries |
1546 | * | 1595 | * |
@@ -1609,6 +1658,25 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize) | |||
1609 | #define DX_HASH_HALF_MD4_UNSIGNED 4 | 1658 | #define DX_HASH_HALF_MD4_UNSIGNED 4 |
1610 | #define DX_HASH_TEA_UNSIGNED 5 | 1659 | #define DX_HASH_TEA_UNSIGNED 5 |
1611 | 1660 | ||
1661 | static inline u32 ext4_chksum(struct ext4_sb_info *sbi, u32 crc, | ||
1662 | const void *address, unsigned int length) | ||
1663 | { | ||
1664 | struct { | ||
1665 | struct shash_desc shash; | ||
1666 | char ctx[crypto_shash_descsize(sbi->s_chksum_driver)]; | ||
1667 | } desc; | ||
1668 | int err; | ||
1669 | |||
1670 | desc.shash.tfm = sbi->s_chksum_driver; | ||
1671 | desc.shash.flags = 0; | ||
1672 | *(u32 *)desc.ctx = crc; | ||
1673 | |||
1674 | err = crypto_shash_update(&desc.shash, address, length); | ||
1675 | BUG_ON(err); | ||
1676 | |||
1677 | return *(u32 *)desc.ctx; | ||
1678 | } | ||
1679 | |||
1612 | #ifdef __KERNEL__ | 1680 | #ifdef __KERNEL__ |
1613 | 1681 | ||
1614 | /* hash info structure used by the directory hash */ | 1682 | /* hash info structure used by the directory hash */ |
@@ -1741,7 +1809,8 @@ struct mmp_struct { | |||
1741 | __le16 mmp_check_interval; | 1809 | __le16 mmp_check_interval; |
1742 | 1810 | ||
1743 | __le16 mmp_pad1; | 1811 | __le16 mmp_pad1; |
1744 | __le32 mmp_pad2[227]; | 1812 | __le32 mmp_pad2[226]; |
1813 | __le32 mmp_checksum; /* crc32c(uuid+mmp_block) */ | ||
1745 | }; | 1814 | }; |
1746 | 1815 | ||
1747 | /* arguments passed to the mmp thread */ | 1816 | /* arguments passed to the mmp thread */ |
@@ -1784,8 +1853,24 @@ struct mmpd_data { | |||
1784 | 1853 | ||
1785 | /* bitmap.c */ | 1854 | /* bitmap.c */ |
1786 | extern unsigned int ext4_count_free(struct buffer_head *, unsigned); | 1855 | extern unsigned int ext4_count_free(struct buffer_head *, unsigned); |
1856 | void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | ||
1857 | struct ext4_group_desc *gdp, | ||
1858 | struct buffer_head *bh, int sz); | ||
1859 | int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | ||
1860 | struct ext4_group_desc *gdp, | ||
1861 | struct buffer_head *bh, int sz); | ||
1862 | void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | ||
1863 | struct ext4_group_desc *gdp, | ||
1864 | struct buffer_head *bh, int sz); | ||
1865 | int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | ||
1866 | struct ext4_group_desc *gdp, | ||
1867 | struct buffer_head *bh, int sz); | ||
1787 | 1868 | ||
1788 | /* balloc.c */ | 1869 | /* balloc.c */ |
1870 | extern void ext4_validate_block_bitmap(struct super_block *sb, | ||
1871 | struct ext4_group_desc *desc, | ||
1872 | unsigned int block_group, | ||
1873 | struct buffer_head *bh); | ||
1789 | extern unsigned int ext4_block_group(struct super_block *sb, | 1874 | extern unsigned int ext4_block_group(struct super_block *sb, |
1790 | ext4_fsblk_t blocknr); | 1875 | ext4_fsblk_t blocknr); |
1791 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, | 1876 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, |
@@ -1864,7 +1949,7 @@ extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate); | |||
1864 | /* mballoc.c */ | 1949 | /* mballoc.c */ |
1865 | extern long ext4_mb_stats; | 1950 | extern long ext4_mb_stats; |
1866 | extern long ext4_mb_max_to_scan; | 1951 | extern long ext4_mb_max_to_scan; |
1867 | extern int ext4_mb_init(struct super_block *, int); | 1952 | extern int ext4_mb_init(struct super_block *); |
1868 | extern int ext4_mb_release(struct super_block *); | 1953 | extern int ext4_mb_release(struct super_block *); |
1869 | extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, | 1954 | extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, |
1870 | struct ext4_allocation_request *, int *); | 1955 | struct ext4_allocation_request *, int *); |
@@ -1936,6 +2021,8 @@ extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); | |||
1936 | extern int ext4_ext_migrate(struct inode *); | 2021 | extern int ext4_ext_migrate(struct inode *); |
1937 | 2022 | ||
1938 | /* namei.c */ | 2023 | /* namei.c */ |
2024 | extern int ext4_dirent_csum_verify(struct inode *inode, | ||
2025 | struct ext4_dir_entry *dirent); | ||
1939 | extern int ext4_orphan_add(handle_t *, struct inode *); | 2026 | extern int ext4_orphan_add(handle_t *, struct inode *); |
1940 | extern int ext4_orphan_del(handle_t *, struct inode *); | 2027 | extern int ext4_orphan_del(handle_t *, struct inode *); |
1941 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | 2028 | extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, |
@@ -1950,6 +2037,10 @@ extern int ext4_group_extend(struct super_block *sb, | |||
1950 | extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count); | 2037 | extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count); |
1951 | 2038 | ||
1952 | /* super.c */ | 2039 | /* super.c */ |
2040 | extern int ext4_superblock_csum_verify(struct super_block *sb, | ||
2041 | struct ext4_super_block *es); | ||
2042 | extern void ext4_superblock_csum_set(struct super_block *sb, | ||
2043 | struct ext4_super_block *es); | ||
1953 | extern void *ext4_kvmalloc(size_t size, gfp_t flags); | 2044 | extern void *ext4_kvmalloc(size_t size, gfp_t flags); |
1954 | extern void *ext4_kvzalloc(size_t size, gfp_t flags); | 2045 | extern void *ext4_kvzalloc(size_t size, gfp_t flags); |
1955 | extern void ext4_kvfree(void *ptr); | 2046 | extern void ext4_kvfree(void *ptr); |
@@ -2025,10 +2116,17 @@ extern void ext4_used_dirs_set(struct super_block *sb, | |||
2025 | struct ext4_group_desc *bg, __u32 count); | 2116 | struct ext4_group_desc *bg, __u32 count); |
2026 | extern void ext4_itable_unused_set(struct super_block *sb, | 2117 | extern void ext4_itable_unused_set(struct super_block *sb, |
2027 | struct ext4_group_desc *bg, __u32 count); | 2118 | struct ext4_group_desc *bg, __u32 count); |
2028 | extern __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 group, | 2119 | extern int ext4_group_desc_csum_verify(struct super_block *sb, __u32 group, |
2029 | struct ext4_group_desc *gdp); | ||
2030 | extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group, | ||
2031 | struct ext4_group_desc *gdp); | 2120 | struct ext4_group_desc *gdp); |
2121 | extern void ext4_group_desc_csum_set(struct super_block *sb, __u32 group, | ||
2122 | struct ext4_group_desc *gdp); | ||
2123 | |||
2124 | static inline int ext4_has_group_desc_csum(struct super_block *sb) | ||
2125 | { | ||
2126 | return EXT4_HAS_RO_COMPAT_FEATURE(sb, | ||
2127 | EXT4_FEATURE_RO_COMPAT_GDT_CSUM | | ||
2128 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM); | ||
2129 | } | ||
2032 | 2130 | ||
2033 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) | 2131 | static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) |
2034 | { | 2132 | { |
@@ -2225,6 +2323,9 @@ static inline void ext4_unlock_group(struct super_block *sb, | |||
2225 | 2323 | ||
2226 | static inline void ext4_mark_super_dirty(struct super_block *sb) | 2324 | static inline void ext4_mark_super_dirty(struct super_block *sb) |
2227 | { | 2325 | { |
2326 | struct ext4_super_block *es = EXT4_SB(sb)->s_es; | ||
2327 | |||
2328 | ext4_superblock_csum_set(sb, es); | ||
2228 | if (EXT4_SB(sb)->s_journal == NULL) | 2329 | if (EXT4_SB(sb)->s_journal == NULL) |
2229 | sb->s_dirt =1; | 2330 | sb->s_dirt =1; |
2230 | } | 2331 | } |
@@ -2314,6 +2415,9 @@ extern int ext4_bio_write_page(struct ext4_io_submit *io, | |||
2314 | 2415 | ||
2315 | /* mmp.c */ | 2416 | /* mmp.c */ |
2316 | extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t); | 2417 | extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t); |
2418 | extern void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp); | ||
2419 | extern int ext4_mmp_csum_verify(struct super_block *sb, | ||
2420 | struct mmp_struct *mmp); | ||
2317 | 2421 | ||
2318 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ | 2422 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ |
2319 | enum ext4_state_bits { | 2423 | enum ext4_state_bits { |