Linux Kernel
3.7.1
|
Go to the source code of this file.
Macros | |
#define | MAX_MKSPC_RETRIES 3 |
#define | NR_TO_WRITE 16 |
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_min_idx_lebs | ( | struct ubifs_info * | c | ) |
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.
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.
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.
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.