Lines Matching +full:fast +full:- +full:mode
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
34 mode, Ext4 only stores the minimal delta needed to recreate the
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 - __be32
264 - s_head
265 - Block number of the head (first unused block) of the journal, only
266 up-to-date when the journal is empty.
267 * - 0x5C
268 - __u32
269 - s_padding[40]
270 -
271 * - 0xFC
272 - __be32
273 - s_checksum
274 - Checksum of the entire superblock, with this field set to zero.
275 * - 0x100
276 - __u8
277 - s_users[16*48]
278 - ids of all file systems sharing the log. e2fsprogs/Linux don't allow
286 .. list-table::
288 :header-rows: 1
290 * - Value
291 - Description
292 * - 0x1
293 - Journal maintains checksums on the data blocks.
300 .. list-table::
302 :header-rows: 1
304 * - Value
305 - Description
306 * - 0x1
307 - Journal has block revocation records. (JBD2_FEATURE_INCOMPAT_REVOKE)
308 * - 0x2
309 - Journal can deal with 64-bit block numbers.
311 * - 0x4
312 - Journal commits asynchronously. (JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
313 * - 0x8
314 - This journal uses v2 of the checksum on-disk format. Each journal
318 * - 0x10
319 - This journal uses v3 of the checksum on-disk format. This is the same as
322 * - 0x20
323 - Journal has fast commit blocks. (JBD2_FEATURE_INCOMPAT_FAST_COMMIT)
330 .. list-table::
332 :header-rows: 1
334 * - Value
335 - Description
336 * - 1
337 - CRC32
338 * - 2
339 - MD5
340 * - 3
341 - SHA1
342 * - 4
343 - CRC32C
350 journal. Descriptor blocks are open-coded instead of being completely
354 .. list-table::
356 :header-rows: 1
358 * - Offset
359 - Type
360 - Name
361 - Descriptor
362 * - 0x0
363 - journal_header_t
364 - (open coded)
365 - Common block header.
366 * - 0xC
367 - struct journal_block_tag_s
368 - open coded array[]
369 - Enough tags either to fill up the block or to describe all the data
379 .. list-table::
381 :header-rows: 1
383 * - Offset
384 - Type
385 - Name
386 - Descriptor
387 * - 0x0
388 - __be32
389 - t_blocknr
390 - Lower 32-bits of the location of where the corresponding data block
392 * - 0x4
393 - __be32
394 - t_flags
395 - Flags that go with the descriptor. See the table jbd2_tag_flags_ for
397 * - 0x8
398 - __be32
399 - t_blocknr_high
400 - Upper 32-bits of the location of where the corresponding data block
403 * - 0xC
404 - __be32
405 - t_checksum
406 - Checksum of the journal UUID, the sequence number, and the data block.
407 * -
408 -
409 -
410 - This field appears to be open coded. It always comes at the end of the
413 * - 0x8 or 0xC
414 - char
415 - uuid[16]
416 - A UUID to go with this tag. This field appears to be copied from the
424 .. list-table::
426 :header-rows: 1
428 * - Value
429 - Description
430 * - 0x1
431 - On-disk block is escaped. The first four bytes of the data block just
433 * - 0x2
434 - This block has the same UUID as previous, therefore the UUID field is
436 * - 0x4
437 - The data block was deleted by the transaction. (Not used?)
438 * - 0x8
439 - This is the last tag in this descriptor block.
445 .. list-table::
447 :header-rows: 1
449 * - Offset
450 - Type
451 - Name
452 - Descriptor
453 * - 0x0
454 - __be32
455 - t_blocknr
456 - Lower 32-bits of the location of where the corresponding data block
458 * - 0x4
459 - __be16
460 - t_checksum
461 - Checksum of the journal UUID, the sequence number, and the data block.
463 * - 0x6
464 - __be16
465 - t_flags
466 - Flags that go with the descriptor. See the table jbd2_tag_flags_ for
468 * -
469 -
470 -
471 - This next field is only present if the super block indicates support for
472 64-bit block numbers.
473 * - 0x8
474 - __be32
475 - t_blocknr_high
476 - Upper 32-bits of the location of where the corresponding data block
478 * -
479 -
480 -
481 - This field appears to be open coded. It always comes at the end of the
484 * - 0x8 or 0xC
485 - char
486 - uuid[16]
487 - A UUID to go with this tag. This field appears to be copied from the
495 .. list-table::
497 :header-rows: 1
499 * - Offset
500 - Type
501 - Name
502 - Descriptor
503 * - 0x0
504 - __be32
505 - t_checksum
506 - Checksum of the journal UUID + the descriptor block, with this field set
524 block is freed and re-allocated as a file data block; in this case, a
537 .. list-table::
539 :header-rows: 1
541 * - Offset
542 - Type
543 - Name
544 - Description
545 * - 0x0
546 - journal_header_t
547 - r_header
548 - Common block header.
549 * - 0xC
550 - __be32
551 - r_count
552 - Number of bytes used in this block.
553 * - 0x10
554 - __be32 or __be64
555 - blocks[0]
556 - Blocks to revoke.
560 the superblock advertises 64-bit block number support, or 4 bytes
567 .. list-table::
569 :header-rows: 1
571 * - Offset
572 - Type
573 - Name
574 - Description
575 * - 0x0
576 - __be32
577 - r_checksum
578 - Checksum of the journal UUID + revocation block
591 .. list-table::
593 :header-rows: 1
595 * - Offset
596 - Type
597 - Name
598 - Descriptor
599 * - 0x0
600 - journal_header_s
601 - (open coded)
602 - Common block header.
603 * - 0xC
604 - unsigned char
605 - h_chksum_type
606 - The type of checksum to use to verify the integrity of the data blocks
608 * - 0xD
609 - unsigned char
610 - h_chksum_size
611 - The number of bytes used by the checksum. Most likely 4.
612 * - 0xE
613 - unsigned char
614 - h_padding[2]
615 -
616 * - 0x10
617 - __be32
618 - h_chksum[JBD2_CHECKSUM_BYTES]
619 - 32 bytes of space to store checksums. If
625 * - 0x30
626 - __be64
627 - h_commit_sec
628 - The time that the transaction was committed, in seconds since the epoch.
629 * - 0x38
630 - __be32
631 - h_commit_nsec
632 - Nanoseconds component of the above timestamp.
634 Fast commits
637 Fast commit area is organized as a log of tag length values. Each TLV has
642 .. list-table::
644 :header-rows: 1
646 * - Tag
647 - Meaning
648 - Value struct
649 - Description
650 * - EXT4_FC_TAG_HEAD
651 - Fast commit area header
652 - ``struct ext4_fc_head``
653 - Stores the TID of the transaction after which these fast commits should
655 * - EXT4_FC_TAG_ADD_RANGE
656 - Add extent to inode
657 - ``struct ext4_fc_add_range``
658 - Stores the inode number and extent to be added in this inode
659 * - EXT4_FC_TAG_DEL_RANGE
660 - Remove logical offsets to inode
661 - ``struct ext4_fc_del_range``
662 - Stores the inode number and the logical offset range that needs to be
664 * - EXT4_FC_TAG_CREAT
665 - Create directory entry for a newly created file
666 - ``struct ext4_fc_dentry_info``
667 - Stores the parent inode number, inode number and directory entry of the
669 * - EXT4_FC_TAG_LINK
670 - Link a directory entry to an inode
671 - ``struct ext4_fc_dentry_info``
672 - Stores the parent inode number, inode number and directory entry
673 * - EXT4_FC_TAG_UNLINK
674 - Unlink a directory entry of an inode
675 - ``struct ext4_fc_dentry_info``
676 - Stores the parent inode number, inode number and directory entry
678 * - EXT4_FC_TAG_PAD
679 - Padding (unused area)
680 - None
681 - Unused bytes in the fast commit area.
683 * - EXT4_FC_TAG_TAIL
684 - Mark the end of a fast commit
685 - ``struct ext4_fc_tail``
686 - Stores the TID of the commit, CRC of the fast commit of which this tag
689 Fast Commit Replay Idempotence
692 Fast commits tags are idempotent in nature provided the recovery code follows
698 was associated with inode 10. During fast commit, instead of storing this
702 - Link dirent b to inode 10
703 - Unlink dirent a
704 - Inode 10 with valid refcount
707 system. This is what guarantees idempotence of fast commit replay.
709 Let's take an example of a procedure that is not idempotent and see how fast
721 of storing the procedure fast commits store the outcome of each procedure. Thus
722 the fast commit log for above procedure would be as follows:
736 replay of last inode 11 tag. Thus, by converting a non-idempotent procedure
737 into a series of idempotent outcomes, fast commits ensured idempotence during
744 are submitted to the disk. In-progress transactions are waited upon and included
758 discarded or zero-filled, respectively, after the journal checkpoint is