Linux Kernel
3.7.1
|
Go to the source code of this file.
Enumerations | |
enum | { NAME_LESS = 0, NAME_MATCHES = 1, NAME_GREATER = 2, NOT_ON_MEDIA = 3 } |
Functions | |
int | insert_old_idx_znode (struct ubifs_info *c, struct ubifs_znode *znode) |
void | destroy_old_idx (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_locate (struct ubifs_info *c, const union ubifs_key *key, void *node, int *lnum, int *offs) |
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) |
int | ubifs_tnc_lookup_nm (struct ubifs_info *c, const union ubifs_key *key, void *node, const struct qstr *nm) |
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) |
has to be NULL. | |
ubifs_tnc_next_ent - walk directory or extended attribute entries. This function finds and reads the next directory or extended attribute entry after the given key () if there is one. is used to resolve collisions. If the name of the current entry is not known and only the key is known, ->name has to be NULL. In this case the semantics of this function is a little bit different and it returns the entry corresponding to this key, not the next one. If the key was not found, the closest "right" entry is returned. If the fist entry has to be found, has to contain the lowest possible key value for this inode and This function returns the found directory or extended attribute entry node in case of success, %-ENOENT is returned if no entry was found, and a negative error code is returned in case of failure. | |
struct ubifs_dent_node * | ubifs_tnc_next_ent (struct ubifs_info *c, union ubifs_key *key, const struct qstr *nm) |
void | ubifs_tnc_close (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 | 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) |
int | dbg_check_inode_size (struct ubifs_info *c, const struct inode *inode, loff_t size) |
anonymous enum |
dbg_check_inode_size - check if inode size is correct. : UBIFS file-system description object : inode number : inode size
This function makes sure that the inode size () is correct and it does not have any pages beyond . Returns zero if the inode is OK, %-EINVAL if it has a data page beyond , and other negative error code in case of other errors.
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.
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.
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_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_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.
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 |
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.