Linux Kernel
3.7.1
|
Go to the source code of this file.
Macros | |
#define | in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1) |
#define | rsv_window_dump(root, verbose) __rsv_window_dump((root), (verbose), __func__) |
int ext3_bg_has_super | ( | struct super_block * | sb, |
int | group | ||
) |
unsigned long ext3_bg_num_gdb | ( | struct super_block * | sb, |
int | group | ||
) |
ext3_fsblk_t ext3_count_free_blocks | ( | struct super_block * | sb | ) |
ext3_count_free_blocks() – count filesystem free blocks : superblock
Adds up the number of free blocks from each block group.
ext3_discard_reservation() : inode
Discard(free) block reservation window on last file close, or truncate or at last iput().
It is being called in three cases: ext3_release_file(): last writer close the file ext3_clear_inode(): last iput(), when nobody link to this file. ext3_truncate(): when the block indirect map is about to change.
void ext3_free_blocks | ( | handle_t * | handle, |
struct inode * | inode, | ||
ext3_fsblk_t | block, | ||
unsigned long | count | ||
) |
ext3_free_blocks() – Free given blocks and update quota : handle for this transaction : inode : start physical block to free : number of blocks to count
void ext3_free_blocks_sb | ( | handle_t * | handle, |
struct super_block * | sb, | ||
ext3_fsblk_t | block, | ||
unsigned long | count, | ||
unsigned long * | pdquot_freed_blocks | ||
) |
ext3_free_blocks_sb() – Free given blocks and update quota : handle to this transaction : super block : start physical block to free : number of blocks to free : pointer to quota
|
read |
ext3_init_block_alloc_info() : file inode structure
Allocate and initialize the reservation window structure, and link the window to the ext3 inode structure at last
The reservation window structure is only dynamically allocated and linked to ext3 inode the first time the open file needs a new block. So, before every ext3_new_block(s) call, for regular files, we should check whether the reservation window structure exists or not. In the latter case, this function is called. Fail to do so will result in block reservation being turned off for that open file.
This function is called from ext3_get_blocks_handle(), also called when setting the reservation window size through ioctl before the file is open for write (needs block allocation).
Needs truncate_mutex protection prior to call this function.
ext3_fsblk_t ext3_new_block | ( | handle_t * | handle, |
struct inode * | inode, | ||
ext3_fsblk_t | goal, | ||
int * | errp | ||
) |
ext3_fsblk_t ext3_new_blocks | ( | handle_t * | handle, |
struct inode * | inode, | ||
ext3_fsblk_t | goal, | ||
unsigned long * | count, | ||
int * | errp | ||
) |
ext3_new_blocks() – core block(s) allocation function : handle to this transaction : file inode : given target block(filesystem wide) : target number of blocks to allocate : error code
ext3_new_blocks uses a goal block to assist allocation. It tries to allocate block(s) from the block group contains the goal block first. If that fails, it will try to allocate block(s) from other block groups without any specific goal block.
void ext3_rsv_window_add | ( | struct super_block * | sb, |
struct ext3_reserve_window_node * | rsv | ||
) |
ext3_rsv_window_add() – Insert a window to the block reservation rb tree. : super block : reservation window to add
Must be called with rsv_lock hold.
int ext3_should_retry_alloc | ( | struct super_block * | sb, |
int * | retries | ||
) |
ext3_should_retry_alloc() : super block number of attemps has been made
ext3_should_retry_alloc() is called when ENOSPC is returned, and if it is profitable to retry the operation, this function will wait for the current or committing transaction to complete, and then return TRUE.
if the total number of retries exceed three times, return FALSE.
int ext3_trim_fs | ( | struct super_block * | sb, |
struct fstrim_range * | range | ||
) |
ext3_trim_fs() – trim ioctl handle function : superblock for filesystem : First Byte to trim : number of Bytes to trim from start : minimum extent length in Bytes
ext3_trim_fs goes through all allocation groups containing Bytes from start to start+len. For each such a group ext3_trim_all_free function is invoked to trim all free space.