Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
log.c File Reference
#include "ubifs.h"

Go to the source code of this file.

Data Structures

struct  done_ref
 

Functions

struct ubifs_budubifs_search_bud (struct ubifs_info *c, int lnum)
 
struct ubifs_wbufubifs_get_wbuf (struct ubifs_info *c, int lnum)
 
void ubifs_add_bud (struct ubifs_info *c, struct ubifs_bud *bud)
 
int ubifs_add_bud_to_log (struct ubifs_info *c, int jhead, int lnum, int offs)
 
int ubifs_log_start_commit (struct ubifs_info *c, int *ltail_lnum)
 
int ubifs_log_end_commit (struct ubifs_info *c, int ltail_lnum)
 
int ubifs_log_post_commit (struct ubifs_info *c, int old_ltail_lnum)
 
int ubifs_consolidate_log (struct ubifs_info *c)
 

Function Documentation

void ubifs_add_bud ( struct ubifs_info c,
struct ubifs_bud bud 
)

ubifs_add_bud - add bud LEB to the tree of buds and its journal head list. : UBIFS file-system description object : the bud to add

Definition at line 120 of file log.c.

int ubifs_add_bud_to_log ( struct ubifs_info c,
int  jhead,
int  lnum,
int  offs 
)

ubifs_add_bud_to_log - add a new bud to the log. : UBIFS file-system description object : journal head the bud belongs to : LEB number of the bud : starting offset of the bud

This function writes reference node for the new bud LEB it to the log, and adds it to the buds tress. It also makes sure that log size does not exceed the 'c->max_bud_bytes' limit. Returns zero in case of success, %-EAGAIN if commit is required, and a negative error codes in case of failure.

Definition at line 172 of file log.c.

int ubifs_consolidate_log ( struct ubifs_info c)

ubifs_consolidate_log - consolidate the log. : UBIFS file-system description object

Repeated failed commits could cause the log to be full, but at least 1 LEB is needed for commit. This function rewrites the reference nodes in the log omitting duplicates, and failed CS nodes, and leaving no gaps.

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

Definition at line 641 of file log.c.

struct ubifs_wbuf* ubifs_get_wbuf ( struct ubifs_info c,
int  lnum 
)
read

ubifs_get_wbuf - get the wbuf associated with a LEB, if there is one. : UBIFS file-system description object : logical eraseblock number to search

This functions returns the wbuf for or NULL if there is not one.

Definition at line 71 of file log.c.

int ubifs_log_end_commit ( struct ubifs_info c,
int  ltail_lnum 
)

ubifs_log_end_commit - end commit. : UBIFS file-system description object : new log tail LEB number

This function is called on when the commit operation was finished. It moves log tail to new position and unmaps LEBs which contain obsolete data. Returns zero in case of success and a negative error code in case of failure.

Definition at line 454 of file log.c.

int ubifs_log_post_commit ( struct ubifs_info c,
int  old_ltail_lnum 
)

ubifs_log_post_commit - things to do after commit is completed. : UBIFS file-system description object : old log tail LEB number

Release buds only after commit is completed, because they must be unchanged if recovery is needed.

Unmap log LEBs only after commit is completed, because they may be needed for recovery.

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

Definition at line 498 of file log.c.

int ubifs_log_start_commit ( struct ubifs_info c,
int ltail_lnum 
)

ubifs_log_start_commit - start commit. : UBIFS file-system description object : return new log tail LEB number

The commit operation starts with writing "commit start" node to the log and reference nodes for all journal heads which will define new journal after the commit has been finished. The commit start and reference nodes are written in one go to the nearest empty log LEB (hence, when commit is finished UBIFS may safely unmap all the previous log LEBs). This function returns zero in case of success and a negative error code in case of failure.

Definition at line 354 of file log.c.

struct ubifs_bud* ubifs_search_bud ( struct ubifs_info c,
int  lnum 
)
read

ubifs_search_bud - search bud LEB. : UBIFS file-system description object : logical eraseblock number to search

This function searches bud LEB . Returns bud description object in case of success and NULL if there is no bud with this LEB number.

Definition at line 42 of file log.c.