Linux Kernel
3.7.1
|
#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 |
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 } |
#define BASEHD UBIFS_BASE_HEAD |
#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 COMPRESSED_DATA_NODE_BUF_SZ (UBIFS_DATA_NODE_SZ + UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR) |
#define DATAHD UBIFS_DATA_HEAD |
#define GCHD UBIFS_GC_HEAD |
#define MIN_WRITE_SZ (UBIFS_DATA_NODE_SZ + 8) |
#define UBIFS_BLOCKS_PER_PAGE (PAGE_CACHE_SIZE / UBIFS_BLOCK_SIZE) |
#define UBIFS_BLOCKS_PER_PAGE_SHIFT (PAGE_CACHE_SHIFT - UBIFS_BLOCK_SHIFT) |
#define ubifs_err | ( | fmt, | |
... | |||
) |
#define UBIFS_INVALID_KEY UBIFS_KEY_TYPES_CNT |
#define UBIFS_TRUN_KEY UBIFS_KEY_TYPES_CNT |
#define ubifs_warn | ( | fmt, | |
... | |||
) |
typedef int(* ubifs_lpt_scan_callback)(struct ubifs_info *c, const struct ubifs_lprops *lprops, int in_tree, void *data) |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
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.
int insert_old_idx_znode | ( | struct ubifs_info * | c, |
struct ubifs_znode * | znode | ||
) |
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.
void ubifs_add_bud | ( | struct ubifs_info * | c, |
struct ubifs_bud * | bud | ||
) |
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.
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 | ||
) |
int ubifs_add_orphan | ( | struct ubifs_info * | c, |
ino_t | inum | ||
) |
int ubifs_add_snod | ( | const struct ubifs_info * | c, |
struct ubifs_scan_leb * | sleb, | ||
void * | buf, | ||
int | offs | ||
) |
void ubifs_add_to_cat | ( | struct ubifs_info * | c, |
struct ubifs_lprops * | lprops, | ||
int | cat | ||
) |
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.
int ubifs_bg_wbufs_sync | ( | struct ubifs_info * | 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.
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.
int ubifs_calc_lpt_geom | ( | struct ubifs_info * | c | ) |
int ubifs_calc_min_idx_lebs | ( | struct ubifs_info * | 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.
|
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.
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.
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.
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 | ) |
void ubifs_commit_required | ( | struct ubifs_info * | 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.
ubifs_compressors_exit - de-initialize UBIFS compressors.
Definition at line 246 of file compress.c.
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.
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.
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.
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 | ||
) |
void ubifs_destroy_idx_gc | ( | struct ubifs_info * | 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.
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.
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.
|
read |
|
read |
|
read |
|
read |
int ubifs_find_dirty_idx_leb | ( | struct ubifs_info * | 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".
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.
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.
|
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.
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.
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.
int ubifs_gc_end_commit | ( | struct ubifs_info * | 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.
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.
long long ubifs_get_free_space | ( | struct ubifs_info * | 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.
int ubifs_get_idx_gc_leb | ( | struct ubifs_info * | c | ) |
void ubifs_get_lp_stats | ( | struct ubifs_info * | c, |
struct ubifs_lp_stats * | lst | ||
) |
|
read |
|
read |
|
read |
|
read |
int ubifs_io_init | ( | struct ubifs_info * | 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.
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.
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.
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.
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.
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.
|
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.
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.
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.
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.
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.
|
read |
|
read |
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.
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.
int ubifs_orphan_end_commit | ( | struct ubifs_info * | c | ) |
int ubifs_orphan_start_commit | ( | struct ubifs_info * | c | ) |
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_nnode | ( | struct ubifs_info * | c, |
void * | buf, | ||
struct ubifs_nnode * | nnode | ||
) |
void ubifs_pack_pnode | ( | struct ubifs_info * | c, |
void * | buf, | ||
struct ubifs_pnode * | pnode | ||
) |
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.
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.
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 | ) |
int ubifs_read_nnode | ( | struct ubifs_info * | c, |
struct ubifs_nnode * | parent, | ||
int | iip | ||
) |
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.
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.
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.
|
read |
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.
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.
|
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.
|
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.
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.
void ubifs_release_ino_dirty | ( | struct ubifs_info * | c, |
struct inode * | inode, | ||
struct ubifs_budget_req * | req | ||
) |
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.
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).
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.
void ubifs_request_bg_commit | ( | struct ubifs_info * | c | ) |
void ubifs_ro_mode | ( | struct ubifs_info * | c, |
int | err | ||
) |
int ubifs_run_commit | ( | struct ubifs_info * | 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.
|
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.
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.
void ubifs_scan_destroy | ( | struct ubifs_scan_leb * | sleb | ) |
|
read |
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.
int ubifs_shrinker | ( | struct shrinker * | shrink, |
struct shrink_control * | sc | ||
) |
Definition at line 280 of file shrinker.c.
|
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.
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.
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.
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.
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.
void ubifs_tnc_close | ( | struct ubifs_info * | 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.
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.
|
read |
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 .
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.
|
read |
|
read |
|
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 | ||
) |
int ubifs_tnc_remove_ino | ( | struct ubifs_info * | c, |
ino_t | inum | ||
) |
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.
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.
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.
int ubifs_unpack_nnode | ( | const struct ubifs_info * | c, |
void * | buf, | ||
struct ubifs_nnode * | nnode | ||
) |
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.
int ubifs_validate_entry | ( | struct ubifs_info * | c, |
const struct ubifs_dent_node * | dent | ||
) |
void ubifs_wait_for_commit | ( | struct ubifs_info * | c | ) |
void ubifs_wbuf_add_ino_nolock | ( | struct ubifs_wbuf * | wbuf, |
ino_t | inum | ||
) |
int ubifs_wbuf_init | ( | struct ubifs_info * | c, |
struct ubifs_wbuf * | wbuf | ||
) |
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.
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.
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.
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.
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.
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.
struct backing_dev_info ubifs_backing_dev_info |
atomic_long_t ubifs_clean_zn_cnt |
Definition at line 58 of file shrinker.c.
struct ubifs_compressor* ubifs_compressors[UBIFS_COMPR_TYPES_CNT] |
Definition at line 75 of file compress.c.
struct inode_operations ubifs_dir_inode_operations |
struct file_operations ubifs_dir_operations |
struct address_space_operations ubifs_file_address_operations |
struct inode_operations ubifs_file_inode_operations |
struct file_operations ubifs_file_operations |
spinlock_t ubifs_infos_lock |
struct kmem_cache* ubifs_inode_slab |
struct super_operations ubifs_super_operations |
struct inode_operations ubifs_symlink_inode_operations |