Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations
ubifs.h File Reference
#include <asm/div64.h>
#include <linux/statfs.h>
#include <linux/fs.h>
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/mtd/ubi.h>
#include <linux/pagemap.h>
#include <linux/backing-dev.h>
#include "ubifs-media.h"
#include "debug.h"
#include "misc.h"
#include "key.h"

Go to the source code of this file.

Data Structures

struct  ubifs_old_idx
 
union  ubifs_key
 
struct  ubifs_scan_node
 
struct  ubifs_scan_leb
 
struct  ubifs_gced_idx_leb
 
struct  ubifs_inode
 
struct  ubifs_unclean_leb
 
struct  ubifs_lprops
 
struct  ubifs_lpt_lprops
 
struct  ubifs_lp_stats
 
struct  ubifs_cnode
 
struct  ubifs_pnode
 
struct  ubifs_nbranch
 
struct  ubifs_nnode
 
struct  ubifs_lpt_heap
 
struct  ubifs_wbuf
 
struct  ubifs_bud
 
struct  ubifs_jhead
 
struct  ubifs_zbranch
 
struct  ubifs_znode
 
struct  bu_info
 
struct  ubifs_node_range
 
struct  ubifs_compressor
 
struct  ubifs_budget_req
 
struct  ubifs_orphan
 
struct  ubifs_mount_opts
 
struct  ubifs_budg_info
 
struct  ubifs_info
 

Macros

#define UBIFS_VERSION   1
 
#define ubifs_msg(fmt,...)   pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__)
 
#define ubifs_err(fmt,...)
 
#define ubifs_warn(fmt,...)
 
#define UBIFS_SUPER_MAGIC   0x24051905
 
#define UBIFS_BLOCKS_PER_PAGE   (PAGE_CACHE_SIZE / UBIFS_BLOCK_SIZE)
 
#define UBIFS_BLOCKS_PER_PAGE_SHIFT   (PAGE_CACHE_SHIFT - UBIFS_BLOCK_SHIFT)
 
#define SQNUM_WARN_WATERMARK   0xFFFFFFFF00000000ULL
 
#define SQNUM_WATERMARK   0xFFFFFFFFFF000000ULL
 
#define MIN_INDEX_LEBS   2
 
#define MIN_WRITE_SZ   (UBIFS_DATA_NODE_SZ + 8)
 
#define INUM_WARN_WATERMARK   0xFFF00000
 
#define INUM_WATERMARK   0xFFFFFF00
 
#define LPT_HEAP_SZ   256
 
#define BGT_NAME_PATTERN   "ubifs_bgt%d_%d"
 
#define WBUF_TIMEOUT_SOFTLIMIT   3
 
#define WBUF_TIMEOUT_HARDLIMIT   5
 
#define MAX_INUM   0xFFFFFFFF
 
#define NONDATA_JHEADS_CNT   2
 
#define GCHD   UBIFS_GC_HEAD
 
#define BASEHD   UBIFS_BASE_HEAD
 
#define DATAHD   UBIFS_DATA_HEAD
 
#define LPROPS_NC   0x80000001
 
#define UBIFS_TRUN_KEY   UBIFS_KEY_TYPES_CNT
 
#define UBIFS_INVALID_KEY   UBIFS_KEY_TYPES_CNT
 
#define CALC_DENT_SIZE(name_len)   ALIGN(UBIFS_DENT_NODE_SZ + (name_len) + 1, 8)
 
#define CALC_XATTR_BYTES(data_len)   ALIGN(UBIFS_INO_NODE_SZ + (data_len) + 1, 8)
 
#define OLD_ZNODE_AGE   20
 
#define YOUNG_ZNODE_AGE   5
 
#define WORST_COMPR_FACTOR   2
 
#define COMPRESSED_DATA_NODE_BUF_SZ   (UBIFS_DATA_NODE_SZ + UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR)
 
#define BOTTOM_UP_HEIGHT   64
 
#define UBIFS_MAX_BULK_READ   32
 

Typedefs

typedef int(* ubifs_lpt_scan_callback )(struct ubifs_info *c, const struct ubifs_lprops *lprops, int in_tree, void *data)
 

Enumerations

enum  { WB_MUTEX_1 = 0, WB_MUTEX_2 = 1, WB_MUTEX_3 = 2 }
 
enum  { DIRTY_ZNODE = 0, COW_ZNODE = 1, OBSOLETE_ZNODE = 2 }
 
enum  {
  COMMIT_RESTING = 0, COMMIT_BACKGROUND, COMMIT_REQUIRED, COMMIT_RUNNING_BACKGROUND,
  COMMIT_RUNNING_REQUIRED, COMMIT_BROKEN
}
 
enum  {
  SCANNED_GARBAGE = 0, SCANNED_EMPTY_SPACE = -1, SCANNED_A_NODE = -2, SCANNED_A_CORRUPT_NODE = -3,
  SCANNED_A_BAD_PAD_NODE = -4
}
 
enum  { DIRTY_CNODE = 0, OBSOLETE_CNODE = 1, COW_CNODE = 2 }
 
enum  { LTAB_DIRTY = 1, LSAVE_DIRTY = 2 }
 
enum  { LEB_FREED, LEB_FREED_IDX, LEB_RETAINED }
 
enum  {
  LPROPS_UNCAT = 0, LPROPS_DIRTY = 1, LPROPS_DIRTY_IDX = 2, LPROPS_FREE = 3,
  LPROPS_HEAP_CNT = 3, LPROPS_EMPTY = 4, LPROPS_FREEABLE = 5, LPROPS_FRDI_IDX = 6,
  LPROPS_CAT_MASK = 15, LPROPS_TAKEN = 16, LPROPS_INDEX = 32
}
 
enum  { LPT_SCAN_CONTINUE = 0, LPT_SCAN_ADD = 1, LPT_SCAN_STOP = 2 }
 

: compressor name

struct ubifs_compressor - UBIFS compressor description structure. : compressor type (UBIFS_COMPR_LZO, etc) : cryptoapi compressor handle : mutex used during compression : mutex used during decompression

: cryptoapi compressor name

struct list_head ubifs_infos
 
spinlock_t ubifs_infos_lock
 
atomic_long_t ubifs_clean_zn_cnt
 
struct kmem_cacheubifs_inode_slab
 
struct super_operations ubifs_super_operations
 
struct address_space_operations ubifs_file_address_operations
 
struct file_operations ubifs_file_operations
 
struct inode_operations ubifs_file_inode_operations
 
struct file_operations ubifs_dir_operations
 
struct inode_operations ubifs_dir_inode_operations
 
struct inode_operations ubifs_symlink_inode_operations
 
struct backing_dev_info ubifs_backing_dev_info
 
struct ubifs_compressorubifs_compressors [UBIFS_COMPR_TYPES_CNT]
 
void ubifs_ro_mode (struct ubifs_info *c, int err)
 
int ubifs_leb_read (const struct ubifs_info *c, int lnum, void *buf, int offs, int len, int even_ebadmsg)
 
int ubifs_leb_write (struct ubifs_info *c, int lnum, const void *buf, int offs, int len)
 
int ubifs_leb_change (struct ubifs_info *c, int lnum, const void *buf, int len)
 
int ubifs_leb_unmap (struct ubifs_info *c, int lnum)
 
int ubifs_leb_map (struct ubifs_info *c, int lnum)
 
int ubifs_is_mapped (const struct ubifs_info *c, int lnum)
 
int ubifs_wbuf_write_nolock (struct ubifs_wbuf *wbuf, void *buf, int len)
 
int ubifs_wbuf_seek_nolock (struct ubifs_wbuf *wbuf, int lnum, int offs)
 
int ubifs_wbuf_init (struct ubifs_info *c, struct ubifs_wbuf *wbuf)
 
int ubifs_read_node (const struct ubifs_info *c, void *buf, int type, int len, int lnum, int offs)
 
int ubifs_read_node_wbuf (struct ubifs_wbuf *wbuf, void *buf, int type, int len, int lnum, int offs)
 
int ubifs_write_node (struct ubifs_info *c, void *node, int len, int lnum, int offs)
 
int ubifs_check_node (const struct ubifs_info *c, const void *buf, int lnum, int offs, int quiet, int must_chk_crc)
 
void ubifs_prepare_node (struct ubifs_info *c, void *buf, int len, int pad)
 
void ubifs_prep_grp_node (struct ubifs_info *c, void *node, int len, int last)
 
int ubifs_io_init (struct ubifs_info *c)
 
void ubifs_pad (const struct ubifs_info *c, void *buf, int pad)
 
int ubifs_wbuf_sync_nolock (struct ubifs_wbuf *wbuf)
 
int ubifs_bg_wbufs_sync (struct ubifs_info *c)
 
void ubifs_wbuf_add_ino_nolock (struct ubifs_wbuf *wbuf, ino_t inum)
 
int ubifs_sync_wbufs_by_inode (struct ubifs_info *c, struct inode *inode)
 
struct ubifs_scan_lebubifs_scan (const struct ubifs_info *c, int lnum, int offs, void *sbuf, int quiet)
 
void ubifs_scan_destroy (struct ubifs_scan_leb *sleb)
 
int ubifs_scan_a_node (const struct ubifs_info *c, void *buf, int len, int lnum, int offs, int quiet)
 
struct ubifs_scan_lebubifs_start_scan (const struct ubifs_info *c, int lnum, int offs, void *sbuf)
 
void ubifs_end_scan (const struct ubifs_info *c, struct ubifs_scan_leb *sleb, int lnum, int offs)
 
int ubifs_add_snod (const struct ubifs_info *c, struct ubifs_scan_leb *sleb, void *buf, int offs)
 
void ubifs_scanned_corruption (const struct ubifs_info *c, int lnum, int offs, void *buf)
 
void ubifs_add_bud (struct ubifs_info *c, struct ubifs_bud *bud)
 
void ubifs_create_buds_lists (struct ubifs_info *c)
 
int ubifs_add_bud_to_log (struct ubifs_info *c, int jhead, int lnum, int offs)
 
struct ubifs_budubifs_search_bud (struct ubifs_info *c, int lnum)
 
struct ubifs_wbufubifs_get_wbuf (struct ubifs_info *c, int lnum)
 
int ubifs_log_start_commit (struct ubifs_info *c, int *ltail_lnum)
 
int ubifs_log_end_commit (struct ubifs_info *c, int new_ltail_lnum)
 
int ubifs_log_post_commit (struct ubifs_info *c, int old_ltail_lnum)
 
int ubifs_consolidate_log (struct ubifs_info *c)
 
int ubifs_jnl_update (struct ubifs_info *c, const struct inode *dir, const struct qstr *nm, const struct inode *inode, int deletion, int xent)
 
int ubifs_jnl_write_data (struct ubifs_info *c, const struct inode *inode, const union ubifs_key *key, const void *buf, int len)
 
int ubifs_jnl_write_inode (struct ubifs_info *c, const struct inode *inode)
 
int ubifs_jnl_delete_inode (struct ubifs_info *c, const struct inode *inode)
 
int ubifs_jnl_rename (struct ubifs_info *c, const struct inode *old_dir, const struct dentry *old_dentry, const struct inode *new_dir, const struct dentry *new_dentry, int sync)
 
int ubifs_jnl_truncate (struct ubifs_info *c, const struct inode *inode, loff_t old_size, loff_t new_size)
 
int ubifs_jnl_delete_xattr (struct ubifs_info *c, const struct inode *host, const struct inode *inode, const struct qstr *nm)
 
int ubifs_jnl_change_xattr (struct ubifs_info *c, const struct inode *inode1, const struct inode *inode2)
 
int ubifs_budget_space (struct ubifs_info *c, struct ubifs_budget_req *req)
 
void ubifs_release_budget (struct ubifs_info *c, struct ubifs_budget_req *req)
 
void ubifs_release_dirty_inode_budget (struct ubifs_info *c, struct ubifs_inode *ui)
 
int ubifs_budget_inode_op (struct ubifs_info *c, struct inode *inode, struct ubifs_budget_req *req)
 
void ubifs_release_ino_dirty (struct ubifs_info *c, struct inode *inode, struct ubifs_budget_req *req)
 
void ubifs_cancel_ino_op (struct ubifs_info *c, struct inode *inode, struct ubifs_budget_req *req)
 
long long ubifs_get_free_space (struct ubifs_info *c)
 
long long ubifs_get_free_space_nolock (struct ubifs_info *c)
 
int ubifs_calc_min_idx_lebs (struct ubifs_info *c)
 
void ubifs_convert_page_budget (struct ubifs_info *c)
 
long long ubifs_reported_space (const struct ubifs_info *c, long long free)
 
long long ubifs_calc_available (const struct ubifs_info *c, int min_idx_lebs)
 
int ubifs_find_free_space (struct ubifs_info *c, int min_space, int *offs, int squeeze)
 
int ubifs_find_free_leb_for_idx (struct ubifs_info *c)
 
int ubifs_find_dirty_leb (struct ubifs_info *c, struct ubifs_lprops *ret_lp, int min_space, int pick_free)
 
int ubifs_find_dirty_idx_leb (struct ubifs_info *c)
 
int ubifs_save_dirty_idx_lnums (struct ubifs_info *c)
 
int ubifs_lookup_level0 (struct ubifs_info *c, const union ubifs_key *key, struct ubifs_znode **zn, int *n)
 
int ubifs_tnc_lookup_nm (struct ubifs_info *c, const union ubifs_key *key, void *node, const struct qstr *nm)
 
int ubifs_tnc_locate (struct ubifs_info *c, const union ubifs_key *key, void *node, int *lnum, int *offs)
 
int ubifs_tnc_add (struct ubifs_info *c, const union ubifs_key *key, int lnum, int offs, int len)
 
int ubifs_tnc_replace (struct ubifs_info *c, const union ubifs_key *key, int old_lnum, int old_offs, int lnum, int offs, int len)
 
int ubifs_tnc_add_nm (struct ubifs_info *c, const union ubifs_key *key, int lnum, int offs, int len, const struct qstr *nm)
 
int ubifs_tnc_remove (struct ubifs_info *c, const union ubifs_key *key)
 
int ubifs_tnc_remove_nm (struct ubifs_info *c, const union ubifs_key *key, const struct qstr *nm)
 
int ubifs_tnc_remove_range (struct ubifs_info *c, union ubifs_key *from_key, union ubifs_key *to_key)
 
int ubifs_tnc_remove_ino (struct ubifs_info *c, ino_t inum)
 
struct ubifs_dent_nodeubifs_tnc_next_ent (struct ubifs_info *c, union ubifs_key *key, const struct qstr *nm)
 
void ubifs_tnc_close (struct ubifs_info *c)
 
int ubifs_tnc_has_node (struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs, int is_idx)
 
int ubifs_dirty_idx_node (struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs)
 
void destroy_old_idx (struct ubifs_info *c)
 
int is_idx_node_in_tnc (struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs)
 
int insert_old_idx_znode (struct ubifs_info *c, struct ubifs_znode *znode)
 
int ubifs_tnc_get_bu_keys (struct ubifs_info *c, struct bu_info *bu)
 
int ubifs_tnc_bulk_read (struct ubifs_info *c, struct bu_info *bu)
 
struct ubifs_znodeubifs_tnc_levelorder_next (struct ubifs_znode *zr, struct ubifs_znode *znode)
 
int ubifs_search_zbranch (const struct ubifs_info *c, const struct ubifs_znode *znode, const union ubifs_key *key, int *n)
 
struct ubifs_znodeubifs_tnc_postorder_first (struct ubifs_znode *znode)
 
struct ubifs_znodeubifs_tnc_postorder_next (struct ubifs_znode *znode)
 
long ubifs_destroy_tnc_subtree (struct ubifs_znode *zr)
 
struct ubifs_znodeubifs_load_znode (struct ubifs_info *c, struct ubifs_zbranch *zbr, struct ubifs_znode *parent, int iip)
 
int ubifs_tnc_read_node (struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
 
int ubifs_tnc_start_commit (struct ubifs_info *c, struct ubifs_zbranch *zroot)
 
int ubifs_tnc_end_commit (struct ubifs_info *c)
 
int ubifs_shrinker (struct shrinker *shrink, struct shrink_control *sc)
 
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)
 
void ubifs_recovery_commit (struct ubifs_info *c)
 
int ubifs_gc_should_commit (struct ubifs_info *c)
 
void ubifs_wait_for_commit (struct ubifs_info *c)
 
int ubifs_read_master (struct ubifs_info *c)
 
int ubifs_write_master (struct ubifs_info *c)
 
int ubifs_read_superblock (struct ubifs_info *c)
 
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_fixup_free_space (struct ubifs_info *c)
 
int ubifs_validate_entry (struct ubifs_info *c, const struct ubifs_dent_node *dent)
 
int ubifs_replay_journal (struct ubifs_info *c)
 
int ubifs_garbage_collect (struct ubifs_info *c, int anyway)
 
int ubifs_gc_start_commit (struct ubifs_info *c)
 
int ubifs_gc_end_commit (struct ubifs_info *c)
 
void ubifs_destroy_idx_gc (struct ubifs_info *c)
 
int ubifs_get_idx_gc_leb (struct ubifs_info *c)
 
int ubifs_garbage_collect_leb (struct ubifs_info *c, struct ubifs_lprops *lp)
 
int ubifs_add_orphan (struct ubifs_info *c, ino_t inum)
 
void ubifs_delete_orphan (struct ubifs_info *c, ino_t inum)
 
int ubifs_orphan_start_commit (struct ubifs_info *c)
 
int ubifs_orphan_end_commit (struct ubifs_info *c)
 
int ubifs_mount_orphans (struct ubifs_info *c, int unclean, int read_only)
 
int ubifs_clear_orphans (struct ubifs_info *c)
 
int ubifs_calc_lpt_geom (struct ubifs_info *c)
 
int ubifs_create_dflt_lpt (struct ubifs_info *c, int *main_lebs, int lpt_first, int *lpt_lebs, int *big_lpt)
 
int ubifs_lpt_init (struct ubifs_info *c, int rd, int wr)
 
struct ubifs_lpropsubifs_lpt_lookup (struct ubifs_info *c, int lnum)
 
struct ubifs_lpropsubifs_lpt_lookup_dirty (struct ubifs_info *c, int lnum)
 
int ubifs_lpt_scan_nolock (struct ubifs_info *c, int start_lnum, int end_lnum, ubifs_lpt_scan_callback scan_cb, void *data)
 
void ubifs_pack_lsave (struct ubifs_info *c, void *buf, int *lsave)
 
void ubifs_pack_ltab (struct ubifs_info *c, void *buf, struct ubifs_lpt_lprops *ltab)
 
void ubifs_pack_pnode (struct ubifs_info *c, void *buf, struct ubifs_pnode *pnode)
 
void ubifs_pack_nnode (struct ubifs_info *c, void *buf, struct ubifs_nnode *nnode)
 
struct ubifs_pnodeubifs_get_pnode (struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
 
struct ubifs_nnodeubifs_get_nnode (struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
 
int ubifs_read_nnode (struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
 
void ubifs_add_lpt_dirt (struct ubifs_info *c, int lnum, int dirty)
 
void ubifs_add_nnode_dirt (struct ubifs_info *c, struct ubifs_nnode *nnode)
 
uint32_t ubifs_unpack_bits (uint8_t **addr, int *pos, int nrbits)
 
struct ubifs_nnodeubifs_first_nnode (struct ubifs_info *c, int *hght)
 
int ubifs_unpack_nnode (const struct ubifs_info *c, void *buf, struct ubifs_nnode *nnode)
 
int ubifs_lpt_start_commit (struct ubifs_info *c)
 
int ubifs_lpt_end_commit (struct ubifs_info *c)
 
int ubifs_lpt_post_commit (struct ubifs_info *c)
 
void ubifs_lpt_free (struct ubifs_info *c, int wr_only)
 
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)
 
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_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 ubifs_calc_dark (const struct ubifs_info *c, int spc)
 
int ubifs_fsync (struct file *file, loff_t start, loff_t end, int datasync)
 
int ubifs_setattr (struct dentry *dentry, struct iattr *attr)
 
struct inodeubifs_new_inode (struct ubifs_info *c, const struct inode *dir, umode_t mode)
 
int ubifs_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 
int ubifs_setxattr (struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
 
ssize_t ubifs_getxattr (struct dentry *dentry, const char *name, void *buf, size_t size)
 
ssize_t ubifs_listxattr (struct dentry *dentry, char *buffer, size_t size)
 
int ubifs_removexattr (struct dentry *dentry, const char *name)
 
struct inodeubifs_iget (struct super_block *sb, unsigned long inum)
 
int ubifs_recover_master_node (struct ubifs_info *c)
 
int ubifs_write_rcvrd_mst_node (struct ubifs_info *c)
 
struct ubifs_scan_lebubifs_recover_leb (struct ubifs_info *c, int lnum, int offs, void *sbuf, int jhead)
 
struct ubifs_scan_lebubifs_recover_log_leb (struct ubifs_info *c, int lnum, int offs, void *sbuf)
 
int ubifs_recover_inl_heads (struct ubifs_info *c, void *sbuf)
 
int ubifs_clean_lebs (struct ubifs_info *c, void *sbuf)
 
int ubifs_rcvry_gc_commit (struct ubifs_info *c)
 
int ubifs_recover_size_accum (struct ubifs_info *c, union ubifs_key *key, int deletion, loff_t new_size)
 
int ubifs_recover_size (struct ubifs_info *c)
 
void ubifs_destroy_size_tree (struct ubifs_info *c)
 
long ubifs_ioctl (struct file *file, unsigned int cmd, unsigned long arg)
 
void ubifs_set_inode_flags (struct inode *inode)
 
int __init ubifs_compressors_init (void)
 
void ubifs_compressors_exit (void)
 
void ubifs_compress (const void *in_buf, int in_len, void *out_buf, int *out_len, int *compr_type)
 
int ubifs_decompress (const void *buf, int len, void *out, int *out_len, int compr_type)
 

Macro Definition Documentation

#define BASEHD   UBIFS_BASE_HEAD

Definition at line 107 of file ubifs.h.

#define BGT_NAME_PATTERN   "ubifs_bgt%d_%d"

Definition at line 93 of file ubifs.h.

#define BOTTOM_UP_HEIGHT   64

Definition at line 157 of file ubifs.h.

#define CALC_DENT_SIZE (   name_len)    ALIGN(UBIFS_DENT_NODE_SZ + (name_len) + 1, 8)

Definition at line 129 of file ubifs.h.

#define CALC_XATTR_BYTES (   data_len)    ALIGN(UBIFS_INO_NODE_SZ + (data_len) + 1, 8)

Definition at line 132 of file ubifs.h.

#define COMPRESSED_DATA_NODE_BUF_SZ   (UBIFS_DATA_NODE_SZ + UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR)

Definition at line 153 of file ubifs.h.

#define DATAHD   UBIFS_DATA_HEAD

Definition at line 108 of file ubifs.h.

#define GCHD   UBIFS_GC_HEAD

Definition at line 106 of file ubifs.h.

#define INUM_WARN_WATERMARK   0xFFF00000

Definition at line 83 of file ubifs.h.

#define INUM_WATERMARK   0xFFFFFF00

Definition at line 84 of file ubifs.h.

#define LPROPS_NC   0x80000001

Definition at line 111 of file ubifs.h.

#define LPT_HEAP_SZ   256

Definition at line 87 of file ubifs.h.

#define MAX_INUM   0xFFFFFFFF

Definition at line 100 of file ubifs.h.

#define MIN_INDEX_LEBS   2

Definition at line 72 of file ubifs.h.

#define MIN_WRITE_SZ   (UBIFS_DATA_NODE_SZ + 8)

Definition at line 75 of file ubifs.h.

#define NONDATA_JHEADS_CNT   2

Definition at line 103 of file ubifs.h.

#define OLD_ZNODE_AGE   20

Definition at line 140 of file ubifs.h.

#define SQNUM_WARN_WATERMARK   0xFFFFFFFF00000000ULL

Definition at line 63 of file ubifs.h.

#define SQNUM_WATERMARK   0xFFFFFFFFFF000000ULL

Definition at line 64 of file ubifs.h.

#define UBIFS_BLOCKS_PER_PAGE   (PAGE_CACHE_SIZE / UBIFS_BLOCK_SIZE)

Definition at line 59 of file ubifs.h.

#define UBIFS_BLOCKS_PER_PAGE_SHIFT   (PAGE_CACHE_SHIFT - UBIFS_BLOCK_SHIFT)

Definition at line 60 of file ubifs.h.

#define ubifs_err (   fmt,
  ... 
)
Value:
pr_err("UBIFS error (pid %d): %s: " fmt "\n", current->pid, \
__func__, ##__VA_ARGS__)

Definition at line 47 of file ubifs.h.

#define UBIFS_INVALID_KEY   UBIFS_KEY_TYPES_CNT

Definition at line 123 of file ubifs.h.

#define UBIFS_MAX_BULK_READ   32

Definition at line 160 of file ubifs.h.

#define ubifs_msg (   fmt,
  ... 
)    pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__)

Definition at line 45 of file ubifs.h.

#define UBIFS_SUPER_MAGIC   0x24051905

Definition at line 56 of file ubifs.h.

#define UBIFS_TRUN_KEY   UBIFS_KEY_TYPES_CNT

Definition at line 122 of file ubifs.h.

#define UBIFS_VERSION   1

Definition at line 42 of file ubifs.h.

#define ubifs_warn (   fmt,
  ... 
)
Value:
pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \
current->pid, __func__, ##__VA_ARGS__)

Definition at line 51 of file ubifs.h.

#define WBUF_TIMEOUT_HARDLIMIT   5

Definition at line 97 of file ubifs.h.

#define WBUF_TIMEOUT_SOFTLIMIT   3

Definition at line 96 of file ubifs.h.

#define WORST_COMPR_FACTOR   2

Definition at line 148 of file ubifs.h.

#define YOUNG_ZNODE_AGE   5

Definition at line 141 of file ubifs.h.

Typedef Documentation

typedef int(* ubifs_lpt_scan_callback)(struct ubifs_info *c, const struct ubifs_lprops *lprops, int in_tree, void *data)

Definition at line 639 of file ubifs.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
WB_MUTEX_1 
WB_MUTEX_2 
WB_MUTEX_3 

Definition at line 165 of file ubifs.h.

anonymous enum
Enumerator:
DIRTY_ZNODE 
COW_ZNODE 
OBSOLETE_ZNODE 

Definition at line 181 of file ubifs.h.

anonymous enum
Enumerator:
COMMIT_RESTING 
COMMIT_BACKGROUND 
COMMIT_REQUIRED 
COMMIT_RUNNING_BACKGROUND 
COMMIT_RUNNING_REQUIRED 
COMMIT_BROKEN 

Definition at line 197 of file ubifs.h.

anonymous enum
Enumerator:
SCANNED_GARBAGE 
SCANNED_EMPTY_SPACE 
SCANNED_A_NODE 
SCANNED_A_CORRUPT_NODE 
SCANNED_A_BAD_PAD_NODE 

Definition at line 217 of file ubifs.h.

anonymous enum
Enumerator:
DIRTY_CNODE 
OBSOLETE_CNODE 
COW_CNODE 

Definition at line 233 of file ubifs.h.

anonymous enum
Enumerator:
LTAB_DIRTY 
LSAVE_DIRTY 

Definition at line 245 of file ubifs.h.

anonymous enum
Enumerator:
LEB_FREED 
LEB_FREED_IDX 
LEB_RETAINED 

Definition at line 256 of file ubifs.h.

anonymous enum
Enumerator:
LPROPS_UNCAT 
LPROPS_DIRTY 
LPROPS_DIRTY_IDX 
LPROPS_FREE 
LPROPS_HEAP_CNT 
LPROPS_EMPTY 
LPROPS_FREEABLE 
LPROPS_FRDI_IDX 
LPROPS_CAT_MASK 
LPROPS_TAKEN 
LPROPS_INDEX 

Definition at line 446 of file ubifs.h.

anonymous enum
Enumerator:
LPT_SCAN_CONTINUE 
LPT_SCAN_ADD 
LPT_SCAN_STOP 

Definition at line 630 of file ubifs.h.

Function Documentation

void destroy_old_idx ( struct ubifs_info c)

destroy_old_idx - destroy the old_idx RB-tree. : UBIFS file-system description object

During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit.

Definition at line 179 of file tnc.c.

int insert_old_idx_znode ( struct ubifs_info c,
struct ubifs_znode znode 
)

insert_old_idx_znode - record a znode obsoleted since last commit start. : UBIFS file-system description object : znode of obsoleted index node

Returns %0 on success, and a negative error code on failure.

Definition at line 118 of file tnc.c.

int is_idx_node_in_tnc ( struct ubifs_info c,
union ubifs_key key,
int  level,
int  lnum,
int  offs 
)

is_idx_node_in_tnc - determine if an index node is in the TNC. : UBIFS file-system description object : key of index node : index node level : LEB number of index node : offset of index node

This function returns %0 if the index node is not referred to in the TNC, %1 if the index node is referred to in the TNC and the corresponding znode is dirty, %2 if an index node is referred to in the TNC and the corresponding znode is clean, and a negative error code in case of failure.

Note, the argument has to be the key of the first child. Also note, this function relies on the fact that 0:0 is never a valid LEB number and offset for a main-area node.

Definition at line 3116 of file tnc.c.

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.

void ubifs_add_lpt_dirt ( struct ubifs_info c,
int  lnum,
int  dirty 
)

ubifs_add_lpt_dirt - add dirty space to LPT LEB properties. : UBIFS file-system description object : LEB number to which to add dirty space : amount of dirty space to add

Definition at line 462 of file lpt.c.

void ubifs_add_nnode_dirt ( struct ubifs_info c,
struct ubifs_nnode nnode 
)

ubifs_add_nnode_dirt - add dirty space to LPT LEB properties. : UBIFS file-system description object : nnode for which to add dirt

Definition at line 494 of file lpt.c.

int ubifs_add_orphan ( struct ubifs_info c,
ino_t  inum 
)

ubifs_add_orphan - add an orphan. : UBIFS file-system description object : orphan inode number

Add an orphan. This function is called when an inodes link count drops to zero.

Definition at line 65 of file orphan.c.

int ubifs_add_snod ( const struct ubifs_info c,
struct ubifs_scan_leb sleb,
void buf,
int  offs 
)

ubifs_add_snod - add a scanned node to LEB scanning information. : UBIFS file-system description object : scanning information : buffer containing node : offset of node on flash

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

Definition at line 194 of file scan.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_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.

int ubifs_bg_wbufs_sync ( struct ubifs_info c)

ubifs_bg_wbufs_sync - synchronize write-buffers. : UBIFS file-system description object

This function is called by background thread to synchronize write-buffers. Returns zero in case of success and a negative error code in case of failure.

Definition at line 603 of file io.c.

int ubifs_budget_inode_op ( struct ubifs_info c,
struct inode inode,
struct ubifs_budget_req req 
)
int ubifs_budget_space ( struct ubifs_info c,
struct ubifs_budget_req req 
)

ubifs_budget_space - ensure there is enough space to complete an operation. : UBIFS file-system description object : budget request

This function allocates budget for an operation. It uses pessimistic approximation of how much flash space the operation needs. The goal of this function is to make sure UBIFS always has flash space to flush all dirty pages, dirty inodes, and dirty znodes (liability). This function may force commit, garbage-collection or write-back. Returns zero in case of success, %-ENOSPC if there is no free space and other negative error codes in case of failures.

Definition at line 438 of file budget.c.

long long ubifs_calc_available ( const struct ubifs_info c,
int  min_idx_lebs 
)

ubifs_calc_available - calculate available FS space. : UBIFS file-system description object : minimum number of LEBs reserved for the index

This function calculates and returns amount of FS space available for use.

Definition at line 209 of file budget.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_calc_lpt_geom ( struct ubifs_info c)

ubifs_calc_lpt_geom - calculate and check sizes for the LPT area. : the UBIFS file-system description object

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

Definition at line 137 of file lpt.c.

int ubifs_calc_min_idx_lebs ( struct ubifs_info c)

ubifs_calc_min_idx_lebs - calculate amount of LEBs for the index. : UBIFS file-system description object

This function calculates and returns the number of LEBs which should be kept for index usage.

Definition at line 178 of file budget.c.

void ubifs_cancel_ino_op ( struct ubifs_info c,
struct inode inode,
struct ubifs_budget_req req 
)
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.

int ubifs_check_node ( const struct ubifs_info c,
const void buf,
int  lnum,
int  offs,
int  quiet,
int  must_chk_crc 
)

ubifs_check_node - check node. : UBIFS file-system description object : node to check : logical eraseblock number : offset within the logical eraseblock : print no messages : indicates whether to always check the CRC

This function checks node magic number and CRC checksum. This function also validates node length to prevent UBIFS from becoming crazy when an attacker feeds it a file-system image with incorrect nodes. For example, too large node length in the common header could cause UBIFS to read memory outside of allocated buffer when checking the CRC checksum.

This function may skip data nodes CRC checking if ->no_chk_data_crc is true, which is controlled by corresponding UBIFS mount option. However, if is true, then ->no_chk_data_crc is ignored and CRC is checked. Similarly, if ->mounting or ->remounting_rw is true (we are mounting or re-mounting to R/W mode), ->no_chk_data_crc is ignored and CRC is checked. This is because during mounting or re-mounting from R/O mode to R/W mode we may read journal nodes (when replying the journal or doing the recovery) and the journal nodes may potentially be corrupted, so checking is required.

This function returns zero in case of success and %-EUCLEAN in case of bad CRC or magic.

Definition at line 237 of file io.c.

int ubifs_clean_lebs ( struct ubifs_info c,
void sbuf 
)

ubifs_clean_lebs - clean LEBs recovered during read-only mount. : UBIFS file-system description object : LEB-sized buffer to use

This function cleans a LEB identified during recovery that needs to be written but was not because UBIFS was mounted read-only. This happens when remounting to read-write mode.

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

Definition at line 1094 of file recovery.c.

int ubifs_clear_orphans ( struct ubifs_info c)

ubifs_clear_orphans - erase all LEBs used for orphans. : UBIFS file-system description object

If recovery is not required, then the orphans from the previous session are not needed. This function locates the LEBs used to record orphans, and un-maps them.

Definition at line 483 of file orphan.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.

void ubifs_compress ( const void in_buf,
int  in_len,
void out_buf,
int out_len,
int compr_type 
)

ubifs_compress - compress data. : data to compress : length of the data to compress : output buffer where compressed data should be stored : output buffer length is returned here : type of compression to use on enter, actually used compression type on exit

This function compresses input buffer of length and stores the result in the output buffer and the resulting length in . If the input buffer does not compress, it is just copied to the . The same happens if is UBIFS_COMPR_NONE or if compression error occurred.

Note, if the input buffer was not compressed, it is copied to the output buffer and UBIFS_COMPR_NONE is returned in .

Definition at line 95 of file compress.c.

void ubifs_compressors_exit ( void  )

ubifs_compressors_exit - de-initialize UBIFS compressors.

Definition at line 246 of file compress.c.

int __init ubifs_compressors_init ( void  )

ubifs_compressors_init - initialize UBIFS compressors.

This function initializes the compressor which were compiled in. Returns zero in case of success and a negative error code in case of failure.

Definition at line 223 of file compress.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.

void ubifs_convert_page_budget ( struct ubifs_info c)

ubifs_convert_page_budget - convert budget of a new page. : UBIFS file-system description object

This function converts budget which was allocated for a new page of data to the budget of changing an existing page of data. The latter is smaller than the former, so this function only does simple re-calculation and does not involve any write-back.

Definition at line 584 of file budget.c.

void ubifs_create_buds_lists ( struct ubifs_info c)
int ubifs_create_dflt_lpt ( struct ubifs_info c,
int main_lebs,
int  lpt_first,
int lpt_lebs,
int big_lpt 
)

ubifs_create_dflt_lpt - create default LPT. : UBIFS file-system description object : number of main area LEBs is passed and returned here : LEB number of first LPT LEB : number of LEBs for LPT is passed and returned here : use big LPT model is passed and returned here

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

Definition at line 608 of file lpt.c.

int ubifs_decompress ( const void in_buf,
int  in_len,
void out_buf,
int out_len,
int  compr_type 
)

ubifs_decompress - decompress data. : data to decompress : length of the data to decompress : output buffer where decompressed data should : output length is returned here : type of compression

This function decompresses data from buffer into buffer . The length of the uncompressed data is returned in . This functions returns %0 on success or a negative error code on failure.

Definition at line 147 of file compress.c.

void ubifs_delete_orphan ( struct ubifs_info c,
ino_t  inum 
)

ubifs_delete_orphan - delete an orphan. : UBIFS file-system description object : orphan inode number

Delete an orphan. This function is called when an inode is deleted.

Definition at line 115 of file orphan.c.

void ubifs_destroy_idx_gc ( struct ubifs_info c)

ubifs_destroy_idx_gc - destroy idx_gc list. : UBIFS file-system description object

This function destroys the ->idx_gc list. It is called when unmounting so locks are not needed. Returns zero in case of success and a negative error code in case of failure.

Definition at line 953 of file gc.c.

void ubifs_destroy_size_tree ( struct ubifs_info c)

ubifs_destroy_size_tree - free resources related to the size tree. : UBIFS file-system description object

Definition at line 1336 of file recovery.c.

long ubifs_destroy_tnc_subtree ( struct ubifs_znode znode)

ubifs_destroy_tnc_subtree - destroy all znodes connected to a subtree. : znode defining subtree to destroy

This function destroys subtree of the TNC tree. Returns number of clean znodes in the subtree.

Definition at line 228 of file tnc_misc.c.

int ubifs_dirty_idx_node ( struct ubifs_info c,
union ubifs_key key,
int  level,
int  lnum,
int  offs 
)

ubifs_dirty_idx_node - dirty an index node. : UBIFS file-system description object : index node key : index node level : index node LEB number : index node offset

This function loads and dirties an index node so that it can be garbage collected. The argument has to be the key of the first child. This function relies on the fact that 0:0 is never a valid LEB number and offset for a main-area node. Returns %0 on success and a negative error code on failure.

Definition at line 3253 of file tnc.c.

void ubifs_end_scan ( const struct ubifs_info c,
struct ubifs_scan_leb sleb,
int  lnum,
int  offs 
)

ubifs_end_scan - update LEB scanning information at end of scan. : UBIFS file-system description object : scanning information : logical eraseblock number : offset to start at (usually zero)

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

Definition at line 175 of file scan.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.

int ubifs_find_dirty_idx_leb ( struct ubifs_info c)

ubifs_find_dirty_idx_leb - try to find dirtiest index LEB as at last commit. : the UBIFS file-system description object

This function attempts to find an untaken index LEB with the most free and dirty space that can be used without overwriting index nodes that were in the last index committed.

Definition at line 963 of file find.c.

int ubifs_find_dirty_leb ( struct ubifs_info c,
struct ubifs_lprops ret_lp,
int  min_space,
int  pick_free 
)

ubifs_find_dirty_leb - find a dirty LEB for the Garbage Collector. : the UBIFS file-system description object : LEB properties are returned here on exit : minimum amount free plus dirty space the returned LEB has to have : controls whether it is OK to pick empty or index LEBs

This function tries to find a dirty logical eraseblock which has at least free and dirty space. It prefers to take an LEB from the dirty or dirty index heap, and it falls-back to LPT scanning if the heaps are empty or do not have an LEB which satisfies the criteria.

Note, LEBs which have less than dead watermark of free + dirty space are never picked by this function.

The additional argument controls if this function has to return a free or freeable LEB if one is present. For example, GC must to set it to %1, when called from the journal space reservation function, because the appearance of free space may coincide with the loss of enough dirty space for GC to succeed anyway.

In contrast, if the Garbage Collector is called from budgeting, it should just make free space, not return LEBs which are already free or freeable.

In addition is set to %2 by the recovery process in order to recover gc_lnum in which case an index LEB must not be returned.

This function returns zero and the LEB properties of found dirty LEB in case of success, %-ENOSPC if no dirty LEB was found and a negative error code in case of other failures. The returned LEB is marked as "taken".

Definition at line 233 of file find.c.

int ubifs_find_free_leb_for_idx ( struct ubifs_info c)

ubifs_find_free_leb_for_idx - find a free LEB for the index. : the UBIFS file-system description object

This function looks for a free LEB and returns that LEB number. The returned LEB is marked as "taken", "index".

Only empty LEBs are allocated. This is for two reasons. First, the commit calculates the number of LEBs to allocate based on the assumption that they will be empty. Secondly, free space at the end of an index LEB is not guaranteed to be empty because it may have been used by the in-the-gaps method prior to an unclean unmount.

If no LEB is found %-ENOSPC is returned. For other failures another negative error code is returned.

Definition at line 673 of file find.c.

int ubifs_find_free_space ( struct ubifs_info c,
int  min_space,
int offs,
int  squeeze 
)

ubifs_find_free_space - find a data LEB with free space. : the UBIFS file-system description object : minimum amount of required free space : contains offset of where free space starts on exit : whether to try to find space in a non-empty LEB first

This function looks for an LEB with at least bytes of free space. It tries to find an empty LEB if possible. If no empty LEBs are available, this function searches for a non-empty data LEB. The returned LEB is marked as "taken".

This function returns found LEB number in case of success, %-ENOSPC if it failed to find a LEB with bytes of free space and other a negative error codes in case of failure.

Definition at line 493 of file find.c.

struct ubifs_nnode* ubifs_first_nnode ( struct ubifs_info c,
int hght 
)
read
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.

int ubifs_fsync ( struct file file,
loff_t  start,
loff_t  end,
int  datasync 
)

Definition at line 1307 of file file.c.

int ubifs_garbage_collect ( struct ubifs_info c,
int  anyway 
)

ubifs_garbage_collect - UBIFS garbage collector. : UBIFS file-system description object : do GC even if there are free LEBs

This function does out-of-place garbage collection. The return codes are: o positive LEB number if the LEB has been freed and may be used; o %-EAGAIN if the caller has to run commit; o %-ENOSPC if GC failed to make any progress; o other negative error codes in case of other errors.

Garbage collector writes data to the journal when GC'ing data LEBs, and just marking indexing nodes dirty when GC'ing indexing LEBs. Thus, at some point commit may be required. But commit cannot be run from inside GC, because the caller might be holding the commit lock, so %-EAGAIN is returned instead; And this error code means that the caller has to run commit, and re-run GC if there is still no free space.

There are many reasons why this function may return %-EAGAIN: o the log is full and there is no space to write an LEB reference for ->gc_lnum; o the journal is too large and exceeds size limitations; o GC moved indexing LEBs, but they can be used only after the commit; o the shrinker fails to find clean znodes to free and requests the commit; o etc.

Note, if the file-system is close to be full, this function may return %-EAGAIN infinitely, so the caller has to limit amount of re-invocations of the function. E.g., this happens if the limits on the journal size are too tough and GC writes too much to the journal before an LEB is freed. This might also mean that the journal is too large, and the TNC becomes to big, so that the shrinker is constantly called, finds not clean znodes to free, and requests commit. Well, this may also happen if the journal is all right, but another kernel process consumes too much memory. Anyway, infinite %-EAGAIN may happen, but in some extreme/misconfiguration cases.

Definition at line 648 of file gc.c.

int ubifs_garbage_collect_leb ( struct ubifs_info c,
struct ubifs_lprops lp 
)

ubifs_garbage_collect_leb - garbage-collect a logical eraseblock. : UBIFS file-system description object : describes the LEB to garbage collect

This function garbage-collects an LEB and returns one of the , , etc positive codes in case of success, %-EAGAIN if commit is required, and other negative error codes in case of failures.

Definition at line 469 of file gc.c.

int ubifs_gc_end_commit ( struct ubifs_info c)

ubifs_gc_end_commit - garbage collection at end of commit. : UBIFS file-system description object

This function completes out-of-place garbage collection of index LEBs.

Definition at line 919 of file gc.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.

int ubifs_gc_start_commit ( struct ubifs_info c)

ubifs_gc_start_commit - garbage collection at start of commit. : UBIFS file-system description object

If a LEB has only dirty and free space, then we may safely unmap it and make it free. Note, we cannot do this with indexing LEBs because dirty space may correspond index nodes that are required for recovery. In that case, the LEB cannot be unmapped until after the next commit.

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

Definition at line 840 of file gc.c.

long long ubifs_get_free_space ( struct ubifs_info c)

ubifs_get_free_space - return amount of free space. : UBIFS file-system description object

This function calculates and returns amount of free space to report to user-space.

Definition at line 722 of file budget.c.

long long ubifs_get_free_space_nolock ( struct ubifs_info c)

ubifs_get_free_space_nolock - return amount of free space. : UBIFS file-system description object

This function calculates amount of free space to report to user-space.

Because UBIFS may introduce substantial overhead (the index, node headers, alignment, wastage at the end of LEBs, etc), it cannot report real amount of free flash space it has (well, because not all dirty space is reclaimable, UBIFS does not actually know the real amount). If UBIFS did so, it would bread user expectations about what free space is. Users seem to accustomed to assume that if the file-system reports N bytes of free space, they would be able to fit a file of N bytes to the FS. This almost works for traditional file-systems, because they have way less overhead than UBIFS. So, to keep users happy, UBIFS tries to take the overhead into account.

Definition at line 679 of file budget.c.

int ubifs_get_idx_gc_leb ( struct ubifs_info c)

ubifs_get_idx_gc_leb - get a LEB from GC'd index LEB list. : UBIFS file-system description object

Called during start commit so locks are not needed.

Definition at line 972 of file gc.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.

struct ubifs_nnode* ubifs_get_nnode ( struct ubifs_info c,
struct ubifs_nnode parent,
int  iip 
)
read

ubifs_get_nnode - get a nnode. : UBIFS file-system description object : parent nnode (or NULL for the root) : index in parent

This function returns a pointer to the nnode on success or a negative error code on failure.

Definition at line 1393 of file lpt.c.

struct ubifs_pnode* ubifs_get_pnode ( struct ubifs_info c,
struct ubifs_nnode parent,
int  iip 
)
read

ubifs_get_pnode - get a pnode. : UBIFS file-system description object : parent nnode : index in parent

This function returns a pointer to the pnode on success or a negative error code on failure.

Definition at line 1419 of file lpt.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_getattr ( struct vfsmount mnt,
struct dentry dentry,
struct kstat stat 
)

Definition at line 1122 of file dir.c.

ssize_t ubifs_getxattr ( struct dentry dentry,
const char name,
void buf,
size_t  size 
)

Definition at line 359 of file xattr.c.

struct inode* ubifs_iget ( struct super_block sb,
unsigned long  inum 
)
read

Definition at line 100 of file super.c.

int ubifs_io_init ( struct ubifs_info c)
long ubifs_ioctl ( struct file file,
unsigned int  cmd,
unsigned long  arg 
)

Definition at line 147 of file ioctl.c.

int ubifs_is_mapped ( const struct ubifs_info c,
int  lnum 
)

Definition at line 196 of file io.c.

int ubifs_jnl_change_xattr ( struct ubifs_info c,
const struct inode inode,
const struct inode host 
)

ubifs_jnl_change_xattr - change an extended attribute. : UBIFS file-system description object : extended attribute inode : host inode

This function writes the updated version of an extended attribute inode and the host inode to the journal (to the base head). The host inode is written after the extended attribute inode in order to guarantee that the extended attribute will be flushed when the inode is synchronized by 'fsync()' and consequently, the write-buffer is synchronized. This function returns zero in case of success and a negative error code in case of failure.

Definition at line 1396 of file journal.c.

int ubifs_jnl_delete_inode ( struct ubifs_info c,
const struct inode inode 
)

ubifs_jnl_delete_inode - delete an inode. : UBIFS file-system description object : inode to delete

This function deletes inode which includes removing it from orphans, deleting it from TNC and, in some cases, writing a deletion inode to the journal.

When regular file inodes are unlinked or a directory inode is removed, the 'ubifs_jnl_update()' function writes a corresponding deletion inode and direntry to the media, and adds the inode to orphans. After this, when the last reference to this inode has been dropped, this function is called. In general, it has to write one more deletion inode to the media, because if a commit happened between 'ubifs_jnl_update()' and 'ubifs_jnl_delete_inode()', the deletion inode is not in the journal anymore, and in fact it might not be on the flash anymore, because it might have been garbage-collected already. And for optimization reasons UBIFS does not read the orphan area if it has been unmounted cleanly, so it would have no indication in the journal that there is a deleted inode which has to be removed from TNC.

However, if there was no commit between 'ubifs_jnl_update()' and 'ubifs_jnl_delete_inode()', then there is no need to write the deletion inode to the media for the second time. And this is quite a typical case.

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

Definition at line 876 of file journal.c.

int ubifs_jnl_delete_xattr ( struct ubifs_info c,
const struct inode host,
const struct inode inode,
const struct qstr nm 
)

ubifs_jnl_delete_xattr - delete an extended attribute. : UBIFS file-system description object : host inode : extended attribute inode : extended attribute entry name

This function delete an extended attribute which is very similar to un-linking regular files - it writes a deletion xentry, a deletion inode and updates the target inode. Returns zero in case of success and a negative error code in case of failure.

Definition at line 1283 of file journal.c.

int ubifs_jnl_rename ( struct ubifs_info c,
const struct inode old_dir,
const struct dentry old_dentry,
const struct inode new_dir,
const struct dentry new_dentry,
int  sync 
)

ubifs_jnl_rename - rename a directory entry. : UBIFS file-system description object : parent inode of directory entry to rename : directory entry to rename : parent inode of directory entry to rename : new directory entry (or directory entry to replace) : non-zero if the write-buffer has to be synchronized

This function implements the re-name operation which may involve writing up to 3 inodes and 2 directory entries. It marks the written inodes as clean and returns zero on success. In case of failure, a negative error code is returned.

Definition at line 920 of file journal.c.

int ubifs_jnl_truncate ( struct ubifs_info c,
const struct inode inode,
loff_t  old_size,
loff_t  new_size 
)

ubifs_jnl_truncate - update the journal for a truncation. : UBIFS file-system description object : inode to truncate : old size : new size

When the size of a file decreases due to truncation, a truncation node is written, the journal tree is updated, and the last data block is re-written if it has been affected. The inode is also updated in order to synchronize the new inode size.

This function marks the inode as clean and returns zero on success. In case of failure, a negative error code is returned.

Definition at line 1142 of file journal.c.

int ubifs_jnl_update ( struct ubifs_info c,
const struct inode dir,
const struct qstr nm,
const struct inode inode,
int  deletion,
int  xent 
)

Definition at line 541 of file journal.c.

int ubifs_jnl_write_data ( struct ubifs_info c,
const struct inode inode,
const union ubifs_key key,
const void buf,
int  len 
)

ubifs_jnl_write_data - write a data node to the journal. : UBIFS file-system description object : inode the data node belongs to : node key : buffer to write : data length (must not exceed UBIFS_BLOCK_SIZE)

This function writes a data node to the journal. Returns %0 if the data node was successfully written, and a negative error code in case of failure.

Definition at line 692 of file journal.c.

int ubifs_jnl_write_inode ( struct ubifs_info c,
const struct inode inode 
)

ubifs_jnl_write_inode - flush inode to the journal. : UBIFS file-system description object : inode to flush

This function writes inode to the journal. If the inode is synchronous, it also synchronizes the write-buffer. Returns zero in case of success and a negative error code in case of failure.

Definition at line 780 of file journal.c.

int ubifs_leb_change ( struct ubifs_info c,
int  lnum,
const void buf,
int  len 
)

Definition at line 138 of file io.c.

int ubifs_leb_map ( struct ubifs_info c,
int  lnum 
)

Definition at line 177 of file io.c.

int ubifs_leb_read ( const struct ubifs_info c,
int  lnum,
void buf,
int  offs,
int  len,
int  even_ebadmsg 
)

Definition at line 99 of file io.c.

int ubifs_leb_unmap ( struct ubifs_info c,
int  lnum 
)

Definition at line 158 of file io.c.

int ubifs_leb_write ( struct ubifs_info c,
int  lnum,
const void buf,
int  offs,
int  len 
)

Definition at line 117 of file io.c.

ssize_t ubifs_listxattr ( struct dentry dentry,
char buffer,
size_t  size 
)

Definition at line 419 of file xattr.c.

struct ubifs_znode* ubifs_load_znode ( struct ubifs_info c,
struct ubifs_zbranch zbr,
struct ubifs_znode parent,
int  iip 
)
read

ubifs_load_znode - load znode to TNC cache. : UBIFS file-system description object : znode branch : znode's parent : index in parent

This function loads znode pointed to by into the TNC cache and returns pointer to it in case of success and a negative error code in case of failure.

Definition at line 406 of file tnc_misc.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.

int ubifs_lookup_level0 ( struct ubifs_info c,
const union ubifs_key key,
struct ubifs_znode **  zn,
int n 
)

ubifs_lookup_level0 - search for zero-level znode. : UBIFS file-system description object : key to lookup : znode is returned here
: znode branch slot number is returned here

This function looks up the TNC tree and search for zero-level znode which refers key . The found zero-level znode is returned in . There are 3 cases: o exact match, i.e. the found zero-level znode contains key , then %1 is returned and slot number of the matched branch is stored in
; o not exact match, which means that zero-level znode does not contain , then %0 is returned and slot number of the closest branch is stored in
; o is so small that it is even less than the lowest key of the leftmost zero-level node, then %0 is returned and %0 is stored in
.

