---
name: "struct_journal_s"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/struct_journal_s"
---

# struct\_journal\_s(9)

The journal\_s type is the concrete type associated with journal\_t.

## NAME

struct\_journal\_s - The journal\_s type is the concrete type associated with journal\_t.

## SYNOPSIS

```
struct journal_s {
  unsigned long j_flags;
  int j_errno;
  struct buffer_head * j_sb_buffer;
  journal_superblock_t * j_superblock;
  int j_format_version;
  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;
  struct mutex j_checkpoint_mutex;
  struct buffer_head * j_chkpt_bhs[JBD2_NR_BATCH];
  unsigned long j_head;
  unsigned long j_tail;
  unsigned long j_free;
  unsigned long j_first;
  unsigned long j_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;
  unsigned int j_maxlen;
  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;
  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;
  int j_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 *);
  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;
  struct crypto_shash * j_chksum_driver;
  __u32 j_csum_seed;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
  struct lockdep_map j_trans_commit_map;
#endif
};
```

## MEMBERS

j\_flags

General journaling state flags \[j\_state\_lock\]

j\_errno

Is there an outstanding uncleared error on the journal (from a prior abort)? \[j\_state\_lock\]

j\_sb\_buffer

The first part of the superblock buffer.

j\_superblock

The second part of the superblock buffer.

j\_format\_version

Version of the superblock format.

j\_state\_lock

Protect the various scalars in the journal.

j\_barrier\_count

Number of processes waiting to create a barrier lock \[j\_state\_lock\]

j\_barrier

The barrier lock itself.

j\_running\_transaction

Transactions: The current running transaction... \[j\_state\_lock\] \[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\_checkpoint\_mutex

Semaphore for locking against concurrent checkpoints.

j\_chkpt\_bhs\[JBD2\_NR\_BATCH\]

List of buffer heads used by the checkpoint routine. This was moved from **jbd2\_log\_do\_checkpoint** to reduce stack usage. Access to this array is controlled by the *j\_checkpoint\_mutex*. \[j\_checkpoint\_mutex\]

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\_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\[BDEVNAME\_SIZE+24\]

Journal device name.

j\_fs\_dev

Device which holds the client fs. For internal journal this will be equal to j\_dev.

j\_maxlen

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 via **bmap**.

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\].

j\_commit\_request

Sequence number of the most recent transaction wanting commit \[j\_state\_lock\]

j\_uuid\[16\]

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\_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

Protect the revoke table.

j\_revoke

The revoke table - maintains the list of revoked blocks in the current transaction.

j\_revoke\_table\[2\]

Alternate revoke tables for j\_revoke.

j\_wbuf

Array of bhs for jbd2\_journal\_commit\_transaction.

j\_wbufsize

Size of *j\_wbuf* array.

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\_history\_lock

Protect 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\_chksum\_driver

Reference to checksum algorithm driver via cryptoapi.

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.

## AUTHORS

**Roger Gammans** \<rgammans@computer-surgery.co.uk\>

Author.

**Stephen Tweedie** \<sct@redhat.com\>

Author.

## COPYRIGHT
