STRUCT JOURNAL_S(9)
π¦ NAME π¦
struct journal_s β okay so bestie, this is the whole vibe of the page: the journal_s type is the concrete type associated with journal_t. That's it, that's the name section, periodt. π
Like, journal_t is the name you keep seeing everywhere, and journal_s is the actual real-life struct behind it. main character energy fr fr. π
β¨ SYNOPSIS β¨
Okay so here it is, the whole entire struct, and ngl it's giving a lot π β I'm not summarising a single field because that would be a crime against humanity. Every member is right here, exactly as it lives, no cap:
struct journal_s {
unsigned long j_flags;
int j_errno;
struct mutex j_abort_mutex;
struct buffer_head *j_sb_buffer;
journal_superblock_t *j_superblock;
rwlock_t j_state_lock;
int j_barrier_count;
struct mutex j_barrier;
transaction_t *j_running_transaction;
transaction_t *j_committing_transaction;
transaction_t *j_checkpoint_transactions;
wait_queue_head_t j_wait_transaction_locked;
wait_queue_head_t j_wait_done_commit;
wait_queue_head_t j_wait_commit;
wait_queue_head_t j_wait_updates;
wait_queue_head_t j_wait_reserved;
wait_queue_head_t j_fc_wait;
struct mutex j_checkpoint_mutex;
struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
struct shrinker *j_shrinker;
struct percpu_counter j_checkpoint_jh_count;
transaction_t *j_shrink_transaction;
unsigned long j_head;
unsigned long j_tail;
unsigned long j_free;
unsigned long j_first;
unsigned long j_last;
unsigned long j_fc_first;
unsigned long j_fc_off;
unsigned long j_fc_last;
struct block_device *j_dev;
int j_blocksize;
unsigned long long j_blk_offset;
char j_devname[BDEVNAME_SIZE+24];
struct block_device *j_fs_dev;
errseq_t j_fs_dev_wb_err;
unsigned int j_total_len;
atomic_t j_reserved_credits;
spinlock_t j_list_lock;
struct inode *j_inode;
tid_t j_tail_sequence;
tid_t j_transaction_sequence;
tid_t j_commit_sequence;
tid_t j_commit_request;
__u8 j_uuid[16];
struct task_struct *j_task;
int j_max_transaction_buffers;
int j_revoke_records_per_block;
int j_transaction_overhead_buffers;
unsigned long j_commit_interval;
struct timer_list j_commit_timer;
spinlock_t j_revoke_lock;
struct jbd2_revoke_table_s *j_revoke;
struct jbd2_revoke_table_s *j_revoke_table[2];
struct buffer_head **j_wbuf;
struct buffer_head **j_fc_wbuf;
int j_wbufsize;
int j_fc_wbufsize;
pid_t j_last_sync_writer;
u64 j_average_commit_time;
u32 j_min_batch_time;
u32 j_max_batch_time;
void (*j_commit_callback)(journal_t *, transaction_t *);
int (*j_submit_inode_data_buffers) (struct jbd2_inode *);
int (*j_finish_inode_data_buffers) (struct jbd2_inode *);
spinlock_t j_history_lock;
struct proc_dir_entry *j_proc_entry;
struct transaction_stats_s j_stats;
unsigned int j_failed_commit;
void *j_private;
__u32 j_csum_seed;
#ifdef CONFIG_DEBUG_LOCK_ALLOC;
struct lockdep_map j_trans_commit_map;
#endif;
struct lock_class_key jbd2_trans_commit_key;
void (*j_fc_cleanup_callback)(struct journal_s *journal, int full,
tid_t tid);
int (*j_fc_replay_callback)(struct journal_s *journal, struct
buffer_head *bh, enum passtype pass, int off, tid_t expected_commit_id);
int (*j_bmap)(struct journal_s *journal, sector_t *block);
};
π«Ά bestie note: those last three function-pointer members are wrapped across lines in the source, so they're wrapped here too β I did not touch a single character. copy-paste safe, iykyk π
Also lowkey obsessed with the fact that j_fc_cleanup_callback and j_fc_replay_callback and j_bmap are all just sitting there at the bottom of this absolute unit of a struct, like the last three people at the party. πΈ
There's more coming in the next part, so don't go anywhere β this icon isn't done slaying yet β¨π¦
π Members π
okay bestie, this is the whole member lineup for struct journal_s, and every single field is getting its moment. no skipping, no βweβll come back to it,β periodt. β¨
j_flagsβ general journaling state flags.[j_state_lock, no lock for quick racy checks]j_errnoβ is there an outstanding uncleared error on the journal (from a prior abort)?[j_state_lock]j_abort_mutexβ locks the whole aborting procedure. πj_sb_bufferβ the first part of the superblock buffer.j_superblockβ the second part of the superblock buffer.j_state_lockβ protects the various scalars in the journal. πj_barrier_countβ number of processes waiting to create a barrier lock.[j_state_lock, no lock for quick racy checks]j_barrierβ the barrier lock itself.j_running_transactionβ transactions: the current running transaction...[j_state_lock, no lock for quick racy checks][caller holding open handle]j_committing_transactionβ the transaction we are pushing to disk.[j_state_lock][caller holding open handle]j_checkpoint_transactionsβ ...and a linked circular list of all transactions waiting for checkpointing.[j_list_lock]j_wait_transaction_lockedβ wait queue for waiting for a locked transaction to start committing, or for a barrier lock to be released.j_wait_done_commitβ wait queue for waiting for commit to complete.j_wait_commitβ wait queue to trigger commit.j_wait_updatesβ wait queue to wait for updates to complete.j_wait_reservedβ wait queue to wait for reserved buffer credits to drop.j_fc_waitβ wait queue to wait for completion of async fast commits.j_checkpoint_mutexβ semaphore for locking against concurrent checkpoints.j_chkpt_bhsβ list of buffer heads used by the checkpoint routine. This was moved fromjbd2_log_do_checkpointto reduce stack usage. Access to this array is controlled by thej_checkpoint_mutex.[j_checkpoint_mutex]j_shrinkerβ journal head shrinker, reclaims the bufferβs journal head which has been written back. π§j_checkpoint_jh_countβ number of journal buffers on the checkpoint list.[j_list_lock]j_shrink_transactionβ records the next transaction that will shrink on the checkpoint list.[j_list_lock]j_headβ journal head: identifies the first unused block in the journal.[j_state_lock]j_tailβ journal tail: identifies the oldest still-used block in the journal.[j_state_lock]j_freeβ journal free: how many free blocks are there in the journal?[j_state_lock]j_firstβ the block number of the first usable block in the journal.[j_state_lock]j_lastβ the block number one beyond the last usable block in the journal.[j_state_lock]j_fc_firstβ the block number of the first fast commit block in the journal.[j_state_lock]j_fc_offβ number of fast commit blocks currently allocated. Accessed only during fast commit. Currently only process can do fast commit, so this field is not protected by any lock.j_fc_lastβ the block number one beyond the last fast commit block in the journal.[j_state_lock]j_devβ device where we store the journal.j_blocksizeβ block size for the location where we store the journal.j_blk_offsetβ starting block offset into the device where we store the journal.j_devnameβ journal device name.j_fs_devβ device which holds the client fs. For internal journal this will be equal toj_dev.j_fs_dev_wb_errβ records the errseq of the client fsβs backing block device.j_total_lenβ total maximum capacity of the journal region on disk.j_reserved_creditsβ number of buffers reserved from the running transaction.j_list_lockβ protects the buffer lists and internal buffer state. π‘οΈj_inodeβ optional inode where we store the journal. If present, all journal block numbers are mapped into this inode viabmap.j_tail_sequenceβ sequence number of the oldest transaction in the log.[j_state_lock]j_transaction_sequenceβ sequence number of the next transaction to grant.[j_state_lock]j_commit_sequenceβ sequence number of the most recently committed transaction.[j_state_lock, no lock for quick racy checks]j_commit_requestβ sequence number of the most recent transaction wanting commit.[j_state_lock, no lock for quick racy checks]j_uuidβ journal uuid: identifies the object (filesystem, LVM volume etc) backed by this journal. This will eventually be replaced by an array of uuids, allowing us to index multiple devices within a single journal and to perform atomic updates across them. πj_taskβ pointer to the current commit thread for this journal.j_max_transaction_buffersβ maximum number of metadata buffers to allow in a single compound commit transaction.j_revoke_records_per_blockβ number of revoke records that fit in one descriptor block.j_transaction_overhead_buffersβ number of blocks each transaction needs for its own bookkeeping.j_commit_intervalβ what is the maximum transaction lifetime before we begin a commit?j_commit_timerβ the timer used to wakeup the commit thread. β°j_revoke_lockβ protects the revoke table.j_revokeβ the revoke table β maintains the list of revoked blocks in the current transaction.j_revoke_tableβ alternate revoke tables forj_revoke.j_wbufβ array of bhs forjbd2_journal_commit_transaction.j_fc_wbufβ array of fast commit bhs for fast commit. Accessed only during a fast commit. Currently only process can do fast commit, so this field is not protected by any lock.j_wbufsizeβ size ofj_wbufarray.j_fc_wbufsizeβ size ofj_fc_wbufarray.j_last_sync_writerβ the pid of the last person to run a synchronous operation through the journal.j_average_commit_timeβ the average amount of time in nanoseconds it takes to commit a transaction to disk.[j_state_lock]j_min_batch_timeβ minimum time that we should wait for additional filesystem operations to get batched into a synchronous handle in microseconds.j_max_batch_timeβ maximum time that we should wait for additional filesystem operations to get batched into a synchronous handle in microseconds.j_commit_callbackβ this function is called when a transaction is closed.j_submit_inode_data_buffersβ this function is called for all inodes associated with the committing transaction marked withJI_WRITE_DATAflag before we start to write out the transaction to the journal.j_finish_inode_data_buffersβ this function is called for all inodes associated with the committing transaction marked withJI_WAIT_DATAflag after we have written the transaction to the journal but before we write out the commit block.j_history_lockβ protects the transactions statistics history.j_proc_entryβ procfs entry for the jbd statistics directory.j_statsβ overall statistics. πj_failed_commitβ failed journal commit ID.j_privateβ an opaque pointer to fs-private information. ext3 puts its superblock pointer here.j_csum_seedβ precomputed journal UUID checksum for seeding other checksums.j_trans_commit_mapβ lockdep entity to track transaction commit dependencies. Handles hold this "lock" for read, when we wait for commit, we acquire the "lock" for writing. This matches the properties of jbd2 journalling where the running transaction has to wait for all handles to be dropped to commit that transaction and also acquiring a handle may require transaction commit to finish.jbd2_trans_commit_keyβ"struct lock_class_key"forj_trans_commit_map.j_fc_cleanup_callbackβ clean-up after fast commit or full commit. JBD2 calls this function after every commit operation.j_fc_replay_callbackβ file-system specific function that performs replay of a fast commit. JBD2 calls this function for each fast commit block found in the journal. This function should returnJBD2_FC_REPLAY_CONTINUEto indicate that the block was processed correctly and more fast commit replay should continue. Return value ofJBD2_FC_REPLAY_STOPindicates the end of replay (no more blocks remaining). A negative return value indicates error. πj_bmapβ bmap function that should be used instead of the generic VFS bmap function.
π« SEE ALSO π«
- Kernel file
./include/linux/jbd2.h handle_t(9)journal_t(9)struct jbd2_inode(9)struct jbd2_journal_handle(9)
source/version/date tea, bestie: ./include/linux Β· October 2026 Β· struct journal_s(9) β and thatβs the whole page, mwah ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms