Linux Kernel
3.7.1
|
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/jbd.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/hrtimer.h>
#include <linux/backing-dev.h>
Go to the source code of this file.
void __journal_file_buffer | ( | struct journal_head * | jh, |
transaction_t * | transaction, | ||
int | jlist | ||
) |
Definition at line 2070 of file transaction.c.
void __journal_refile_buffer | ( | struct journal_head * | jh | ) |
Definition at line 2169 of file transaction.c.
void __journal_unfile_buffer | ( | struct journal_head * | jh | ) |
Definition at line 1631 of file transaction.c.
int journal_dirty_data() - mark a buffer as containing dirty data to be flushed : transaction : bufferhead to mark
Description: Mark a buffer as containing dirty data which needs to be flushed before we can commit the current transaction.
The buffer is placed on the transaction's data list and is marked as belonging to the transaction.
Returns error number or 0 on success.
journal_dirty_data() can be called via page_launder->ext3_writepage by kswapd.
Definition at line 948 of file transaction.c.
int journal_dirty_metadata() - mark a buffer as containing dirty metadata : transaction to add buffer to. : buffer to mark
Mark dirty metadata which needs to be journaled as part of the current transaction.
The buffer is placed on the transaction's metadata list and is marked as belonging to the transaction.
Returns error number or 0 on success.
Special care needs to be taken if the buffer already belongs to the current committing transaction (in which case we should have frozen data present for that commit). In that case, we don't relink the buffer: that only gets done when the old transaction finally completes its commit.
Definition at line 1138 of file transaction.c.
int journal_extend() - extend buffer credits. : handle to 'extend' : nr blocks to try to extend by.
Some transactions, such as large extends and truncates, can be done atomically all at once or in several stages. The operation requests a credit for a number of buffer modications in advance, but can extend its credit if it needs more.
journal_extend tries to give the running handle more buffer credits. It does not guarantee that allocation - this is a best-effort only. The calling process MUST be able to deal cleanly with a failure to extend here.
Return 0 on success, non-zero on failure.
return code < 0 implies an error return code > 0 implies normal transaction-full status.
Definition at line 321 of file transaction.c.
void journal_file_buffer | ( | struct journal_head * | jh, |
transaction_t * | transaction, | ||
int | jlist | ||
) |
Definition at line 2148 of file transaction.c.
int journal_force_commit | ( | journal_t * | journal | ) |
int journal_force_commit() - force any uncommitted transactions : journal to force
For synchronous operations: force any uncommitted transactions to disk. May seem kludgy, but it reuses all the handle batching code in a very simple manner.
Definition at line 1494 of file transaction.c.
void journal_forget() - bforget() for potentially-journaled buffers. : transaction handle : bh to 'forget'
We can only do the bforget if there are no commits pending against the buffer. If the buffer is dirty in the current running transaction we can safely unlink it.
bh may not be a journalled buffer at all - it may be a non-JBD buffer which came off the hashtable. Check for this.
Decrements bh->b_count by one.
Allow this call even if the handle has aborted — it may be part of the caller's cleanup after an abort.
Definition at line 1236 of file transaction.c.
int journal_get_create_access () - notify intent to use newly created bh : transaction to new buffer to : new buffer.
Call this if you create a new bh.
Definition at line 785 of file transaction.c.
int journal_get_undo_access() - Notify intent to modify metadata with non-rewindable consequences : transaction : buffer to undo
Sometimes there is a need to distinguish between metadata which has been committed to disk and that which has not. The ext3fs code uses this for freeing and allocating space, we have to make sure that we do not reuse freed space until the deallocation has been committed, since if we overwrote that space we would make the delete un-rewindable in case of a crash.
To deal with that, journal_get_undo_access requests write access to a buffer for parts of non-rewindable operations such as delete operations on the bitmaps. The journaling code must keep a copy of the buffer's contents prior to the undo_access call until such time as we know that the buffer has definitely been committed to disk.
We never need to know which transaction the committed data is part of, buffers touched here are guaranteed to be dirtied later and so will be committed to a new transaction in due course, at which point we can discard the old committed data pointer.
Returns error number or 0 on success.
Definition at line 881 of file transaction.c.
int journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. : transaction to add buffer modifications to : bh to be used for metadata writes
Returns an error code or 0 on success.
In full data journalling mode the buffer may be of type BJ_AsyncData, because we're write()ing a buffer which is also part of a shared mapping.
Definition at line 752 of file transaction.c.
Definition at line 2027 of file transaction.c.
void journal_lock_updates | ( | journal_t * | journal | ) |
void journal_lock_updates () - establish a transaction barrier. : Journal to establish a barrier on.
This locks out any further updates from being started, and blocks until all existing updates have completed, returning only once the journal is in a quiescent state with no updates running.
We do not use simple mutex for synchronization as there are syscalls which want to return with filesystem locked and that trips up lockdep. Also hibernate needs to lock filesystem but locked mutex then blocks hibernation. Since locking filesystem is rare operation, we use simple counter and waitqueue for locking.
Definition at line 439 of file transaction.c.
void journal_refile_buffer | ( | journal_t * | journal, |
struct journal_head * | jh | ||
) |
Definition at line 2217 of file transaction.c.
Definition at line 1214 of file transaction.c.
int journal_restart() - restart a handle. : handle to restart : nr credits requested
Restart a handle for a multi-transaction filesystem operation.
If the journal_extend() call above fails to grant new buffer credits to a running handle, a call to journal_restart will commit the handle's transaction so far and reattach the handle to a new transaction capabable of guaranteeing the requested number of credits.
Definition at line 387 of file transaction.c.
handle_t* journal_start | ( | journal_t * | journal, |
int | nblocks | ||
) |
handle_t *journal_start() - Obtain a new handle. : Journal to start transaction on. : number of block buffer we might modify
We make sure that the transaction can guarantee at least nblocks of modified buffers in the log. We block until the log can guarantee that much space.
This function is visible to journal users (like ext3fs), so is not called with the journal already locked.
Return a pointer to a newly allocated handle, or an ERR_PTR() value on failure.
Definition at line 272 of file transaction.c.
int journal_stop | ( | handle_t * | handle | ) |
int journal_stop() - complete a transaction : tranaction to complete.
All done for a particular handle.
There is not much action needed here. We just return any remaining buffer credits to the transaction and remove the handle. The only complication is that we need to start a commit operation if the filesystem is marked for synchronous update.
journal_stop itself will not usually return an error, but it may do so in unusual circumstances. In particular, expect it to return -EIO if a journal_abort has been executed since the transaction began.
Definition at line 1363 of file transaction.c.
Definition at line 1727 of file transaction.c.
void journal_unfile_buffer | ( | journal_t * | journal, |
struct journal_head * | jh | ||
) |
Definition at line 1638 of file transaction.c.
void journal_unlock_updates | ( | journal_t * | journal | ) |
void journal_unlock_updates (journal_t* journal) - release barrier : Journal to release the barrier on.
Release a transaction barrier obtained with journal_lock_updates().
Definition at line 488 of file transaction.c.