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

Go to the source code of this file.

Macros

#define DEFAULT_JNL_PERCENT   5
 
#define DEFAULT_MAX_JNL   (32*1024*1024)
 
#define DEFAULT_FANOUT   8
 
#define DEFAULT_JHEADS_CNT   1
 
#define DEFAULT_IDX_LEB   0
 
#define DEFAULT_DATA_LEB   1
 
#define DEFAULT_GC_LEB   2
 
#define DEFAULT_LSAVE_CNT   256
 
#define DEFAULT_RP_PERCENT   5
 
#define DEFAULT_MAX_RP_SIZE   (5*1024*1024)
 
#define DEFAULT_TIME_GRAN   1000000000
 

Functions

struct ubifs_sb_nodeubifs_read_sb_node (struct ubifs_info *c)
 
int ubifs_write_sb_node (struct ubifs_info *c, struct ubifs_sb_node *sup)
 
int ubifs_read_superblock (struct ubifs_info *c)
 
int ubifs_fixup_free_space (struct ubifs_info *c)
 

Macro Definition Documentation

#define DEFAULT_DATA_LEB   1

Definition at line 51 of file sb.c.

#define DEFAULT_FANOUT   8

Definition at line 44 of file sb.c.

#define DEFAULT_GC_LEB   2

Definition at line 52 of file sb.c.

#define DEFAULT_IDX_LEB   0

Definition at line 50 of file sb.c.

#define DEFAULT_JHEADS_CNT   1

Definition at line 47 of file sb.c.

#define DEFAULT_JNL_PERCENT   5

Definition at line 38 of file sb.c.

#define DEFAULT_LSAVE_CNT   256

Definition at line 55 of file sb.c.

#define DEFAULT_MAX_JNL   (32*1024*1024)

Definition at line 41 of file sb.c.

#define DEFAULT_MAX_RP_SIZE   (5*1024*1024)

Definition at line 61 of file sb.c.

#define DEFAULT_RP_PERCENT   5

Definition at line 58 of file sb.c.

#define DEFAULT_TIME_GRAN   1000000000

Definition at line 64 of file sb.c.

Function Documentation

int ubifs_fixup_free_space ( struct ubifs_info c)

ubifs_fixup_free_space - find & fix all LEBs with free space. : UBIFS file-system description object

This function fixes up LEBs containing free space on first mount, if the appropriate flag was set when the FS was created. Each LEB with one or more empty min. I/O unit (i.e. free-space-count > 0) is re-written, to make sure the free space is actually erased. E.g., this is necessary for some NAND chips, since the free space may have been programmed like real "0xff" data (generating a non-0xff ECC), causing future writes to the not-really-erased NAND pages to behave badly. After the space is fixed up, the superblock flag is cleared, so that this is skipped for all future mounts.

Definition at line 778 of file sb.c.

struct ubifs_sb_node* ubifs_read_sb_node ( struct ubifs_info c)
read

ubifs_read_sb_node - read superblock node. : UBIFS file-system description object

This function returns a pointer to the superblock node or a negative error code. Note, the user of this function is responsible of kfree()'ing the returned superblock buffer.

Definition at line 482 of file sb.c.

int ubifs_read_superblock ( struct ubifs_info c)

ubifs_read_superblock - read superblock. : UBIFS file-system description object

This function finds, reads and checks the superblock. If an empty UBI volume is being mounted, this function creates default superblock. Returns zero in case of success, and a negative error code in case of failure.

Definition at line 524 of file sb.c.

int ubifs_write_sb_node ( struct ubifs_info c,
struct ubifs_sb_node sup 
)

ubifs_write_sb_node - write superblock node. : UBIFS file-system description object : superblock node read with 'ubifs_read_sb_node()'

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

Definition at line 508 of file sb.c.