Journal revoke record
A journal revoke record identifies a block whose older journaled images must not be replayed over newer uses of that block.
JBD2 tracks the latest revoking transaction per block, and a journaled image from a later transaction can still replay. [1] The record exists for blocks that were journaled and are no longer journaled, typically metadata freed and reused as file data. It does not mark one journal block as superseded by another, and adding a block to a transaction removes all existing revoke records for it. [3]
In the Linux v6.16 on-disk format, a revocation block has journal block type 5 and a header of at least 16 bytes, yet it occupies a full journal block. The 4-byte r_count at offset 0xC gives the bytes used, and block numbers start at offset 0x10, 8 bytes each with 64-bit block number support and 4 bytes otherwise. With checksum versions 2 and 3, a tail holding r_checksum ends the block. [3] [6]
Recovery makes three passes: it finds the end of the log, collects revoke records, then replays only blocks that are not revoked. If one block has several revoke records, only the last counts. A block revoked and then written as data keeps its revoke, so old log records cannot overwrite the new data. [5] [4]
Relations
Advantages
- Lets a freed metadata block be reused for file data without the journal overwriting that data during replay. [3]
Limitations
- Each revocation block takes a full journal block, so freeing many journaled blocks consumes extra log space. [3]
- The cited v6.16 sources describe one kernel version and do not certify a deployed kernel or storage stack. [4]
Citations
- Linux v6.12: fs/jbd2/revoke.c, recovery rules and jbd2_journal_test_revoke
- Linux v6.16 Documentation/filesystems/ext4/journal.rst: revocation block layout
- Linux v6.16 fs/jbd2/revoke.c: revoke semantics and revoke tables
- Linux v6.16 fs/jbd2/recovery.c: three-pass journal recovery
- Linux v6.16 include/linux/jbd2.h: journal block types
Further reading
Sources & caveats
- journal-doc is Documentation/filesystems/ext4/journal.rst at tag v6.16, read in the revocation block section and the block header table.
- revoke-v616 is fs/jbd2/revoke.c and recovery is fs/jbd2/recovery.c, both at tag v6.16, read in their header comments and jbd2_journal_recover.
- jbd2-header is include/linux/jbd2.h at tag v6.16, read for JBD2_REVOKE_BLOCK and the revoke table fields.
- 16 bytes, 0xC, 0x10, 8 and 4 bytes come from journal-doc. Block type 5 comes from jbd2-header. The three passes come from recovery.