diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-10-16 20:50:30 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:31 -0500 |
commit | ab552d54673f262d7f70014003d3928d29270f22 (patch) | |
tree | 86a966a56e0fc38ce0a1464b811b31ece1cf820c /fs | |
parent | e06c8227fd94ec181849ba206bf032be31c4295c (diff) |
ocfs2: Add the on-disk structures for metadata checksums.
Define struct ocfs2_block_check, an 8-byte structure containing a 32bit
crc32_le and a 16bit hamming code ecc. This will be used for metadata
checksums. Add the structure to free spaces in the various metadata
structures.
Add the OCFS2_FEATURE_INCOMPAT_META_ECC bit.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 359732e18e82..290fa26fba6e 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -149,6 +149,9 @@ | |||
149 | /* Support for extended attributes */ | 149 | /* Support for extended attributes */ |
150 | #define OCFS2_FEATURE_INCOMPAT_XATTR 0x0200 | 150 | #define OCFS2_FEATURE_INCOMPAT_XATTR 0x0200 |
151 | 151 | ||
152 | /* Metadata checksum and error correction */ | ||
153 | #define OCFS2_FEATURE_INCOMPAT_META_ECC 0x0800 | ||
154 | |||
152 | /* | 155 | /* |
153 | * backup superblock flag is used to indicate that this volume | 156 | * backup superblock flag is used to indicate that this volume |
154 | * has backup superblocks. | 157 | * has backup superblocks. |
@@ -427,6 +430,22 @@ static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = { | |||
427 | #define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super)) | 430 | #define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super)) |
428 | 431 | ||
429 | /* | 432 | /* |
433 | * Block checking structure. This is used in metadata to validate the | ||
434 | * contents. If OCFS2_FEATURE_INCOMPAT_META_ECC is not set, it is all | ||
435 | * zeros. | ||
436 | */ | ||
437 | struct ocfs2_block_check { | ||
438 | /*00*/ __le32 bc_crc32e; /* 802.3 Ethernet II CRC32 */ | ||
439 | __le16 bc_ecc; /* Single-error-correction parity vector. | ||
440 | This is a simple Hamming code dependant | ||
441 | on the blocksize. OCFS2's maximum | ||
442 | blocksize, 4K, requires 16 parity bits, | ||
443 | so we fit in __le16. */ | ||
444 | __le16 bc_reserved1; | ||
445 | /*08*/ | ||
446 | }; | ||
447 | |||
448 | /* | ||
430 | * On disk extent record for OCFS2 | 449 | * On disk extent record for OCFS2 |
431 | * It describes a range of clusters on disk. | 450 | * It describes a range of clusters on disk. |
432 | * | 451 | * |
@@ -513,7 +532,7 @@ struct ocfs2_truncate_log { | |||
513 | struct ocfs2_extent_block | 532 | struct ocfs2_extent_block |
514 | { | 533 | { |
515 | /*00*/ __u8 h_signature[8]; /* Signature for verification */ | 534 | /*00*/ __u8 h_signature[8]; /* Signature for verification */ |
516 | __le64 h_reserved1; | 535 | struct ocfs2_block_check h_check; /* Error checking */ |
517 | /*10*/ __le16 h_suballoc_slot; /* Slot suballocator this | 536 | /*10*/ __le16 h_suballoc_slot; /* Slot suballocator this |
518 | extent_header belongs to */ | 537 | extent_header belongs to */ |
519 | __le16 h_suballoc_bit; /* Bit offset in suballocator | 538 | __le16 h_suballoc_bit; /* Bit offset in suballocator |
@@ -683,7 +702,8 @@ struct ocfs2_dinode { | |||
683 | was set in i_flags */ | 702 | was set in i_flags */ |
684 | __le16 i_dyn_features; | 703 | __le16 i_dyn_features; |
685 | __le64 i_xattr_loc; | 704 | __le64 i_xattr_loc; |
686 | /*80*/ __le64 i_reserved2[7]; | 705 | /*80*/ struct ocfs2_block_check i_check; /* Error checking */ |
706 | /*88*/ __le64 i_reserved2[6]; | ||
687 | /*B8*/ union { | 707 | /*B8*/ union { |
688 | __le64 i_pad1; /* Generic way to refer to this | 708 | __le64 i_pad1; /* Generic way to refer to this |
689 | 64bit union */ | 709 | 64bit union */ |
@@ -750,7 +770,8 @@ struct ocfs2_group_desc | |||
750 | /*20*/ __le64 bg_parent_dinode; /* dinode which owns me, in | 770 | /*20*/ __le64 bg_parent_dinode; /* dinode which owns me, in |
751 | blocks */ | 771 | blocks */ |
752 | __le64 bg_blkno; /* Offset on disk, in blocks */ | 772 | __le64 bg_blkno; /* Offset on disk, in blocks */ |
753 | /*30*/ __le64 bg_reserved2[2]; | 773 | /*30*/ struct ocfs2_block_check bg_check; /* Error checking */ |
774 | __le64 bg_reserved2; | ||
754 | /*40*/ __u8 bg_bitmap[0]; | 775 | /*40*/ __u8 bg_bitmap[0]; |
755 | }; | 776 | }; |
756 | 777 | ||
@@ -793,7 +814,12 @@ struct ocfs2_xattr_header { | |||
793 | in this extent record, | 814 | in this extent record, |
794 | only valid in the first | 815 | only valid in the first |
795 | bucket. */ | 816 | bucket. */ |
796 | __le64 xh_csum; | 817 | struct ocfs2_block_check xh_check; /* Error checking |
818 | (Note, this is only | ||
819 | used for xattr | ||
820 | buckets. A block uses | ||
821 | xb_check and sets | ||
822 | this field to zero.) */ | ||
797 | struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */ | 823 | struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */ |
798 | }; | 824 | }; |
799 | 825 | ||
@@ -844,7 +870,7 @@ struct ocfs2_xattr_block { | |||
844 | block group */ | 870 | block group */ |
845 | __le32 xb_fs_generation; /* Must match super block */ | 871 | __le32 xb_fs_generation; /* Must match super block */ |
846 | /*10*/ __le64 xb_blkno; /* Offset on disk, in blocks */ | 872 | /*10*/ __le64 xb_blkno; /* Offset on disk, in blocks */ |
847 | __le64 xb_csum; | 873 | struct ocfs2_block_check xb_check; /* Error checking */ |
848 | /*20*/ __le16 xb_flags; /* Indicates whether this block contains | 874 | /*20*/ __le16 xb_flags; /* Indicates whether this block contains |
849 | real xattr or a xattr tree. */ | 875 | real xattr or a xattr tree. */ |
850 | __le16 xb_reserved0; | 876 | __le16 xb_reserved0; |
@@ -988,6 +1014,25 @@ struct ocfs2_local_disk_dqblk { | |||
988 | /*10*/ __le64 dqb_inodemod; /* Change in the amount of used inodes */ | 1014 | /*10*/ __le64 dqb_inodemod; /* Change in the amount of used inodes */ |
989 | }; | 1015 | }; |
990 | 1016 | ||
1017 | |||
1018 | /* | ||
1019 | * The quota trailer lives at the end of each quota block. | ||
1020 | */ | ||
1021 | |||
1022 | struct ocfs2_disk_dqtrailer { | ||
1023 | /*00*/ struct ocfs2_block_check dq_check; /* Error checking */ | ||
1024 | /*08*/ /* Cannot be larger than OCFS2_QBLK_RESERVED_SPACE */ | ||
1025 | }; | ||
1026 | |||
1027 | static inline struct ocfs2_disk_dqtrailer *ocfs2_block_dqtrailer(int blocksize, | ||
1028 | void *buf) | ||
1029 | { | ||
1030 | char *ptr = buf; | ||
1031 | ptr += blocksize - OCFS2_QBLK_RESERVED_SPACE; | ||
1032 | |||
1033 | return (struct ocfs2_disk_dqtrailer *)ptr; | ||
1034 | } | ||
1035 | |||
991 | #ifdef __KERNEL__ | 1036 | #ifdef __KERNEL__ |
992 | static inline int ocfs2_fast_symlink_chars(struct super_block *sb) | 1037 | static inline int ocfs2_fast_symlink_chars(struct super_block *sb) |
993 | { | 1038 | { |