Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
ubifs_inode Struct Reference

#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
 
voiddata
 

Detailed Description

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.

Definition at line 393 of file ubifs.h.

Field Documentation

unsigned int bulk_read

Definition at line 402 of file ubifs.h.

unsigned int compr_type

Definition at line 403 of file ubifs.h.

unsigned long long creat_sqnum

Definition at line 395 of file ubifs.h.

Definition at line 412 of file ubifs.h.

int data_len

Definition at line 411 of file ubifs.h.

unsigned long long del_cmtno

Definition at line 396 of file ubifs.h.

unsigned int dirty

Definition at line 400 of file ubifs.h.

int flags

Definition at line 408 of file ubifs.h.

pgoff_t last_page_read

Definition at line 409 of file ubifs.h.

pgoff_t read_in_a_row

Definition at line 410 of file ubifs.h.

loff_t synced_i_size

Definition at line 406 of file ubifs.h.

spinlock_t ui_lock

Definition at line 405 of file ubifs.h.

struct mutex ui_mutex

Definition at line 404 of file ubifs.h.

loff_t ui_size

Definition at line 407 of file ubifs.h.

struct inode vfs_inode

Definition at line 394 of file ubifs.h.

unsigned int xattr

Definition at line 401 of file ubifs.h.

unsigned int xattr_cnt

Definition at line 398 of file ubifs.h.

unsigned int xattr_names

Definition at line 399 of file ubifs.h.

unsigned int xattr_size

Definition at line 397 of file ubifs.h.


The documentation for this struct was generated from the following file: