Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
balloc.c File Reference
#include <linux/time.h>
#include <linux/capability.h>
#include <linux/fs.h>
#include <linux/jbd2.h>
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
#include "ext4.h"
#include "ext4_jbd2.h"
#include "mballoc.h"
#include <trace/events/ext4.h>

Go to the source code of this file.

Functions

void ext4_get_group_no_and_offset (struct super_block *sb, ext4_fsblk_t blocknr, ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp)
 
unsigned ext4_num_overhead_clusters (struct super_block *sb, ext4_group_t block_group, struct ext4_group_desc *gdp)
 
void ext4_init_block_bitmap (struct super_block *sb, struct buffer_head *bh, ext4_group_t block_group, struct ext4_group_desc *gdp)
 
unsigned ext4_free_clusters_after_init (struct super_block *sb, ext4_group_t block_group, struct ext4_group_desc *gdp)
 
struct ext4_group_descext4_get_group_desc (struct super_block *sb, ext4_group_t block_group, struct buffer_head **bh)
 
void ext4_validate_block_bitmap (struct super_block *sb, struct ext4_group_desc *desc, unsigned int block_group, struct buffer_head *bh)
 
struct buffer_head * ext4_read_block_bitmap_nowait (struct super_block *sb, ext4_group_t block_group)
 
int ext4_wait_block_bitmap (struct super_block *sb, ext4_group_t block_group, struct buffer_head *bh)
 
struct buffer_head * ext4_read_block_bitmap (struct super_block *sb, ext4_group_t block_group)
 
int ext4_claim_free_clusters (struct ext4_sb_info *sbi, s64 nclusters, unsigned int flags)
 
int ext4_should_retry_alloc (struct super_block *sb, int *retries)
 
ext4_fsblk_t ext4_new_meta_blocks (handle_t *handle, struct inode *inode, ext4_fsblk_t goal, unsigned int flags, unsigned long *count, int *errp)
 
ext4_fsblk_t ext4_count_free_clusters (struct super_block *sb)
 
int ext4_bg_has_super (struct super_block *sb, ext4_group_t group)
 
unsigned long ext4_bg_num_gdb (struct super_block *sb, ext4_group_t group)
 
ext4_fsblk_t ext4_inode_to_goal_block (struct inode *inode)
 

Function Documentation

int ext4_bg_has_super ( struct super_block sb,
ext4_group_t  group 
)

ext4_bg_has_super - number of blocks used by the superblock in group : superblock for filesystem : group number to check

Return the number of blocks used by the superblock (primary or backup) in this group. Currently this will be only 0 or 1.

Definition at line 674 of file balloc.c.

unsigned long ext4_bg_num_gdb ( struct super_block sb,
ext4_group_t  group 
)

ext4_bg_num_gdb - number of blocks used by the group table in group : superblock for filesystem : group number to check

Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group.

Definition at line 716 of file balloc.c.

int ext4_claim_free_clusters ( struct ext4_sb_info *  sbi,
s64  nclusters,
unsigned int  flags 
)

Definition at line 511 of file balloc.c.

ext4_fsblk_t ext4_count_free_clusters ( struct super_block sb)

ext4_count_free_clusters() – count filesystem free clusters : superblock

Adds up the number of free clusters from each block group.

Definition at line 595 of file balloc.c.

unsigned ext4_free_clusters_after_init ( struct super_block sb,
ext4_group_t  block_group,
struct ext4_group_desc gdp 
)

Definition at line 221 of file balloc.c.

struct ext4_group_desc* ext4_get_group_desc ( struct super_block sb,
ext4_group_t  block_group,
struct buffer_head **  bh 
)
read

ext4_get_group_desc() – load group descriptor from disk : super block : given block group : pointer to the buffer head to store the block group descriptor

Definition at line 247 of file balloc.c.

void ext4_get_group_no_and_offset ( struct super_block sb,
ext4_fsblk_t  blocknr,
ext4_group_t blockgrpp,
ext4_grpblk_t offsetp 
)

Definition at line 36 of file balloc.c.

void ext4_init_block_bitmap ( struct super_block sb,
struct buffer_head *  bh,
ext4_group_t  block_group,
struct ext4_group_desc gdp 
)

Definition at line 158 of file balloc.c.

ext4_fsblk_t ext4_inode_to_goal_block ( struct inode inode)

ext4_inode_to_goal_block - return a hint for block allocation : inode for block allocation

Return the ideal location to start allocating blocks for a newly created inode.

Definition at line 762 of file balloc.c.

ext4_fsblk_t ext4_new_meta_blocks ( handle_t *  handle,
struct inode inode,
ext4_fsblk_t  goal,
unsigned int  flags,
unsigned long count,
int errp 
)

Definition at line 557 of file balloc.c.

unsigned ext4_num_overhead_clusters ( struct super_block sb,
ext4_group_t  block_group,
struct ext4_group_desc gdp 
)

Definition at line 65 of file balloc.c.

struct buffer_head* ext4_read_block_bitmap ( struct super_block sb,
ext4_group_t  block_group 
)
read

Definition at line 455 of file balloc.c.

struct buffer_head* ext4_read_block_bitmap_nowait ( struct super_block sb,
ext4_group_t  block_group 
)
read

ext4_read_block_bitmap() : super block : given block group

Read the bitmap for a given block_group,and validate the bits for block/inode/inode tables are set in the bitmaps

Return buffer_head on success or NULL in case of failure.

Definition at line 371 of file balloc.c.

int ext4_should_retry_alloc ( struct super_block sb,
int retries 
)

ext4_should_retry_alloc() : super block number of attemps has been made

ext4_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.

Definition at line 533 of file balloc.c.

void ext4_validate_block_bitmap ( struct super_block sb,
struct ext4_group_desc desc,
unsigned int  block_group,
struct buffer_head *  bh 
)

Definition at line 332 of file balloc.c.

int ext4_wait_block_bitmap ( struct super_block sb,
ext4_group_t  block_group,
struct buffer_head *  bh 
)

Definition at line 431 of file balloc.c.