include/linux/jbd2.h
Source file repositories/reference/linux-study-clean/include/linux/jbd2.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/jbd2.h- Extension
.h- Size
- 52834 bytes
- Lines
- 1840
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
jfs_compat.hlinux/types.hlinux/buffer_head.hlinux/journal-head.hlinux/stddef.hlinux/mutex.hlinux/timer.hlinux/slab.hlinux/bit_spinlock.hlinux/blkdev.hlinux/crc32c.hlinux/fs.hlinux/sched.h
Detected Declarations
struct commit_headerstruct jbd2_journal_block_tailstruct jbd2_inodestruct jbd2_revoke_table_sstruct jbd2_journal_handlestruct transaction_chp_stats_sstruct transaction_sstruct transaction_run_stats_sstruct transaction_stats_sstruct journal_sstruct jbd2_buffer_trigger_typeenum jbd_state_bitsenum passtypeenum jbd2_shrink_typefunction jbd_lock_bh_journal_headfunction jbd_unlock_bh_journal_headfunction jbd2_jinode_get_dirty_rangefunction jbd2_time_difffunction jbd2_format_support_featurefunction jbd2_file_log_bhfunction jbd2_unfile_log_bhfunction separatelyfunction separatelyfunction is_journal_abortedfunction is_handle_abortedfunction jbd2_journal_abort_handlefunction jbd2_init_fs_dev_write_errorfunction jbd2_check_fs_dev_write_errorfunction tid_gtfunction tid_geqfunction jbd2_journal_has_csum_v2or3function jbd2_journal_get_num_fc_blksfunction jbd2_log_space_leftfunction jbd2_chksumfunction jbd2_get_latest_transactionfunction jbd2_handle_buffer_credits
Annotated Snippet
struct commit_header {
__be32 h_magic;
__be32 h_blocktype;
__be32 h_sequence;
unsigned char h_chksum_type;
unsigned char h_chksum_size;
unsigned char h_padding[2];
__be32 h_chksum[JBD2_CHECKSUM_BYTES];
__be64 h_commit_sec;
__be32 h_commit_nsec;
};
/*
* The block tag: used to describe a single buffer in the journal.
* t_blocknr_high is only used if INCOMPAT_64BIT is set, so this
* raw struct shouldn't be used for pointer math or sizeof() - use
* journal_tag_bytes(journal) instead to compute this.
*/
typedef struct journal_block_tag3_s
{
__be32 t_blocknr; /* The on-disk block number */
__be32 t_flags; /* See below */
__be32 t_blocknr_high; /* most-significant high 32bits. */
__be32 t_checksum; /* crc32c(uuid+seq+block) */
} journal_block_tag3_t;
typedef struct journal_block_tag_s
{
__be32 t_blocknr; /* The on-disk block number */
__be16 t_checksum; /* truncated crc32c(uuid+seq+block) */
__be16 t_flags; /* See below */
__be32 t_blocknr_high; /* most-significant high 32bits. */
} journal_block_tag_t;
/* Tail of descriptor or revoke block, for checksumming */
struct jbd2_journal_block_tail {
__be32 t_checksum; /* crc32c(uuid+descr_block) */
};
/*
* The revoke descriptor: used on disk to describe a series of blocks to
* be revoked from the log
*/
typedef struct jbd2_journal_revoke_header_s
{
journal_header_t r_header;
__be32 r_count; /* Count of bytes used in the block */
} jbd2_journal_revoke_header_t;
/* Definitions for the journal tag flags word: */
#define JBD2_FLAG_ESCAPE 1 /* on-disk block is escaped */
#define JBD2_FLAG_SAME_UUID 2 /* block has same uuid as previous */
#define JBD2_FLAG_DELETED 4 /* block deleted by this transaction */
#define JBD2_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
/*
* The journal superblock. All fields are in big-endian byte order.
*/
typedef struct journal_superblock_s
{
/* 0x0000 */
journal_header_t s_header;
/* 0x000C */
/* Static information describing the journal */
__be32 s_blocksize; /* journal device blocksize */
__be32 s_maxlen; /* total blocks in journal file */
__be32 s_first; /* first block of log information */
/* 0x0018 */
/* Dynamic information describing the current state of the log */
__be32 s_sequence; /* first commit ID expected in log */
__be32 s_start; /* blocknr of start of log */
/* 0x0020 */
/* Error value, as set by jbd2_journal_abort(). */
__be32 s_errno;
/* 0x0024 */
/* Remaining fields are only valid in a version-2 superblock */
__be32 s_feature_compat; /* compatible feature set */
__be32 s_feature_incompat; /* incompatible feature set */
__be32 s_feature_ro_compat; /* readonly-compatible feature set */
/* 0x0030 */
__u8 s_uuid[16]; /* 128-bit uuid for journal */
/* 0x0040 */
__be32 s_nr_users; /* Nr of filesystems sharing log */
Annotation
- Immediate include surface: `jfs_compat.h`, `linux/types.h`, `linux/buffer_head.h`, `linux/journal-head.h`, `linux/stddef.h`, `linux/mutex.h`, `linux/timer.h`, `linux/slab.h`.
- Detected declarations: `struct commit_header`, `struct jbd2_journal_block_tail`, `struct jbd2_inode`, `struct jbd2_revoke_table_s`, `struct jbd2_journal_handle`, `struct transaction_chp_stats_s`, `struct transaction_s`, `struct transaction_run_stats_s`, `struct transaction_stats_s`, `struct journal_s`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.