@@ -28,6 +28,17 @@ metadata are written to disk through the journal. This is slower but
2828safest. If ``data=writeback ``, dirty data blocks are not flushed to the
2929disk before the metadata are written to disk through the journal.
3030
31+ In case of ``data=ordered `` mode, Ext4 also supports fast commits which
32+ help reduce commit latency significantly. The default ``data=ordered ``
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
37+ or if JBD2 commit timer goes off, Ext4 performs a traditional full commit.
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
40+ commits. This feature needs to be enabled at mkfs time.
41+
3142The journal inode is typically inode 8. The first 68 bytes of the
3243journal inode are replicated in the ext4 superblock. The journal itself
3344is normal (but hidden) file within the filesystem. The file usually
@@ -609,3 +620,58 @@ bytes long (but uses a full block):
609620 - h\_ commit\_ nsec
610621 - Nanoseconds component of the above timestamp.
611622
623+ Fast commits
624+ ~~~~~~~~~~~~
625+
626+ Fast commit area is organized as a log of tag length values. Each TLV has
627+ a ``struct ext4_fc_tl `` in the beginning which stores the tag and the length
628+ of the entire field. It is followed by variable length tag specific value.
629+ Here is the list of supported tags and their meanings:
630+
631+ .. list-table ::
632+ :widths: 8 20 20 32
633+ :header-rows: 1
634+
635+ * - Tag
636+ - Meaning
637+ - Value struct
638+ - Description
639+ * - EXT4_FC_TAG_HEAD
640+ - Fast commit area header
641+ - ``struct ext4_fc_head ``
642+ - Stores the TID of the transaction after which these fast commits should
643+ be applied.
644+ * - EXT4_FC_TAG_ADD_RANGE
645+ - Add extent to inode
646+ - ``struct ext4_fc_add_range ``
647+ - Stores the inode number and extent to be added in this inode
648+ * - EXT4_FC_TAG_DEL_RANGE
649+ - Remove logical offsets to inode
650+ - ``struct ext4_fc_del_range ``
651+ - Stores the inode number and the logical offset range that needs to be
652+ removed
653+ * - EXT4_FC_TAG_CREAT
654+ - Create directory entry for a newly created file
655+ - ``struct ext4_fc_dentry_info ``
656+ - Stores the parent inode number, inode number and directory entry of the
657+ newly created file
658+ * - EXT4_FC_TAG_LINK
659+ - Link a directory entry to an inode
660+ - ``struct ext4_fc_dentry_info ``
661+ - Stores the parent inode number, inode number and directory entry
662+ * - EXT4_FC_TAG_UNLINK
663+ - Unlink a directory entry of an inode
664+ - ``struct ext4_fc_dentry_info ``
665+ - Stores the parent inode number, inode number and directory entry
666+
667+ * - EXT4_FC_TAG_PAD
668+ - Padding (unused area)
669+ - None
670+ - Unused bytes in the fast commit area.
671+
672+ * - EXT4_FC_TAG_TAIL
673+ - Mark the end of a fast commit
674+ - ``struct ext4_fc_tail ``
675+ - Stores the TID of the commit, CRC of the fast commit of which this tag
676+ represents the end of
677+
0 commit comments