Linux Kernel
3.7.1
|
#include <ubifs.h>
Data Fields | |
struct inode | vfs_inode |
unsigned long long | creat_sqnum |
unsigned long long | del_cmtno |
unsigned int | xattr_size |
unsigned int | xattr_cnt |
unsigned int | xattr_names |
unsigned int | dirty:1 |
unsigned int | xattr:1 |
unsigned int | bulk_read:1 |
unsigned int | compr_type:2 |
struct mutex | ui_mutex |
spinlock_t | ui_lock |
loff_t | synced_i_size |
loff_t | ui_size |
int | flags |
pgoff_t | last_page_read |
pgoff_t | read_in_a_row |
int | data_len |
void * | data |
struct ubifs_inode - UBIFS in-memory inode description. : VFS inode description object : sequence number at time of creation : commit number corresponding to the time the inode was deleted, protected by ->commit_sem; : summarized size of all extended attributes in bytes : count of extended attributes this inode has : sum of lengths of all extended attribute names belonging to this inode : non-zero if the inode is dirty : non-zero if this is an extended attribute inode : non-zero if bulk-read should be used : serializes inode write-back with the rest of VFS operations, serializes "clean <-> dirty" state changes, serializes bulk-read, protects , , , and : protects : synchronized size of inode, i.e. the value of inode size currently stored on the flash; used only for regular file inodes : inode size used by UBIFS when writing to flash : inode flags (, etc) : default compression type used for this inode : page number of last page read (for bulk read) : number of consecutive pages read in a row (for bulk read) : length of the data attached to the inode : inode's data
exists for two main reasons. At first it prevents inodes from being written back while UBIFS changing them, being in the middle of an VFS operation. This way UBIFS makes sure the inode fields are consistent. For example, in 'ubifs_rename()' we change 3 inodes simultaneously, and write-back must not write any of them before we have finished.
The second reason is budgeting - UBIFS has to budget all operations. If an operation is going to mark an inode dirty, it has to allocate budget for this. It cannot just mark it dirty because there is no guarantee there will be enough flash space to write the inode back later. This means UBIFS has to have full control over inode "clean <-> dirty" transitions (and pages actually). But unfortunately, VFS marks inodes dirty in many places, and it does not ask the file-system if it is allowed to do so (there is a notifier, but it is not enough), i.e., there is no mechanism to synchronize with this. So UBIFS has its own inode dirty flag and its own mutex to serialize "clean <-> dirty" transitions.
The field is used to make sure we never write pages which are beyond last synchronized inode size. See 'ubifs_writepage()' for more information.
The is a "shadow" variable for ->i_size and UBIFS uses instead of ->i_size. The reason for this is that UBIFS cannot make sure ->i_size is always changed under , because it cannot call 'truncate_setsize()' with locked, because it would deadlock with 'ubifs_writepage()' (see file.c). All the other inode fields are changed under , so they do not need "shadow" fields. Note, one could consider to rework locking and base it on "shadow" fields.
spinlock_t ui_lock |