Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
free-space-cache.c File Reference
#include <linux/pagemap.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/math64.h>
#include <linux/ratelimit.h>
#include "ctree.h"
#include "free-space-cache.h"
#include "transaction.h"
#include "disk-io.h"
#include "extent_io.h"
#include "inode-map.h"

Go to the source code of this file.

Data Structures

struct  io_ctl
 

Macros

#define BITS_PER_BITMAP   (PAGE_CACHE_SIZE * 8)
 
#define MAX_CACHE_BYTES_PER_GIG   (32 * 1024)
 

Functions

struct inodelookup_free_space_inode (struct btrfs_root *root, struct btrfs_block_group_cache *block_group, struct btrfs_path *path)
 
int __create_free_space_inode (struct btrfs_root *root, struct btrfs_trans_handle *trans, struct btrfs_path *path, u64 ino, u64 offset)
 
int create_free_space_inode (struct btrfs_root *root, struct btrfs_trans_handle *trans, struct btrfs_block_group_cache *block_group, struct btrfs_path *path)
 
int btrfs_truncate_free_space_cache (struct btrfs_root *root, struct btrfs_trans_handle *trans, struct btrfs_path *path, struct inode *inode)
 
int __load_free_space_cache (struct btrfs_root *root, struct inode *inode, struct btrfs_free_space_ctl *ctl, struct btrfs_path *path, u64 offset)
 
int load_free_space_cache (struct btrfs_fs_info *fs_info, struct btrfs_block_group_cache *block_group)
 
int __btrfs_write_out_cache (struct btrfs_root *root, struct inode *inode, struct btrfs_free_space_ctl *ctl, struct btrfs_block_group_cache *block_group, struct btrfs_trans_handle *trans, struct btrfs_path *path, u64 offset)
 
int btrfs_write_out_cache (struct btrfs_root *root, struct btrfs_trans_handle *trans, struct btrfs_block_group_cache *block_group, struct btrfs_path *path)
 
int __btrfs_add_free_space (struct btrfs_free_space_ctl *ctl, u64 offset, u64 bytes)
 
int btrfs_remove_free_space (struct btrfs_block_group_cache *block_group, u64 offset, u64 bytes)
 
void btrfs_dump_free_space (struct btrfs_block_group_cache *block_group, u64 bytes)
 
void btrfs_init_free_space_ctl (struct btrfs_block_group_cache *block_group)
 
void __btrfs_remove_free_space_cache_locked (struct btrfs_free_space_ctl *ctl)
 
void __btrfs_remove_free_space_cache (struct btrfs_free_space_ctl *ctl)
 
void btrfs_remove_free_space_cache (struct btrfs_block_group_cache *block_group)
 
u64 btrfs_find_space_for_alloc (struct btrfs_block_group_cache *block_group, u64 offset, u64 bytes, u64 empty_size)
 
int btrfs_return_cluster_to_free_space (struct btrfs_block_group_cache *block_group, struct btrfs_free_cluster *cluster)
 
u64 btrfs_alloc_from_cluster (struct btrfs_block_group_cache *block_group, struct btrfs_free_cluster *cluster, u64 bytes, u64 min_start)
 
int btrfs_find_space_cluster (struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_block_group_cache *block_group, struct btrfs_free_cluster *cluster, u64 offset, u64 bytes, u64 empty_size)
 
void btrfs_init_free_cluster (struct btrfs_free_cluster *cluster)
 
int btrfs_trim_block_group (struct btrfs_block_group_cache *block_group, u64 *trimmed, u64 start, u64 end, u64 minlen)
 
u64 btrfs_find_ino_for_alloc (struct btrfs_root *fs_root)
 
struct inodelookup_free_ino_inode (struct btrfs_root *root, struct btrfs_path *path)
 
int create_free_ino_inode (struct btrfs_root *root, struct btrfs_trans_handle *trans, struct btrfs_path *path)
 
int load_free_ino_cache (struct btrfs_fs_info *fs_info, struct btrfs_root *root)
 
int btrfs_write_out_ino_cache (struct btrfs_root *root, struct btrfs_trans_handle *trans, struct btrfs_path *path)
 

Macro Definition Documentation

#define BITS_PER_BITMAP   (PAGE_CACHE_SIZE * 8)

Definition at line 31 of file free-space-cache.c.

#define MAX_CACHE_BYTES_PER_GIG   (32 * 1024)

Definition at line 32 of file free-space-cache.c.

Function Documentation

int __btrfs_add_free_space ( struct btrfs_free_space_ctl ctl,
u64  offset,
u64  bytes 
)

Definition at line 1827 of file free-space-cache.c.

void __btrfs_remove_free_space_cache ( struct btrfs_free_space_ctl ctl)

Definition at line 2067 of file free-space-cache.c.

void __btrfs_remove_free_space_cache_locked ( struct btrfs_free_space_ctl ctl)

Definition at line 2046 of file free-space-cache.c.