Note, when the TNC tree is traversed, some znodes may be absent, then this function reads corresponding indexing nodes and inserts them to TNC. In case of failure, a negative error code is returned.

Definition at line 1175 of file tnc.c.

int ubifs_lpt_end_commit ( struct ubifs_info c)

ubifs_lpt_end_commit - finish the commit operation. : the UBIFS file-system description object

This function has to be called when the commit operation finishes. It flushes the changes which were "frozen" by 'ubifs_lprops_start_commit()' to the media. Returns zero in case of success and a negative error code in case of failure.

Definition at line 1324 of file lpt_commit.c.

void ubifs_lpt_free ( struct ubifs_info c,
int  wr_only 
)

ubifs_lpt_free - free resources owned by the LPT. : UBIFS file-system description object : free only resources used for writing

Definition at line 1457 of file lpt_commit.c.

int ubifs_lpt_init ( struct ubifs_info c,
int  rd,
int  wr 
)

ubifs_lpt_init - initialize the LPT. : UBIFS file-system description object : whether to initialize lpt for reading : whether to initialize lpt for writing

For mounting 'rw', and are both true. For mounting 'ro', is true and is false. For mounting from 'ro' to 'rw', is false and is true.

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

Definition at line 1733 of file lpt.c.

struct ubifs_lprops* ubifs_lpt_lookup ( struct ubifs_info c,
int  lnum 
)
read

ubifs_lpt_lookup - lookup LEB properties in the LPT. : UBIFS file-system description object : LEB number to lookup

This function returns a pointer to the LEB properties on success or a negative error code on failure.

Definition at line 1445 of file lpt.c.

struct ubifs_lprops* ubifs_lpt_lookup_dirty ( struct ubifs_info c,
int  lnum 
)
read

ubifs_lpt_lookup_dirty - lookup LEB properties in the LPT. : UBIFS file-system description object : LEB number to lookup

This function returns a pointer to the LEB properties on success or a negative error code on failure.

Definition at line 1579 of file lpt.c.

int ubifs_lpt_post_commit ( struct ubifs_info c)

ubifs_lpt_post_commit - post commit LPT trivial GC and LPT GC. : UBIFS file-system description object

LPT trivial GC is completed after a commit. Also LPT GC is done after a commit for the "big" LPT model.

Definition at line 1351 of file lpt_commit.c.

int ubifs_lpt_scan_nolock ( struct ubifs_info c,
int  start_lnum,
int  end_lnum,
ubifs_lpt_scan_callback  scan_cb,
void data 
)

ubifs_lpt_scan_nolock - scan the LPT. : the UBIFS file-system description object : LEB number from which to start scanning : LEB number at which to stop scanning : callback function called for each lprops : data to be passed to the callback function

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

Definition at line 1922 of file lpt.c.

int ubifs_lpt_start_commit ( struct ubifs_info c)

ubifs_lpt_start_commit - UBIFS commit starts. : the UBIFS file-system description object

This function has to be called when UBIFS starts the commit operation. This function "freezes" all currently dirty LEB properties and does not change them anymore. Further changes are saved and tracked separately because they are not part of this commit. This function returns zero in case of success and a negative error code in case of failure.

Definition at line 1226 of file lpt_commit.c.

int ubifs_mount_orphans ( struct ubifs_info c,
int  unclean,
int  read_only 
)

ubifs_mount_orphans - delete orphan inodes and erase LEBs that recorded them. : UBIFS file-system description object : indicates recovery from unclean unmount : indicates read only mount

This function is called when mounting to erase orphans from the previous session. If UBIFS was not unmounted cleanly, then the inodes recorded as orphans are deleted.

Definition at line 702 of file orphan.c.

struct inode* ubifs_new_inode ( struct ubifs_info c,
const struct inode dir,
umode_t  mode 
)
read

Definition at line 88 of file dir.c.

int ubifs_orphan_end_commit ( struct ubifs_info c)

ubifs_orphan_end_commit - end commit of orphans. : UBIFS file-system description object

End commit of orphans.

Definition at line 461 of file orphan.c.

int ubifs_orphan_start_commit ( struct ubifs_info c)

ubifs_orphan_start_commit - start commit of orphans. : UBIFS file-system description object

Start commit of orphans.

Definition at line 167 of file orphan.c.

void ubifs_pack_lsave ( struct ubifs_info c,
void buf,
int lsave 
)

ubifs_pack_lsave - pack the LPT's save table. : UBIFS file-system description object : buffer into which to pack : LPT's save table to pack

Definition at line 440 of file lpt.c.

void ubifs_pack_ltab ( struct ubifs_info c,
void buf,
struct ubifs_lpt_lprops ltab 
)

ubifs_pack_ltab - pack the LPT's own lprops table. : UBIFS file-system description object : buffer into which to pack : LPT's own lprops table to pack

Definition at line 415 of file lpt.c.

void ubifs_pack_nnode ( struct ubifs_info c,
void buf,
struct ubifs_nnode nnode 
)

ubifs_pack_nnode - pack all the bit fields of a nnode. : UBIFS file-system description object : buffer into which to pack : nnode to pack

Definition at line 383 of file lpt.c.

void ubifs_pack_pnode ( struct ubifs_info c,
void buf,
struct ubifs_pnode pnode 
)

ubifs_pack_pnode - pack all the bit fields of a pnode. : UBIFS file-system description object : buffer into which to pack : pnode to pack

Definition at line 350 of file lpt.c.

void ubifs_pad ( const struct ubifs_info c,
void buf,
int  pad 
)

ubifs_pad - pad flash space. : UBIFS file-system description object : buffer to put padding to : how many bytes to pad

The flash media obliges us to write only in chunks of c->min_io_size and when we have to write less data we add padding node to the write-buffer and pad it to the next minimal I/O unit's boundary. Padding nodes help when the media is being scanned. If the amount of wasted space is not enough to fit a padding node which takes UBIFS_PAD_NODE_SZ bytes, we write padding bytes pattern (UBIFS_PADDING_BYTE).

Padding nodes are also used to fill gaps when the "commit-in-gaps" method is used.

Definition at line 318 of file io.c.

void ubifs_prep_grp_node ( struct ubifs_info c,
void node,
int  len,
int  last 
)

ubifs_prep_grp_node - prepare node of a group to be written to flash. : UBIFS file-system description object : the node to pad : node length : indicates the last node of the group

This function prepares node at to be written to the media - it calculates node CRC and fills the common header.

Definition at line 412 of file io.c.

void ubifs_prepare_node ( struct ubifs_info c,
void node,
int  len,
int  pad 
)

ubifs_prepare_node - prepare node to be written to flash. : UBIFS file-system description object : the node to pad : node length : if the buffer has to be padded

This function prepares node at to be written to the media - it calculates node CRC, fills the common header, and adds proper padding up to the next minimum I/O unit if is not zero.

Definition at line 379 of file io.c.

int ubifs_rcvry_gc_commit ( struct ubifs_info c)

ubifs_rcvry_gc_commit - recover the GC LEB number and run the commit. : UBIFS file-system description object

Out-of-place garbage collection requires always one empty LEB with which to start garbage collection. The LEB number is recorded in c->gc_lnum and is written to the master node on unmounting. In the case of an unclean unmount the value of gc_lnum recorded in the master node is out of date and cannot be used. Instead, recovery must allocate an empty LEB for this purpose. However, there may not be enough empty space, in which case it must be possible to GC the dirtiest LEB into the GC head LEB.

This function also runs the commit which causes the TNC updates from size-recovery and orphans to be written to the flash. That is important to ensure correct replay order for subsequent mounts.

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

Definition at line 1177 of file recovery.c.

int ubifs_read_master ( struct ubifs_info c)

ubifs_read_master - read master node. : UBIFS file-system description object

This function finds and reads the master node during file-system mount. If the flash is empty, it creates default master node as well. Returns zero in case of success and a negative error code in case of failure.

Definition at line 256 of file master.c.

int ubifs_read_nnode ( struct ubifs_info c,
struct ubifs_nnode parent,
int  iip 
)

ubifs_read_nnode - read a nnode from flash and link it to the tree in memory. : UBIFS file-system description object : parent nnode (or NULL for the root) : index in parent

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

Definition at line 1192 of file lpt.c.

int ubifs_read_node ( const struct ubifs_info c,
void buf,
int  type,
int  len,
int  lnum,
int  offs 
)

ubifs_read_node - read node. : UBIFS file-system description object : buffer to read to : node type : node length (not aligned) : logical eraseblock number : offset within the logical eraseblock

This function reads a node of known type and and length, checks it and stores in . Returns zero in case of success, %-EUCLEAN if CRC mismatched and a negative error code in case of failure.

Definition at line 974 of file io.c.

int ubifs_read_node_wbuf ( struct ubifs_wbuf wbuf,
void buf,
int  type,
int  len,
int  lnum,
int  offs 
)

ubifs_read_node_wbuf - read node from the media or write-buffer. : wbuf to check for un-written data : buffer to read to : node type : node length : logical eraseblock number : offset within the logical eraseblock

This function reads a node of known type and length, checks it and stores in . If the node partially or fully sits in the write-buffer, this function takes data from the buffer, otherwise it reads the flash media. Returns zero in case of success, %-EUCLEAN if CRC mismatched and a negative error code in case of failure.

Definition at line 897 of file io.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.

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_recover_inl_heads ( struct ubifs_info c,
void sbuf 
)

ubifs_recover_inl_heads - recover index and LPT heads. : UBIFS file-system description object : LEB-sized buffer to use

This function ensures that there is no data on the flash at the index and LPT head locations.

This deals with the recovery of a half-completed journal commit. UBIFS is careful never to overwrite the last version of the index or the LPT. Because the index and LPT are wandering trees, data from a half-completed commit will not be referenced anywhere in UBIFS. The data will be either in LEBs that are assumed to be empty and will be unmapped anyway before use, or in the index and LPT heads.

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

Definition at line 967 of file recovery.c.

struct ubifs_scan_leb* ubifs_recover_leb ( struct ubifs_info c,
int  lnum,
int  offs,
void sbuf,
int  jhead 
)
read

ubifs_recover_leb - scan and recover a LEB. : UBIFS file-system description object : LEB number : offset : LEB-sized buffer to use : journal head number this LEB belongs to (%-1 if the LEB does not belong to any journal head)

This function does a scan of a LEB, but caters for errors that might have been caused by the unclean unmount from which we are attempting to recover. Returns %0 in case of success, %-EUCLEAN if an unrecoverable corruption is found, and a negative error code in case of failure.

Definition at line 635 of file recovery.c.

struct ubifs_scan_leb* ubifs_recover_log_leb ( struct ubifs_info c,
int  lnum,
int  offs,
void sbuf 
)
read

ubifs_recover_log_leb - scan and recover a log LEB. : UBIFS file-system description object : LEB number : offset : LEB-sized buffer to use

This function does a scan of a LEB, but caters for errors that might have been caused by unclean reboots from which we are attempting to recover (assume that only the last log LEB can be corrupted by an unclean reboot).

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

