Linux Kernel
3.7.1
|
#include "ubifs.h"
Go to the source code of this file.
Functions | |
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 *inode, const struct inode *host) |
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.