int __btrfs_write_out_cache ( struct btrfs_root root,
struct inode inode,
struct btrfs_free_space_ctl ctl,
struct btrfs_block_group_cache block_group,
struct btrfs_trans_handle trans,
struct btrfs_path path,
u64  offset 
)

__btrfs_write_out_cache - write out cached info to an inode - the root the inode belongs to - the free space cache we are going to write out - the block_group for this cache if it belongs to a block_group - the trans handle - the path to use - the offset for the key we'll insert

This function writes out a free space cache struct to disk for quick recovery on mount. This will return 0 if it was successfull in writing the cache out, and -1 if it was not.

Definition at line 870 of file free-space-cache.c.

int __create_free_space_inode ( struct btrfs_root root,
struct btrfs_trans_handle trans,
struct btrfs_path path,
u64  ino,
u64  offset 
)

Definition at line 122 of file free-space-cache.c.

int __load_free_space_cache ( struct btrfs_root root,
struct inode inode,
struct btrfs_free_space_ctl ctl,
struct btrfs_path path,
u64  offset 
)

Definition at line 628 of file free-space-cache.c.

u64 btrfs_alloc_from_cluster ( struct btrfs_block_group_cache block_group,
struct btrfs_free_cluster cluster,
u64  bytes,
u64  min_start 
)

Definition at line 2205 of file free-space-cache.c.

void btrfs_dump_free_space ( struct btrfs_block_group_cache block_group,
u64  bytes 
)

Definition at line 1959 of file free-space-cache.c.

u64 btrfs_find_ino_for_alloc ( struct btrfs_root fs_root)

Definition at line 2795 of file free-space-cache.c.

int btrfs_find_space_cluster ( struct btrfs_trans_handle trans,
struct btrfs_root root,
struct btrfs_block_group_cache block_group,
struct btrfs_free_cluster cluster,
u64  offset,
u64  bytes,
u64  empty_size 
)

Definition at line 2495 of file free-space-cache.c.

u64 btrfs_find_space_for_alloc ( struct btrfs_block_group_cache block_group,
u64  offset,
u64  bytes,
u64  empty_size 
)

Definition at line 2099 of file free-space-cache.c.

void btrfs_init_free_cluster ( struct btrfs_free_cluster cluster)

Definition at line 2577 of file free-space-cache.c.

void btrfs_init_free_space_ctl ( struct btrfs_block_group_cache block_group)

Definition at line 1982 of file free-space-cache.c.

int btrfs_remove_free_space ( struct btrfs_block_group_cache block_group,
u64  offset,
u64  bytes 
)

Definition at line 1872 of file free-space-cache.c.

void btrfs_remove_free_space_cache ( struct btrfs_block_group_cache block_group)

Definition at line 2074 of file free-space-cache.c.

int btrfs_return_cluster_to_free_space ( struct btrfs_block_group_cache block_group,
struct btrfs_free_cluster cluster 
)

Definition at line 2141 of file free-space-cache.c.

int btrfs_trim_block_group ( struct btrfs_block_group_cache block_group,
u64 trimmed,
u64  start,
u64  end,
u64  minlen 
)

Definition at line 2772 of file free-space-cache.c.

int btrfs_truncate_free_space_cache ( struct btrfs_root root,
struct btrfs_trans_handle trans,
struct btrfs_path path,
struct inode inode 
)

Definition at line 198 of file free-space-cache.c.

int btrfs_write_out_cache ( struct btrfs_root root,
struct btrfs_trans_handle trans,
struct btrfs_block_group_cache block_group,
struct btrfs_path path 
)

Definition at line 1078 of file free-space-cache.c.

int btrfs_write_out_ino_cache ( struct btrfs_root root,
struct btrfs_trans_handle trans,
struct btrfs_path path 
)

Definition at line 2912 of file free-space-cache.c.

int create_free_ino_inode ( struct btrfs_root root,
struct btrfs_trans_handle trans,
struct btrfs_path path 
)

Definition at line 2863 of file free-space-cache.c.

int create_free_space_inode ( struct btrfs_root root,
struct btrfs_trans_handle trans,
struct btrfs_block_group_cache block_group,
struct btrfs_path path 
)

Definition at line 182 of file free-space-cache.c.

int load_free_ino_cache ( struct btrfs_fs_info fs_info,
struct btrfs_root root 
)

Definition at line 2871 of file free-space-cache.c.

int load_free_space_cache ( struct btrfs_fs_info fs_info,
struct btrfs_block_group_cache block_group 
)

Definition at line 781 of file free-space-cache.c.

struct inode* lookup_free_ino_inode ( struct btrfs_root root,
struct btrfs_path path 
)
read

Definition at line 2839 of file free-space-cache.c.

struct inode* lookup_free_space_inode ( struct btrfs_root root,
struct btrfs_block_group_cache block_group,
struct btrfs_path path 
)
read

Definition at line 86 of file free-space-cache.c.