Definition at line 869 of file recovery.c.

int ubifs_recover_master_node ( struct ubifs_info c)

ubifs_recover_master_node - recover the master node. : UBIFS file-system description object

This function recovers the master node from corruption that may occur due to an unclean unmount.

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

Definition at line 236 of file recovery.c.

int ubifs_recover_size ( struct ubifs_info c)

ubifs_recover_size - recover inode size. : UBIFS file-system description object

This function attempts to fix inode size discrepancies identified by the 'ubifs_recover_size_accum()' function.

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

Definition at line 1497 of file recovery.c.

int ubifs_recover_size_accum ( struct ubifs_info c,
union ubifs_key key,
int  deletion,
loff_t  new_size 
)

ubifs_recover_size_accum - accumulate inode sizes for recovery. : UBIFS file-system description object : node key : node is for a deletion : inode size

This function has two purposes: 1) to ensure there are no data nodes that fall outside the inode size 2) to ensure there are no data nodes for inodes that do not exist To accomplish those purposes, a rb-tree is constructed containing an entry for each inode number in the journal that has not been deleted, and recording the size from the inode node, the maximum size of any data node (also altered by truncations) and a flag indicating a inode number for which no inode node was present in the journal.

Note that there is still the possibility that there are data nodes that have been committed that are beyond the inode size, however the only way to find them would be to scan the entire index. Alternatively, some provision could be made to record the size of inodes at the start of commit, which would seem very cumbersome for a scenario that is quite unlikely and the only negative consequence of which is wasted space.

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

Definition at line 1389 of file recovery.c.

void ubifs_recovery_commit ( struct ubifs_info c)
void ubifs_release_budget ( struct ubifs_info c,
struct ubifs_budget_req req 
)

ubifs_release_budget - release budgeted free space. : UBIFS file-system description object : budget request

This function releases the space budgeted by 'ubifs_budget_space()'. Note, since the index changes (which were budgeted for in ->idx_growth) will only be written to the media on commit, this function moves the index budget from ->bi.idx_growth to ->bi.uncommitted_idx. The latter will be zeroed by the commit operation.

Definition at line 528 of file budget.c.

void ubifs_release_dirty_inode_budget ( struct ubifs_info c,
struct ubifs_inode ui 
)

ubifs_release_dirty_inode_budget - release dirty inode budget. : UBIFS file-system description object : UBIFS inode to release the budget for

This function releases budget corresponding to a dirty inode. It is usually called when after the inode has been written to the media and marked as clean. It also causes the "no space" flags to be cleared.

Definition at line 607 of file budget.c.

void ubifs_release_ino_dirty ( struct ubifs_info c,
struct inode inode,
struct ubifs_budget_req req 
)
int ubifs_removexattr ( struct dentry dentry,
const char name 
)

Definition at line 523 of file xattr.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_replay_journal ( struct ubifs_info c)

ubifs_replay_journal - replay journal. : UBIFS file-system description object

This function scans the journal, replays and cleans it up. It makes sure all memory data structures related to uncommitted journal are built (dirty TNC tree, tree of buds, modified lprops, etc).

Definition at line 1008 of file replay.c.

long long ubifs_reported_space ( const struct ubifs_info c,
long long  free 
)

ubifs_reported_space - calculate reported free space. : the UBIFS file-system description object : amount of free space

This function calculates amount of free space which will be reported to user-space. User-space application tend to expect that if the file-system (e.g., via the 'statfs()' call) reports that it has N bytes available, they are able to write a file of size N. UBIFS attaches node headers to each data node and it has to write indexing nodes as well. This introduces additional overhead, and UBIFS has to report slightly less free space to meet the above expectations.

This function assumes free space is made up of uncompressed data nodes and full index nodes (one per data node, tripled because we always allow enough space to write the index thrice).

Note, the calculation is pessimistic, which means that most of the time UBIFS reports less space than it actually has.

Definition at line 638 of file budget.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.

void ubifs_ro_mode ( struct ubifs_info c,
int  err 
)

ubifs_ro_mode - switch UBIFS to read read-only mode. : UBIFS file-system description object : error code which is the reason of switching to R/O mode

Definition at line 82 of file io.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.

int ubifs_save_dirty_idx_lnums ( struct ubifs_info c)

ubifs_save_dirty_idx_lnums - save an array of the most dirty index LEB nos. : the UBIFS file-system description object

This function is called each commit to create an array of LEB numbers of dirty index LEBs sorted in order of dirty and free space. This is used by the in-the-gaps method of TNC commit.

Definition at line 767 of file find.c.

struct ubifs_scan_leb* ubifs_scan ( const struct ubifs_info c,
int  lnum,
int  offs,
void sbuf,
int  quiet 
)
read

ubifs_scan - scan a logical eraseblock. : UBIFS file-system description object : logical eraseblock number : offset to start at (usually zero) : scan buffer (must be of ->leb_size bytes in size) : print no messages

This function scans LEB number and returns complete information about its contents. Returns the scaned information in case of success and, %-EUCLEAN if the LEB neads recovery, and other negative error codes in case of failure.

If is non-zero, this function does not print large and scary error messages and flash dumps in case of errors.

Definition at line 267 of file scan.c.

int ubifs_scan_a_node ( const struct ubifs_info c,
void buf,
int  len,
int  lnum,
int  offs,
int  quiet 
)

ubifs_scan_a_node - scan for a node or padding. : UBIFS file-system description object : buffer to scan : length of buffer : logical eraseblock number : offset within the logical eraseblock : print no messages

This function returns a scanning code to indicate what was scanned.

Definition at line 69 of file scan.c.

void ubifs_scan_destroy ( struct ubifs_scan_leb sleb)

ubifs_scan_destroy - destroy LEB scanning information. : scanning information to free

Definition at line 367 of file scan.c.

void ubifs_scanned_corruption ( const struct ubifs_info c,
int  lnum,
int  offs,
void buf 
)

ubifs_scanned_corruption - print information after UBIFS scanned corruption. : UBIFS file-system description object : LEB number of corruption : offset of corruption : buffer containing corruption

Definition at line 238 of file scan.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.

int ubifs_search_zbranch ( const struct ubifs_info c,
const struct ubifs_znode znode,
const union ubifs_key key,
int n 
)

ubifs_search_zbranch - search znode branch. : UBIFS file-system description object : znode to search in : key to search for
: znode branch slot number is returned here

This is a helper function which search branch with key in using binary search. The result of the search may be: o exact match, then %1 is returned, and the slot number of the branch is stored in
; o no exact match, then %0 is returned and the slot number of the left closest branch is returned in
; the slot if all keys in this znode are greater than , then %-1 is returned in
.

Definition at line 135 of file tnc_misc.c.

void ubifs_set_inode_flags ( struct inode inode)

ubifs_set_inode_flags - set VFS inode flags. : VFS inode to set flags for

This function propagates flags from UBIFS inode object to VFS inode object.

Definition at line 37 of file ioctl.c.

int ubifs_setattr ( struct dentry dentry,
struct iattr attr 
)

Definition at line 1254 of file file.c.

int ubifs_setxattr ( struct dentry dentry,
const char name,
const void value,
size_t  size,
int  flags 
)

Definition at line 296 of file xattr.c.

int ubifs_shrinker ( struct shrinker shrink,
struct shrink_control sc 
)

Definition at line 280 of file shrinker.c.

struct ubifs_scan_leb* ubifs_start_scan ( const struct ubifs_info c,
int  lnum,
int  offs,
void sbuf 
)
read

ubifs_start_scan - create LEB scanning information at start of scan. : UBIFS file-system description object : logical eraseblock number : offset to start at (usually zero) : scan buffer (must be c->leb_size)

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

Definition at line 136 of file scan.c.

int ubifs_sync_wbufs_by_inode ( struct ubifs_info c,
struct inode inode 
)

ubifs_sync_wbufs_by_inode - synchronize write-buffers for an inode. : UBIFS file-system description object : inode to synchronize

This function synchronizes write-buffers which contain nodes belonging to . Returns zero in case of success and a negative error code in case of failure.

Definition at line 1118 of file io.c.

int ubifs_tnc_add ( struct ubifs_info c,
const union ubifs_key key,
int  lnum,
int  offs,
int  len 
)

ubifs_tnc_add - add a node to TNC. : UBIFS file-system description object : key to add : LEB number of node : node offset : node length

This function adds a node with key to TNC. The node may be new or it may obsolete some existing one. Returns %0 on success or negative error code on failure.

Definition at line 2166 of file tnc.c.

int ubifs_tnc_add_nm ( struct ubifs_info c,
const union ubifs_key key,
int  lnum,
int  offs,
int  len,
const struct qstr nm 
)

ubifs_tnc_add_nm - add a "hashed" node to TNC. : UBIFS file-system description object : key to add : LEB number of node : node offset : node length : node name

This is the same as 'ubifs_tnc_add()' but it should be used with keys which may have collisions, like directory entry keys.

Definition at line 2298 of file tnc.c.

int ubifs_tnc_bulk_read ( struct ubifs_info c,
struct bu_info bu 
)

ubifs_tnc_bulk_read - read a number of data nodes in one go. : UBIFS file-system description object : bulk-read parameters and results

This functions reads and validates the data nodes that were identified by the 'ubifs_tnc_get_bu_keys()' function. This functions returns %0 on success, -EAGAIN to indicate a race with GC, or another negative error code on failure.

Definition at line 1751 of file tnc.c.

void ubifs_tnc_close ( struct ubifs_info c)

ubifs_tnc_close - close TNC subsystem and free all related resources. : UBIFS file-system description object

Definition at line 2874 of file tnc.c.

int ubifs_tnc_end_commit ( struct ubifs_info c)

ubifs_tnc_end_commit - update the TNC for commit end. : UBIFS file-system description object

Write the dirty znodes.

Definition at line 1044 of file tnc_commit.c.

int ubifs_tnc_get_bu_keys ( struct ubifs_info c,
struct bu_info bu 
)

ubifs_tnc_get_bu_keys - lookup keys for bulk-read. : UBIFS file-system description object : bulk-read parameters and results

Lookup consecutive data node keys for the same inode that reside consecutively in the same LEB. This function returns zero in case of success and a negative error code in case of failure.

Note, if the bulk-read buffer length (->buf_len) is known, this function makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares maximum possible amount of nodes for bulk-read.

Definition at line 1520 of file tnc.c.

int ubifs_tnc_has_node ( struct ubifs_info c,
union ubifs_key key,
int  level,
int  lnum,
int  offs,
int  is_idx 
)

ubifs_tnc_has_node - determine whether a node is in the TNC. : UBIFS file-system description object : node key : index node level (if it is an index node) : node LEB number : node offset : non-zero if the node is an index node

This function returns %1 if the node is in the TNC, %0 if it is not, and a negative error code in case of failure. For index nodes, has to be the key of the first child. An index node is considered to be in the TNC only if the corresponding znode is clean or has not been loaded.

