Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
commit.c File Reference
#include <linux/freezer.h>
#include <linux/kthread.h>
#include <linux/slab.h>
#include "ubifs.h"

Go to the source code of this file.

Data Structures

struct  idx_node
 

Functions

int ubifs_bg_thread (void *info)
 
void ubifs_commit_required (struct ubifs_info *c)
 
void ubifs_request_bg_commit (struct ubifs_info *c)
 
int ubifs_run_commit (struct ubifs_info *c)
 
int ubifs_gc_should_commit (struct ubifs_info *c)
 
int dbg_old_index_check_init (struct ubifs_info *c, struct ubifs_zbranch *zroot)
 
int dbg_check_old_index (struct ubifs_info *c, struct ubifs_zbranch *zroot)
 

Function Documentation

int dbg_check_old_index ( struct ubifs_info c,
struct ubifs_zbranch zroot 
)

dbg_check_old_index - check the old copy of the index. : UBIFS file-system description object : root of the new index

In order to be able to recover from an unclean unmount, a complete copy of the index must exist on flash. This is the "old" index. The commit process must write the "new" index to flash without overwriting or destroying any part of the old index. This function is run at commit end in order to check that the old index does indeed exist completely intact.

This function returns %0 on success and a negative error code on failure.

Definition at line 569 of file commit.c.

int dbg_old_index_check_init ( struct ubifs_info c,
struct ubifs_zbranch zroot 
)

dbg_old_index_check_init - get information for the next old index check. : UBIFS file-system description object : root of the index

This function records information about the index that will be needed for the next old index check i.e. 'dbg_check_old_index()'.

This function returns %0 on success and a negative error code on failure.

Definition at line 530 of file commit.c.

int ubifs_bg_thread ( void info)

ubifs_bg_thread - UBIFS background thread function. : points to the file-system description object

This function implements various file-system background activities: o when a write-buffer timer expires it synchronizes the appropriate write-buffer; o when the journal is about to be full, it starts in-advance commit.

Note, other stuff like background garbage collection may be added here in future.

Definition at line 291 of file commit.c.

void ubifs_commit_required ( struct ubifs_info c)

ubifs_commit_required - set commit state to "required". : UBIFS file-system description object

This function is called if a commit is required but cannot be done from the calling function, so it is just flagged instead.

Definition at line 342 of file commit.c.

int ubifs_gc_should_commit ( struct ubifs_info c)

ubifs_gc_should_commit - determine if it is time for GC to run commit. : UBIFS file-system description object

This function is called by garbage collection to determine if commit should be run. If commit state is , which means that the journal is full enough to start commit, this function returns true. It is not absolutely necessary to commit yet, but it feels like this should be better then to keep doing GC. This function returns %1 if GC has to initiate commit and %0 if not.

Definition at line 483 of file commit.c.

void ubifs_request_bg_commit ( struct ubifs_info c)

ubifs_request_bg_commit - notify the background thread to do a commit. : UBIFS file-system description object

This function is called if the journal is full enough to make a commit worthwhile, so background thread is kicked to start it.

Definition at line 372 of file commit.c.

int ubifs_run_commit ( struct ubifs_info c)

ubifs_run_commit - run or wait for commit. : UBIFS file-system description object

This function runs commit and returns zero in case of success and a negative error code in case of failure.

Definition at line 415 of file commit.c.