diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-29 14:52:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-29 14:52:46 -0400 |
| commit | d4f03186c8986ffde34d06fe74a99aab08f7ee0b (patch) | |
| tree | 9887bc2405a4f9e17185aa1338dec3ae68246b16 /include/linux | |
| parent | ef13c8afa67518e1d173a6f3b95dd02559879421 (diff) | |
| parent | d80d448c6c5bdd32605b78a60fe8081d82d4da0f (diff) | |
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 bugfixes from Ted Ts'o:
"Ext4 bug fixes for 3.17, to provide better handling of memory
allocation failures, and to fix some journaling bugs involving
journal checksums and FALLOC_FL_ZERO_RANGE"
* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: fix same-dir rename when inline data directory overflows
jbd2: fix descriptor block size handling errors with journal_csum
jbd2: fix infinite loop when recovering corrupt journal blocks
ext4: update i_disksize coherently with block allocation on error path
ext4: fix transaction issues for ext4_fallocate and ext_zero_range
ext4: fix incorect journal credits reservation in ext4_zero_range
ext4: move i_size,i_disksize update routines to helper function
ext4: fix BUG_ON in mb_free_blocks()
ext4: propagate errors up to ext4_find_entry()'s callers
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/jbd2.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index d5b50a19463c..0dae71e9971c 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
| @@ -159,7 +159,11 @@ typedef struct journal_header_s | |||
| 159 | * journal_block_tag (in the descriptor). The other h_chksum* fields are | 159 | * journal_block_tag (in the descriptor). The other h_chksum* fields are |
| 160 | * not used. | 160 | * not used. |
| 161 | * | 161 | * |
| 162 | * Checksum v1 and v2 are mutually exclusive features. | 162 | * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses |
| 163 | * journal_block_tag3_t to store a full 32-bit checksum. Everything else | ||
| 164 | * is the same as v2. | ||
| 165 | * | ||
| 166 | * Checksum v1, v2, and v3 are mutually exclusive features. | ||
| 163 | */ | 167 | */ |
| 164 | struct commit_header { | 168 | struct commit_header { |
| 165 | __be32 h_magic; | 169 | __be32 h_magic; |
| @@ -179,6 +183,14 @@ struct commit_header { | |||
| 179 | * raw struct shouldn't be used for pointer math or sizeof() - use | 183 | * raw struct shouldn't be used for pointer math or sizeof() - use |
| 180 | * journal_tag_bytes(journal) instead to compute this. | 184 | * journal_tag_bytes(journal) instead to compute this. |
| 181 | */ | 185 | */ |
| 186 | typedef struct journal_block_tag3_s | ||
| 187 | { | ||
| 188 | __be32 t_blocknr; /* The on-disk block number */ | ||
| 189 | __be32 t_flags; /* See below */ | ||
| 190 | __be32 t_blocknr_high; /* most-significant high 32bits. */ | ||
| 191 | __be32 t_checksum; /* crc32c(uuid+seq+block) */ | ||
| 192 | } journal_block_tag3_t; | ||
| 193 | |||
| 182 | typedef struct journal_block_tag_s | 194 | typedef struct journal_block_tag_s |
| 183 | { | 195 | { |
| 184 | __be32 t_blocknr; /* The on-disk block number */ | 196 | __be32 t_blocknr; /* The on-disk block number */ |
| @@ -187,9 +199,6 @@ typedef struct journal_block_tag_s | |||
| 187 | __be32 t_blocknr_high; /* most-significant high 32bits. */ | 199 | __be32 t_blocknr_high; /* most-significant high 32bits. */ |
| 188 | } journal_block_tag_t; | 200 | } journal_block_tag_t; |
| 189 | 201 | ||
| 190 | #define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) | ||
| 191 | #define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t)) | ||
| 192 | |||
| 193 | /* Tail of descriptor block, for checksumming */ | 202 | /* Tail of descriptor block, for checksumming */ |
| 194 | struct jbd2_journal_block_tail { | 203 | struct jbd2_journal_block_tail { |
| 195 | __be32 t_checksum; /* crc32c(uuid+descr_block) */ | 204 | __be32 t_checksum; /* crc32c(uuid+descr_block) */ |
| @@ -284,6 +293,7 @@ typedef struct journal_superblock_s | |||
| 284 | #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 | 293 | #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 |
| 285 | #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 | 294 | #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 |
| 286 | #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 | 295 | #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 |
| 296 | #define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010 | ||
| 287 | 297 | ||
| 288 | /* Features known to this kernel version: */ | 298 | /* Features known to this kernel version: */ |
| 289 | #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM | 299 | #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM |
| @@ -291,7 +301,8 @@ typedef struct journal_superblock_s | |||
| 291 | #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ | 301 | #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ |
| 292 | JBD2_FEATURE_INCOMPAT_64BIT | \ | 302 | JBD2_FEATURE_INCOMPAT_64BIT | \ |
| 293 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ | 303 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ |
| 294 | JBD2_FEATURE_INCOMPAT_CSUM_V2) | 304 | JBD2_FEATURE_INCOMPAT_CSUM_V2 | \ |
| 305 | JBD2_FEATURE_INCOMPAT_CSUM_V3) | ||
| 295 | 306 | ||
| 296 | #ifdef __KERNEL__ | 307 | #ifdef __KERNEL__ |
| 297 | 308 | ||
| @@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y) | |||
| 1296 | extern int jbd2_journal_blocks_per_page(struct inode *inode); | 1307 | extern int jbd2_journal_blocks_per_page(struct inode *inode); |
| 1297 | extern size_t journal_tag_bytes(journal_t *journal); | 1308 | extern size_t journal_tag_bytes(journal_t *journal); |
| 1298 | 1309 | ||
| 1310 | static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) | ||
| 1311 | { | ||
| 1312 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) || | ||
| 1313 | JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | ||
| 1314 | return 1; | ||
| 1315 | |||
| 1316 | return 0; | ||
| 1317 | } | ||
| 1318 | |||
| 1299 | /* | 1319 | /* |
| 1300 | * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for | 1320 | * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for |
| 1301 | * transaction control blocks. | 1321 | * transaction control blocks. |
