Linux Kernel
3.7.1
|
#include <linux/module.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/jbd2.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/freezer.h>
#include <linux/pagemap.h>
#include <linux/kthread.h>
#include <linux/poison.h>
#include <linux/proc_fs.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/math64.h>
#include <linux/hash.h>
#include <linux/log2.h>
#include <linux/vmalloc.h>
#include <linux/backing-dev.h>
#include <linux/bitops.h>
#include <linux/ratelimit.h>
#include <trace/events/jbd2.h>
#include <asm/uaccess.h>
#include <asm/page.h>
Go to the source code of this file.
Data Structures | |
struct | jbd2_stats_proc_session |
Macros | |
#define | CREATE_TRACE_POINTS |
#define | MIN_LOG_RESERVED_BLOCKS 32 /* Allow for rounding errors */ |
#define | INCOMPAT_FEATURE_ON(f) ((incompat & (f)) && !(sb->s_feature_incompat & cpu_to_be32(f))) |
#define | COMPAT_FEATURE_ON(f) ((compat & (f)) && !(sb->s_feature_compat & cpu_to_be32(f))) |
#define | JBD2_MAX_SLABS 8 |
#define | jbd2_create_jbd_stats_proc_entry() do {} while (0) |
#define | jbd2_remove_jbd_stats_proc_entry() do {} while (0) |
Variables | |
struct kmem_cache * | jbd2_handle_cache |
struct kmem_cache * | jbd2_inode_cache |
#define COMPAT_FEATURE_ON | ( | f | ) | ((compat & (f)) && !(sb->s_feature_compat & cpu_to_be32(f))) |
#define INCOMPAT_FEATURE_ON | ( | f | ) | ((incompat & (f)) && !(sb->s_feature_incompat & cpu_to_be32(f))) |
#define jbd2_create_jbd_stats_proc_entry | ( | ) | do {} while (0) |
#define jbd2_remove_jbd_stats_proc_entry | ( | ) | do {} while (0) |
EXPORT_SYMBOL | ( | jbd2_journal_extend | ) |
EXPORT_SYMBOL | ( | jbd2_journal_stop | ) |
EXPORT_SYMBOL | ( | jbd2_journal_lock_updates | ) |
EXPORT_SYMBOL | ( | jbd2_journal_unlock_updates | ) |
EXPORT_SYMBOL | ( | jbd2_journal_get_write_access | ) |
EXPORT_SYMBOL | ( | jbd2_journal_get_create_access | ) |
EXPORT_SYMBOL | ( | jbd2_journal_get_undo_access | ) |
EXPORT_SYMBOL | ( | jbd2_journal_set_triggers | ) |
EXPORT_SYMBOL | ( | jbd2_journal_dirty_metadata | ) |
EXPORT_SYMBOL | ( | jbd2_journal_release_buffer | ) |
EXPORT_SYMBOL | ( | jbd2_journal_forget | ) |
EXPORT_SYMBOL | ( | jbd2_journal_flush | ) |
EXPORT_SYMBOL | ( | jbd2_journal_revoke | ) |
EXPORT_SYMBOL | ( | jbd2_journal_init_dev | ) |
EXPORT_SYMBOL | ( | jbd2_journal_init_inode | ) |
EXPORT_SYMBOL | ( | jbd2_journal_check_used_features | ) |
EXPORT_SYMBOL | ( | jbd2_journal_check_available_features | ) |
EXPORT_SYMBOL | ( | jbd2_journal_set_features | ) |
EXPORT_SYMBOL | ( | jbd2_journal_load | ) |
EXPORT_SYMBOL | ( | jbd2_journal_destroy | ) |
EXPORT_SYMBOL | ( | jbd2_journal_abort | ) |
EXPORT_SYMBOL | ( | jbd2_journal_errno | ) |
EXPORT_SYMBOL | ( | jbd2_journal_ack_err | ) |
EXPORT_SYMBOL | ( | jbd2_journal_clear_err | ) |
EXPORT_SYMBOL | ( | jbd2_log_wait_commit | ) |
EXPORT_SYMBOL | ( | jbd2_log_start_commit | ) |
EXPORT_SYMBOL | ( | jbd2_journal_start_commit | ) |
EXPORT_SYMBOL | ( | jbd2_journal_force_commit_nested | ) |
EXPORT_SYMBOL | ( | jbd2_journal_wipe | ) |
EXPORT_SYMBOL | ( | jbd2_journal_blocks_per_page | ) |
EXPORT_SYMBOL | ( | jbd2_journal_invalidatepage | ) |
EXPORT_SYMBOL | ( | jbd2_journal_try_to_free_buffers | ) |
EXPORT_SYMBOL | ( | jbd2_journal_force_commit | ) |
EXPORT_SYMBOL | ( | jbd2_journal_file_inode | ) |
EXPORT_SYMBOL | ( | jbd2_journal_init_jbd_inode | ) |
EXPORT_SYMBOL | ( | jbd2_journal_release_jbd_inode | ) |
EXPORT_SYMBOL | ( | jbd2_journal_begin_ordered_truncate | ) |
EXPORT_SYMBOL | ( | jbd2_inode_cache | ) |
EXPORT_SYMBOL | ( | jbd2_trans_will_send_data_barrier | ) |
EXPORT_SYMBOL | ( | jbd2_journal_update_sb_errno | ) |
EXPORT_SYMBOL | ( | jbd2_journal_clear_features | ) |
void jbd2_journal_abort () - Shutdown the journal immediately. : the journal to shutdown. : an error number to record in the journal indicating the reason for the shutdown.
Perform a complete, immediate shutdown of the ENTIRE journal (not of a single transaction). This operation cannot be undone without closing and reopening the journal.
The jbd2_journal_abort function is intended to support higher level error recovery mechanisms such as the ext2/ext3 remount-readonly error mode.
Journal abort has very specific semantics. Any existing dirty, unjournaled buffers in the main filesystem will still be written to disk by bdflush, but the journaling mechanism will be suspended immediately and no further transaction commits will be honoured.
Any dirty, journaled buffers will be written back to disk without hitting the journal. Atomicity cannot be guaranteed on an aborted filesystem, but we do attempt to leave as much data as possible behind for fsck to use for cleanup.
Any attempt to get a new transaction handle on a journal which is in ABORT state will just result in an -EROFS error return. A jbd2_journal_stop on an existing handle will return -EIO if we have entered abort state during the update.
Recursive transactions are not disturbed by journal abort until the final jbd2_journal_stop, which will receive the -EIO error.
Finally, the jbd2_journal_abort call allows the caller to supply an errno which will be recorded (if possible) in the journal superblock. This allows a client to record failure conditions in the middle of a transaction without having to complete the transaction to record the failure to disk. ext3_error, for example, now uses this functionality.
Errors which originate from within the journaling layer will NOT supply an errno; a null errno implies that absolutely no further writes are done to the journal (unless there are any already in progress).
void jbd2_journal_ack_err | ( | journal_t * | journal | ) |
void jbd2_journal_ack_err() - Ack journal err. : journal to act on.
An error must be cleared or acked to take a FS out of readonly mode.
|
read |
int jbd2_journal_check_available_features | ( | journal_t * | journal, |
unsigned long | compat, | ||
unsigned long | ro, | ||
unsigned long | incompat | ||
) |
int jbd2_journal_check_available_features() - Check feature set in journalling layer : Journal to check. : bitmask of compatible features : bitmask of features that force read-only mount : bitmask of incompatible features
Check whether the journaling code supports the use of all of a given set of features on this journal. Return true (non-zero) if it can.
int jbd2_journal_check_used_features | ( | journal_t * | journal, |
unsigned long | compat, | ||
unsigned long | ro, | ||
unsigned long | incompat | ||
) |
*int jbd2_journal_check_used_features () - Check if features specified are used. : Journal to check. : bitmask of compatible features : bitmask of features that force read-only mount : bitmask of incompatible features
Check whether the journal uses all of a given set of features. Return true (non-zero) if it does.
int jbd2_journal_clear_err | ( | journal_t * | journal | ) |
int jbd2_journal_destroy | ( | journal_t * | journal | ) |
void jbd2_journal_destroy() - Release a journal_t structure. : Journal to act on.
Release a journal_t structure once it is no longer in use by the journaled object. Return <0 if we couldn't clean up the journal.
int jbd2_journal_errno | ( | journal_t * | journal | ) |
int jbd2_journal_errno () - returns the journal's error state. : journal to examine.
This is the errno number set with jbd2_journal_abort(), the last time the journal was mounted - if the journal was stopped without calling abort this will be 0.
If the journal has been aborted on this mount time -EROFS will be returned.
int jbd2_journal_flush | ( | journal_t * | journal | ) |
int jbd2_journal_force_commit_nested | ( | journal_t * | journal | ) |
|
read |
|
read |
journal_t* jbd2_journal_init_dev | ( | struct block_device * | bdev, |
struct block_device * | fs_dev, | ||
unsigned long long | start, | ||
int | len, | ||
int | blocksize | ||
) |
journal_t * jbd2_journal_init_dev() - creates and initialises a journal structure : Block device on which to create the journal : Device which hold journalled filesystem for this journal. : Block nr Start of journal. : Length of the journal in blocks. : blocksize of journalling device
Returns: a newly created journal_t *
jbd2_journal_init_dev creates a journal which maps a fixed contiguous range of blocks on an arbitrary block device.
int jbd2_journal_load | ( | journal_t * | journal | ) |
int jbd2_journal_load() - Read journal from disk. : Journal to act on.
Given a journal_t structure which tells us which disk blocks contain a journal, read the journal from disk to initialise the in-memory structures.
void jbd2_journal_put_journal_head | ( | struct journal_head * | jh | ) |
int jbd2_journal_set_features | ( | journal_t * | journal, |
unsigned long | compat, | ||
unsigned long | ro, | ||
unsigned long | incompat | ||
) |
int jbd2_journal_set_features () - Mark a given journal feature in the superblock : Journal to act on. : bitmask of compatible features : bitmask of features that force read-only mount : bitmask of incompatible features
Mark a given journal feature as present on the superblock. Returns true if the requested features could be set.
void jbd2_journal_update_sb_errno | ( | journal_t * | journal | ) |
jbd2_journal_update_sb_errno() - Update error in the journal. : The journal to update.
Update a journal's errno. Write updated superblock to disk waiting for IO to complete.
void jbd2_journal_update_sb_log_tail | ( | journal_t * | journal, |
tid_t | tail_tid, | ||
unsigned long | tail_block, | ||
int | write_op | ||
) |
jbd2_journal_update_sb_log_tail() - Update log tail in journal sb on disk. : The journal to update. : TID of the new transaction at the tail of the log : The first block of the transaction at the tail of the log : With which operation should we write the journal sb
Update a journal's superblock information about log tail and write it to disk, waiting for the IO to complete.
int jbd2_journal_wipe() - Wipe journal contents : Journal to act on. : flag (see below)
Wipe out all of the contents of a journal, safely. This will produce a warning if the journal contains any valid recovery information. Must be called between journal_init_*() and jbd2_journal_load().
If 'write' is non-zero, then we wipe out the journal on disk; otherwise we merely suppress recovery.
int jbd2_journal_write_metadata_buffer | ( | transaction_t * | transaction, |
struct journal_head * | jh_in, | ||
struct journal_head ** | jh_out, | ||
unsigned long long | blocknr | ||
) |
void jbd2_superblock_csum_set | ( | journal_t * | j, |
journal_superblock_t * | sb | ||
) |
int jbd2_superblock_csum_verify | ( | journal_t * | j, |
journal_superblock_t * | sb | ||
) |
int jbd2_verify_csum_type | ( | journal_t * | j, |
journal_superblock_t * | sb | ||
) |
module_exit | ( | journal_exit | ) |
module_init | ( | journal_init | ) |
MODULE_LICENSE | ( | "GPL" | ) |
struct kmem_cache* jbd2_handle_cache |
struct kmem_cache * jbd2_inode_cache |