Definition at line 3213 of file tnc.c.

struct ubifs_znode* ubifs_tnc_levelorder_next ( struct ubifs_znode zr,
struct ubifs_znode znode 
)
read

ubifs_tnc_levelorder_next - next TNC tree element in levelorder traversal. : root of the subtree to traverse : previous znode

This function implements levelorder TNC traversal. The LNC is ignored. Returns the next element or NULL if is already the last one.

Definition at line 40 of file tnc_misc.c.

int ubifs_tnc_locate ( struct ubifs_info c,
const union ubifs_key key,
void node,
int lnum,
int offs 
)

ubifs_tnc_locate - look up a file-system node and return it and its location. : UBIFS file-system description object : node key to lookup : the node is returned here : LEB number is returned here : offset is returned here

This function looks up and reads node with key . The caller has to make sure the buffer is large enough to fit the node. Returns zero in case of success, %-ENOENT if the node was not found, and a negative error code in case of failure. The node location can be returned in and .

Definition at line 1446 of file tnc.c.

int ubifs_tnc_lookup_nm ( struct ubifs_info c,
const union ubifs_key key,
void node,
const struct qstr nm 
)

ubifs_tnc_lookup_nm - look up a "hashed" node. : UBIFS file-system description object : node key to lookup : the node is returned here : node name

This function look up and reads a node which contains name hash in the key. Since the hash may have collisions, there may be many nodes with the same key, so we have to sequentially look to all of them until the needed one is found. This function returns zero in case of success, %-ENOENT if the node was not found, and a negative error code in case of failure.

Definition at line 1856 of file tnc.c.

struct ubifs_dent_node* ubifs_tnc_next_ent ( struct ubifs_info c,
union ubifs_key key,
const struct qstr nm 
)
read

Definition at line 2765 of file tnc.c.

struct ubifs_znode* ubifs_tnc_postorder_first ( struct ubifs_znode znode)
read

ubifs_tnc_postorder_first - find first znode to do postorder tree traversal. : znode to start at (root of the sub-tree to traverse)

Find the lowest leftmost znode in a subtree of the TNC tree. The LNC is ignored.

Definition at line 179 of file tnc_misc.c.

struct ubifs_znode* ubifs_tnc_postorder_next ( struct ubifs_znode znode)
read

ubifs_tnc_postorder_next - next TNC tree element in postorder traversal. : previous znode

This function implements postorder TNC traversal. The LNC is ignored. Returns the next element or NULL if is already the last one.

Definition at line 203 of file tnc_misc.c.

int ubifs_tnc_read_node ( struct ubifs_info c,
struct ubifs_zbranch zbr,
void node 
)

ubifs_tnc_read_node - read a leaf node from the flash media. : UBIFS file-system description object : key and position of the node : node is returned here

This function reads a node defined by from the flash media. Returns zero in case of success or a negative negative error code in case of failure.

Definition at line 458 of file tnc_misc.c.

int ubifs_tnc_remove ( struct ubifs_info c,
const union ubifs_key key 
)

ubifs_tnc_remove - remove an index entry of a node. : UBIFS file-system description object : key of node

Returns %0 on success or negative error code on failure.

Definition at line 2503 of file tnc.c.

int ubifs_tnc_remove_ino ( struct ubifs_info c,
ino_t  inum 
)

ubifs_tnc_remove_ino - remove an inode from TNC. : UBIFS file-system description object : inode number to remove

This function remove inode and all the extended attributes associated with the anode from TNC and returns zero in case of success or a negative error code in case of failure.

Definition at line 2685 of file tnc.c.

int ubifs_tnc_remove_nm ( struct ubifs_info c,
const union ubifs_key key,
const struct qstr nm 
)

ubifs_tnc_remove_nm - remove an index entry for a "hashed" node. : UBIFS file-system description object : key of node : directory entry name

Returns %0 on success or negative error code on failure.

Definition at line 2533 of file tnc.c.

int ubifs_tnc_remove_range ( struct ubifs_info c,
union ubifs_key from_key,
union ubifs_key to_key 
)

ubifs_tnc_remove_range - remove index entries in range. : UBIFS file-system description object : lowest key to remove : highest key to remove

This function removes index entries starting at and ending at . This function returns zero in case of success and a negative error code in case of failure.

Definition at line 2603 of file tnc.c.

int ubifs_tnc_replace ( struct ubifs_info c,
const union ubifs_key key,
int  old_lnum,
int  old_offs,
int  lnum,
int  offs,
int  len 
)

ubifs_tnc_replace - replace a node in the TNC only if the old node is found. : UBIFS file-system description object : key to add : LEB number of old node : old node offset : LEB number of node : node offset : node length

This function replaces a node with key in the TNC only if the old node is found. This function is called by garbage collection when node are moved. Returns %0 on success or negative error code on failure.

Definition at line 2215 of file tnc.c.

int ubifs_tnc_start_commit ( struct ubifs_info c,
struct ubifs_zbranch zroot 
)

ubifs_tnc_start_commit - start TNC commit. : UBIFS file-system description object : new index root position is returned here

This function prepares the list of indexing nodes to commit and lays out their positions on flash. If there is not enough free space it uses the in-gap commit method. Returns zero in case of success and a negative error code in case of failure.

Definition at line 741 of file tnc_commit.c.

uint32_t ubifs_unpack_bits ( uint8_t **  addr,
int pos,
int  nrbits 
)

ubifs_unpack_bits - unpack bit fields. : address at which to unpack (passed and next address returned) : bit position at which to unpack (passed and next position returned) : number of bits of value to unpack (1-32)

This functions returns the value unpacked.

Definition at line 283 of file lpt.c.

int ubifs_unpack_nnode ( const struct ubifs_info c,
void buf,
struct ubifs_nnode nnode 
)

ubifs_unpack_nnode - unpack a nnode. : UBIFS file-system description object : buffer containing packed nnode to unpack : nnode structure to fill

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

Definition at line 1000 of file lpt.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.

int ubifs_validate_entry ( struct ubifs_info c,
const struct ubifs_dent_node dent 
)

ubifs_validate_entry - validate directory or extended attribute entry node. : UBIFS file-system description object : the node to validate

This function validates directory or extended attribute entry node . Returns zero if the node is all right and a %-EINVAL if not.

Definition at line 450 of file replay.c.

void ubifs_wait_for_commit ( struct ubifs_info c)
void ubifs_wbuf_add_ino_nolock ( struct ubifs_wbuf wbuf,
ino_t  inum 
)

ubifs_wbuf_add_ino_nolock - add an inode number into the wbuf inode array. : the write-buffer where to add : the inode number

This function adds an inode number to the inode array of the write-buffer.

Definition at line 1074 of file io.c.

int ubifs_wbuf_init ( struct ubifs_info c,
struct ubifs_wbuf wbuf 
)

ubifs_wbuf_init - initialize write-buffer. : UBIFS file-system description object : write-buffer to initialize

This function initializes write-buffer. Returns zero in case of success %-ENOMEM in case of failure.

Definition at line 1026 of file io.c.

int ubifs_wbuf_seek_nolock ( struct ubifs_wbuf wbuf,
int  lnum,
int  offs 
)

ubifs_wbuf_seek_nolock - seek write-buffer. : write-buffer : logical eraseblock number to seek to : logical eraseblock offset to seek to

This function targets the write-buffer to logical eraseblock :. The write-buffer has to be empty. Returns zero in case of success and a negative error code in case of failure.

Definition at line 568 of file io.c.

int ubifs_wbuf_sync_nolock ( struct ubifs_wbuf wbuf)

ubifs_wbuf_sync_nolock - synchronize write-buffer. : write-buffer to synchronize

This function synchronizes write-buffer and returns zero in case of success or a negative error code in case of failure.

Note, although write-buffers are of ->max_write_size, this function does not necessarily writes all ->max_write_size bytes to the flash. Instead, if the write-buffer is only partially filled with data, only the used part of the write-buffer (aligned on ->min_io_size boundary) is synchronized. This way we waste less space.

Definition at line 493 of file io.c.

int ubifs_wbuf_write_nolock ( struct ubifs_wbuf wbuf,
void buf,
int  len 
)

ubifs_wbuf_write_nolock - write data to flash via write-buffer. : write-buffer : node to write : node length

This function writes data to flash via write-buffer . This means that the last piece of the node won't reach the flash media immediately if it does not take whole max. write unit (->max_write_size). Instead, the node will sit in RAM until the write-buffer is synchronized (e.g., by timer, or because more data are appended to the write-buffer).

This function returns zero in case of success and a negative error code in case of failure. If the node cannot be written because there is no more space in this logical eraseblock, %-ENOSPC is returned.

Definition at line 675 of file io.c.

int ubifs_write_master ( struct ubifs_info c)

ubifs_write_master - write master node. : UBIFS file-system description object

This function writes the master node. The caller has to take the ->mst_mutex lock before calling this function. Returns zero in case of success and a negative error code in case of failure. The master node is written twice to enable recovery.

Definition at line 360 of file master.c.

int ubifs_write_node ( struct ubifs_info c,
void buf,
int  len,
int  lnum,
int  offs 
)

ubifs_write_node - write node to the media. : UBIFS file-system description object : the node to write : node length : logical eraseblock number : offset within the logical eraseblock

This function automatically fills node magic number, assigns sequence number, and calculates node CRC checksum. The length of the buffer has to be aligned to the minimal I/O unit size. This function automatically appends padding node and padding bytes if needed. Returns zero in case of success and a negative error code in case of failure.

Definition at line 858 of file io.c.

int ubifs_write_rcvrd_mst_node ( struct ubifs_info c)

ubifs_write_rcvrd_mst_node - write the recovered master node. : UBIFS file-system description object

This function writes the master node that was recovered during mounting in read-only mode and must now be written because we are remounting rw.

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

Definition at line 386 of file recovery.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.

Variable Documentation

struct backing_dev_info ubifs_backing_dev_info
atomic_long_t ubifs_clean_zn_cnt

Definition at line 58 of file shrinker.c.

Definition at line 75 of file compress.c.

struct inode_operations ubifs_dir_inode_operations

Definition at line 1161 of file dir.c.

struct file_operations ubifs_dir_operations

Definition at line 1179 of file dir.c.

struct address_space_operations ubifs_file_address_operations

Definition at line 1553 of file file.c.

struct inode_operations ubifs_file_inode_operations

Definition at line 1563 of file file.c.

struct file_operations ubifs_file_operations

Definition at line 1579 of file file.c.

struct list_head ubifs_infos
spinlock_t ubifs_infos_lock
struct kmem_cache* ubifs_inode_slab

Definition at line 48 of file super.c.

struct super_operations ubifs_super_operations

Definition at line 1883 of file super.c.

struct inode_operations ubifs_symlink_inode_operations

Definition at line 1572 of file file.c.