Lines Matching +full:fast +full:- +full:read

1 .. SPDX-License-Identifier: GPL-2.0
4 --------------
10 “important” data writes on-disk as quickly as possible. Once the important
15 read-write-erases) before erasing the commit record. Should the system
31 In case of ``data=ordered`` mode, Ext4 also supports fast commits which
33 mode works by logging metadata blocks to the journal. In fast commit
35 affected metadata in fast commit space that is shared with JBD2.
36 Once the fast commit area fills in or if fast commit is not possible
38 A full commit invalidates all the fast commits that happened before
39 it and thus it makes the fast commit area empty for further fast
48 All fields in jbd2 are written to disk in big-endian order. This is the
61 .. list-table::
63 :header-rows: 1
65 * - Superblock
66 - descriptor_block (data_blocks or revocation_block) [more data or
68 - [more transactions...]
69 * -
70 - One transaction
71 -
89 .. list-table::
91 :header-rows: 1
93 * - 1024 bytes of padding
94 - ext4 Superblock
95 - Journal Superblock
96 - descriptor_block (data_blocks or revocation_block) [more data or
98 - [more transactions...]
99 * -
100 -
101 -
102 - One transaction
103 -
108 Every block in the journal starts with a common 12-byte header
111 .. list-table::
113 :header-rows: 1
115 * - Offset
116 - Type
117 - Name
118 - Description
119 * - 0x0
120 - __be32
121 - h_magic
122 - jbd2 magic number, 0xC03B3998.
123 * - 0x4
124 - __be32
125 - h_blocktype
126 - Description of what this block contains. See the jbd2_blocktype_ table
128 * - 0x8
129 - __be32
130 - h_sequence
131 - The transaction ID that goes with this block.
137 .. list-table::
139 :header-rows: 1
141 * - Value
142 - Description
143 * - 1
144 - Descriptor. This block precedes a series of data blocks that were
146 * - 2
147 - Block commit record. This block signifies the completion of a
149 * - 3
150 - Journal superblock, v1.
151 * - 4
152 - Journal superblock, v2.
153 * - 5
154 - Block revocation records. This speeds up recovery by enabling the
167 .. list-table::
169 :header-rows: 1
171 * - Offset
172 - Type
173 - Name
174 - Description
175 * -
176 -
177 -
178 - Static information describing the journal.
179 * - 0x0
180 - journal_header_t (12 bytes)
181 - s_header
182 - Common header identifying this as a superblock.
183 * - 0xC
184 - __be32
185 - s_blocksize
186 - Journal device block size.
187 * - 0x10
188 - __be32
189 - s_maxlen
190 - Total number of blocks in this journal.
191 * - 0x14
192 - __be32
193 - s_first
194 - First block of log information.
195 * -
196 -
197 -
198 - Dynamic information describing the current state of the log.
199 * - 0x18
200 - __be32
201 - s_sequence
202 - First commit ID expected in log.
203 * - 0x1C
204 - __be32
205 - s_start
206 - Block number of the start of log. Contrary to the comments, this field
208 * - 0x20
209 - __be32
210 - s_errno
211 - Error value, as set by jbd2_journal_abort().
212 * -
213 -
214 -
215 - The remaining fields are only valid in a v2 superblock.
216 * - 0x24
217 - __be32
218 - s_feature_compat;
219 - Compatible feature set. See the table jbd2_compat_ below.
220 * - 0x28
221 - __be32
222 - s_feature_incompat
223 - Incompatible feature set. See the table jbd2_incompat_ below.
224 * - 0x2C
225 - __be32
226 - s_feature_ro_compat
227 - Read-only compatible feature set. There aren't any of these currently.
228 * - 0x30
229 - __u8
230 - s_uuid[16]
231 - 128-bit uuid for journal. This is compared against the copy in the ext4
233 * - 0x40
234 - __be32
235 - s_nr_users
236 - Number of file systems sharing this journal.
237 * - 0x44
238 - __be32
239 - s_dynsuper
240 - Location of dynamic super block copy. (Not used?)
241 * - 0x48
242 - __be32
243 - s_max_transaction
244 - Limit of journal blocks per transaction. (Not used?)
245 * - 0x4C
246 - __be32
247 - s_max_trans_data
248 - Limit of data blocks per transaction. (Not used?)
249 * - 0x50
250 - __u8
251 - s_checksum_type
252 - Checksum algorithm used for the journal. See jbd2_checksum_type_ for
254 * - 0x51
255 - __u8[3]
256 - s_padding2
257 -
258 * - 0x54
259 - __be32
260 - s_num_fc_blocks
261 - Number of fast commit blocks in the journal.
262 * - 0x58
263 - __u32
264 - s_padding[42]
265 -
266 * - 0xFC
267 - __be32
268 - s_checksum
269 - Checksum of the entire superblock, with this field set to zero.
270 * - 0x100
271 - __u8
272 - s_users[16*48]
273 - ids of all file systems sharing the log. e2fsprogs/Linux don't allow
281 .. list-table::
283 :header-rows: 1
285 * - Value
286 - Description
287 * - 0x1
288 - Journal maintains checksums on the data blocks.
295 .. list-table::
297 :header-rows: 1
299 * - Value
300 - Description
301 * - 0x1
302 - Journal has block revocation records. (JBD2_FEATURE_INCOMPAT_REVOKE)
303 * - 0x2
304 - Journal can deal with 64-bit block numbers.
306 * - 0x4
307 - Journal commits asynchronously. (JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
308 * - 0x8
309 - This journal uses v2 of the checksum on-disk format. Each journal
313 * - 0x10
314 - This journal uses v3 of the checksum on-disk format. This is the same as
317 * - 0x20
318 - Journal has fast commit blocks. (JBD2_FEATURE_INCOMPAT_FAST_COMMIT)
325 .. list-table::
327 :header-rows: 1
329 * - Value
330 - Description
331 * - 1
332 - CRC32
333 * - 2
334 - MD5
335 * - 3
336 - SHA1
337 * - 4
338 - CRC32C
345 journal. Descriptor blocks are open-coded instead of being completely
349 .. list-table::
351 :header-rows: 1
353 * - Offset
354 - Type
355 - Name
356 - Descriptor
357 * - 0x0
358 - journal_header_t
359 - (open coded)
360 - Common block header.
361 * - 0xC
362 - struct journal_block_tag_s
363 - open coded array[]
364 - Enough tags either to fill up the block or to describe all the data
374 .. list-table::
376 :header-rows: 1
378 * - Offset
379 - Type
380 - Name
381 - Descriptor
382 * - 0x0
383 - __be32
384 - t_blocknr
385 - Lower 32-bits of the location of where the corresponding data block
387 * - 0x4
388 - __be32
389 - t_flags
390 - Flags that go with the descriptor. See the table jbd2_tag_flags_ for
392 * - 0x8
393 - __be32
394 - t_blocknr_high
395 - Upper 32-bits of the location of where the corresponding data block
398 * - 0xC
399 - __be32
400 - t_checksum
401 - Checksum of the journal UUID, the sequence number, and the data block.
402 * -
403 -
404 -
405 - This field appears to be open coded. It always comes at the end of the
408 * - 0x8 or 0xC
409 - char
410 - uuid[16]
411 - A UUID to go with this tag. This field appears to be copied from the
419 .. list-table::
421 :header-rows: 1
423 * - Value
424 - Description
425 * - 0x1
426 - On-disk block is escaped. The first four bytes of the data block just
428 * - 0x2
429 - This block has the same UUID as previous, therefore the UUID field is
431 * - 0x4
432 - The data block was deleted by the transaction. (Not used?)
433 * - 0x8
434 - This is the last tag in this descriptor block.
440 .. list-table::
442 :header-rows: 1
444 * - Offset
445 - Type
446 - Name
447 - Descriptor
448 * - 0x0
449 - __be32
450 - t_blocknr
451 - Lower 32-bits of the location of where the corresponding data block
453 * - 0x4
454 - __be16
455 - t_checksum
456 - Checksum of the journal UUID, the sequence number, and the data block.
458 * - 0x6
459 - __be16
460 - t_flags
461 - Flags that go with the descriptor. See the table jbd2_tag_flags_ for
463 * -
464 -
465 -
466 - This next field is only present if the super block indicates support for
467 64-bit block numbers.
468 * - 0x8
469 - __be32
470 - t_blocknr_high
471 - Upper 32-bits of the location of where the corresponding data block
473 * -
474 -
475 -
476 - This field appears to be open coded. It always comes at the end of the
479 * - 0x8 or 0xC
480 - char
481 - uuid[16]
482 - A UUID to go with this tag. This field appears to be copied from the
490 .. list-table::
492 :header-rows: 1
494 * - Offset
495 - Type
496 - Name
497 - Descriptor
498 * - 0x0
499 - __be32
500 - t_checksum
501 - Checksum of the journal UUID + the descriptor block, with this field set
519 block is freed and re-allocated as a file data block; in this case, a
532 .. list-table::
534 :header-rows: 1
536 * - Offset
537 - Type
538 - Name
539 - Description
540 * - 0x0
541 - journal_header_t
542 - r_header
543 - Common block header.
544 * - 0xC
545 - __be32
546 - r_count
547 - Number of bytes used in this block.
548 * - 0x10
549 - __be32 or __be64
550 - blocks[0]
551 - Blocks to revoke.
555 the superblock advertises 64-bit block number support, or 4 bytes
562 .. list-table::
564 :header-rows: 1
566 * - Offset
567 - Type
568 - Name
569 - Description
570 * - 0x0
571 - __be32
572 - r_checksum
573 - Checksum of the journal UUID + revocation block
586 .. list-table::
588 :header-rows: 1
590 * - Offset
591 - Type
592 - Name
593 - Descriptor
594 * - 0x0
595 - journal_header_s
596 - (open coded)
597 - Common block header.
598 * - 0xC
599 - unsigned char
600 - h_chksum_type
601 - The type of checksum to use to verify the integrity of the data blocks
603 * - 0xD
604 - unsigned char
605 - h_chksum_size
606 - The number of bytes used by the checksum. Most likely 4.
607 * - 0xE
608 - unsigned char
609 - h_padding[2]
610 -
611 * - 0x10
612 - __be32
613 - h_chksum[JBD2_CHECKSUM_BYTES]
614 - 32 bytes of space to store checksums. If
620 * - 0x30
621 - __be64
622 - h_commit_sec
623 - The time that the transaction was committed, in seconds since the epoch.
624 * - 0x38
625 - __be32
626 - h_commit_nsec
627 - Nanoseconds component of the above timestamp.
629 Fast commits
632 Fast commit area is organized as a log of tag length values. Each TLV has
637 .. list-table::
639 :header-rows: 1
641 * - Tag
642 - Meaning
643 - Value struct
644 - Description
645 * - EXT4_FC_TAG_HEAD
646 - Fast commit area header
647 - ``struct ext4_fc_head``
648 - Stores the TID of the transaction after which these fast commits should
650 * - EXT4_FC_TAG_ADD_RANGE
651 - Add extent to inode
652 - ``struct ext4_fc_add_range``
653 - Stores the inode number and extent to be added in this inode
654 * - EXT4_FC_TAG_DEL_RANGE
655 - Remove logical offsets to inode
656 - ``struct ext4_fc_del_range``
657 - Stores the inode number and the logical offset range that needs to be
659 * - EXT4_FC_TAG_CREAT
660 - Create directory entry for a newly created file
661 - ``struct ext4_fc_dentry_info``
662 - Stores the parent inode number, inode number and directory entry of the
664 * - EXT4_FC_TAG_LINK
665 - Link a directory entry to an inode
666 - ``struct ext4_fc_dentry_info``
667 - Stores the parent inode number, inode number and directory entry
668 * - EXT4_FC_TAG_UNLINK
669 - Unlink a directory entry of an inode
670 - ``struct ext4_fc_dentry_info``
671 - Stores the parent inode number, inode number and directory entry
673 * - EXT4_FC_TAG_PAD
674 - Padding (unused area)
675 - None
676 - Unused bytes in the fast commit area.
678 * - EXT4_FC_TAG_TAIL
679 - Mark the end of a fast commit
680 - ``struct ext4_fc_tail``
681 - Stores the TID of the commit, CRC of the fast commit of which this tag
684 Fast Commit Replay Idempotence
687 Fast commits tags are idempotent in nature provided the recovery code follows
693 was associated with inode 10. During fast commit, instead of storing this
697 - Link dirent b to inode 10
698 - Unlink dirent a
699 - Inode 10 with valid refcount
702 system. This is what guarantees idempotence of fast commit replay.
704 Let's take an example of a procedure that is not idempotent and see how fast
709 3) read A
714 deleted. Thus, file named A would be absent when we try to read A. So, this
716 of storing the procedure fast commits store the outcome of each procedure. Thus
717 the fast commit log for above procedure would be as follows:
731 replay of last inode 11 tag. Thus, by converting a non-idempotent procedure
732 into a series of idempotent outcomes, fast commits ensured idempotence during
739 are submitted to the disk. In-progress transactions are waited upon and included
753 discarded or zero-filled, respectively, after the journal checkpoint is