Journaling block device
This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (December 2015) (Learn how and when to remove this template message)
The Journaling Block Device (JBD) provides a filesystem-independent interface for filesystem journaling. ext3, ext4 and OCFS2 are known to use JBD. OCFS2 starting from Linux 2.6.28 and ext4 use a fork of JBD called JBD2.
An atomic handle is basically a collection of all the low-level changes that occur during a single high-level atomic update to the file system. The atomic handle guarantees that the high-level update either happens or not, because the actual changes to the file system are flushed only after logging the atomic handle in the journal.
For the sake of efficiency and performance, JBD groups several atomic handles into a single transaction, which is written to the journal after a fixed amount of time elapses or there is no free space left on the journal to fit it.
The transaction has several states:
- Running - it means that the transaction is still live and can accept more handles
- Locked - not accepting new handles, but the existing ones are still unfinished
- Flush - the transaction is complete and is being written to the journal
- Commit - the transaction is written to the journal and now the changes are being applied to the file system
- Finished - the transaction has been fully written to the journal and the block device. It can be deleted from the journal.
Based on the transaction states, the JBD is able to determine which transactions need to be replayed (or reapplied) to the file system.
- Mingming Cao (9 August 2006). "Forking ext4 filesystem and JBD2" (Mailing list). Linux kernel mailing list.
- Linux: The Journaling Block Device (Kedar Sovani, KernelTrap, June 20, 2006)
- Linux kernel v22.214.171.124 source
|This Linux-related article is a stub. You can help Wikipedia by expanding it.|