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

Go to the source code of this file.

Functions

void ubifs_add_to_cat (struct ubifs_info *c, struct ubifs_lprops *lprops, int cat)
 
void ubifs_replace_cat (struct ubifs_info *c, struct ubifs_lprops *old_lprops, struct ubifs_lprops *new_lprops)
 
void ubifs_ensure_cat (struct ubifs_info *c, struct ubifs_lprops *lprops)
 
int ubifs_categorize_lprops (const struct ubifs_info *c, const struct ubifs_lprops *lprops)
 
int ubifs_calc_dark (const struct ubifs_info *c, int spc)
 
struct ubifs_lpropsubifs_change_lp (struct ubifs_info *c, const struct ubifs_lprops *lp, int free, int dirty, int flags, int idx_gc_cnt)
 
void ubifs_get_lp_stats (struct ubifs_info *c, struct ubifs_lp_stats *lst)
 
int ubifs_change_one_lp (struct ubifs_info *c, int lnum, int free, int dirty, int flags_set, int flags_clean, int idx_gc_cnt)
 
int ubifs_update_one_lp (struct ubifs_info *c, int lnum, int free, int dirty, int flags_set, int flags_clean)
 
int ubifs_read_one_lp (struct ubifs_info *c, int lnum, struct ubifs_lprops *lp)
 
struct ubifs_lpropsubifs_fast_find_free (struct ubifs_info *c)
 
struct ubifs_lpropsubifs_fast_find_empty (struct ubifs_info *c)
 
struct ubifs_lpropsubifs_fast_find_freeable (struct ubifs_info *c)
 
struct ubifs_lpropsubifs_fast_find_frdi_idx (struct ubifs_info *c)
 
int dbg_check_cats (struct ubifs_info *c)
 
void dbg_check_heap (struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, int add_pos)
 
int dbg_check_lprops (struct ubifs_info *c)
 

Function Documentation

int dbg_check_cats ( struct ubifs_info c)

dbg_check_cats - check category heaps and lists. : UBIFS file-system description object

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

Definition at line 865 of file lprops.c.

void dbg_check_heap ( struct ubifs_info c,
struct ubifs_lpt_heap heap,
int  cat,
int  add_pos 
)

Definition at line 964 of file lprops.c.

int dbg_check_lprops ( struct ubifs_info c)

dbg_check_lprops - check all LEB properties. : UBIFS file-system description object

This function checks all LEB properties and makes sure they are all correct. It returns zero if everything is fine, %-EINVAL if there is an inconsistency and other negative error codes in case of other errors. This function is called while the file system is locked (because of commit start), so no additional locking is required. Note that locking the LPT mutex would cause a circular lock dependency with the TNC mutex.

Definition at line 1266 of file lprops.c.

void ubifs_add_to_cat ( struct ubifs_info c,
struct ubifs_lprops lprops,
int  cat 
)

ubifs_add_to_cat - add LEB properties to a category list or heap. : UBIFS file-system description object : LEB properties to add : LEB category to which to add

LEB properties are categorized to enable fast find operations.

Definition at line 275 of file lprops.c.

int ubifs_calc_dark ( const struct ubifs_info c,
int  spc 
)

ubifs_calc_dark - calculate LEB dark space size. : the UBIFS file-system description object : amount of free and dirty space in the LEB

This function calculates and returns amount of dark space in an LEB which has bytes of free and dirty space.

UBIFS is trying to account the space which might not be usable, and this space is called "dark space". For example, if an LEB has only %512 free bytes, it is dark space, because it cannot fit a large data node.

Definition at line 481 of file lprops.c.

int ubifs_categorize_lprops ( const struct ubifs_info c,
const struct ubifs_lprops lprops 
)

ubifs_categorize_lprops - categorize LEB properties. : UBIFS file-system description object : LEB properties to categorize

LEB properties are categorized to enable fast find operations. This function returns the LEB category to which the LEB properties belong. Note however that if the LEB category is stored as a heap and the heap is full, the LEB properties may have their category changed to LPROPS_UNCAT.

Definition at line 410 of file lprops.c.

struct ubifs_lprops* ubifs_change_lp ( struct ubifs_info c,
const struct ubifs_lprops lp,
int  free,
int  dirty,
int  flags,
int  idx_gc_cnt 
)
read

ubifs_change_lp - change LEB properties. : the UBIFS file-system description object : LEB properties to change : new free space amount : new dirty space amount : new flags : change to the count of list

This function changes LEB properties (, or ). However, the property which has the LPROPS_NC value is not changed. Returns a pointer to the updated LEB properties on success and a negative error code on failure.

Note, the LEB properties may have had to be copied (due to COW) and consequently the pointer returned may not be the same as the pointer passed.

Definition at line 534 of file lprops.c.

int ubifs_change_one_lp ( struct ubifs_info c,
int  lnum,
int  free,
int  dirty,
int  flags_set,
int  flags_clean,
int  idx_gc_cnt 
)

ubifs_change_one_lp - change LEB properties. : the UBIFS file-system description object : LEB to change properties for : amount of free space : amount of dirty space : flags to set : flags to clean : change to the count of idx_gc list

This function changes properties of LEB . It is a helper wrapper over 'ubifs_change_lp()' which hides lprops get/release. The arguments are the same as in case of 'ubifs_change_lp()'. Returns zero in case of success and a negative error code in case of failure.

Definition at line 663 of file lprops.c.

void ubifs_ensure_cat ( struct ubifs_info c,
struct ubifs_lprops lprops 
)

ubifs_ensure_cat - ensure LEB properties are categorized. : UBIFS file-system description object : LEB properties

A LEB may have fallen off of the bottom of a heap, and ended up as un-categorized even though it has enough space for us now. If that is the case this function will put the LEB back onto a heap.

Definition at line 387 of file lprops.c.

struct ubifs_lprops* ubifs_fast_find_empty ( struct ubifs_info c)
read

ubifs_fast_find_empty - try to find an empty LEB quickly. : the UBIFS file-system description object

This function returns LEB properties for an empty LEB or NULL if the function is unable to find an empty LEB quickly.

Definition at line 792 of file lprops.c.

struct ubifs_lprops* ubifs_fast_find_frdi_idx ( struct ubifs_info c)
read

ubifs_fast_find_frdi_idx - try to find a freeable index LEB quickly. : the UBIFS file-system description object

This function returns LEB properties for a freeable index LEB or NULL if the function is unable to find a freeable index LEB quickly.

Definition at line 839 of file lprops.c.

struct ubifs_lprops* ubifs_fast_find_free ( struct ubifs_info c)
read

ubifs_fast_find_free - try to find a LEB with free space quickly. : the UBIFS file-system description object

This function returns LEB properties for a LEB with free space or NULL if the function is unable to find a LEB quickly.

Definition at line 768 of file lprops.c.

struct ubifs_lprops* ubifs_fast_find_freeable ( struct ubifs_info c)
read

ubifs_fast_find_freeable - try to find a freeable LEB quickly. : the UBIFS file-system description object

This function returns LEB properties for a freeable LEB or NULL if the function is unable to find a freeable LEB quickly.

Definition at line 815 of file lprops.c.

void ubifs_get_lp_stats ( struct ubifs_info c,
struct ubifs_lp_stats lst 
)

ubifs_get_lp_stats - get lprops statistics. : UBIFS file-system description object : return statistics

Definition at line 641 of file lprops.c.

int ubifs_read_one_lp ( struct ubifs_info c,
int  lnum,
struct ubifs_lprops lp 
)

ubifs_read_one_lp - read LEB properties. : the UBIFS file-system description object : LEB to read properties for : where to store read properties

This helper function reads properties of a LEB and stores them in . Returns zero in case of success and a negative error code in case of failure.

Definition at line 739 of file lprops.c.

void ubifs_replace_cat ( struct ubifs_info c,
struct ubifs_lprops old_lprops,
struct ubifs_lprops new_lprops 
)

ubifs_replace_cat - replace lprops in a category list or heap. : UBIFS file-system description object : LEB properties to replace : LEB properties with which to replace

During commit it is sometimes necessary to copy a pnode (see dirty_cow_pnode) and the lprops that the pnode contains. When that happens, references in category lists and heaps must be replaced. This function does that.

Definition at line 355 of file lprops.c.

int ubifs_update_one_lp ( struct ubifs_info c,
int  lnum,
int  free,
int  dirty,
int  flags_set,
int  flags_clean 
)

ubifs_update_one_lp - update LEB properties. : the UBIFS file-system description object : LEB to change properties for : amount of free space : amount of dirty space to add : flags to set : flags to clean

This function is the same as 'ubifs_change_one_lp()' but is added to current dirty space, not substitutes it.

Definition at line 702 of file lprops.c.