Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
extent_io.c File Reference
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/bio.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/page-flags.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/blkdev.h>
#include <linux/swap.h>
#include <linux/writeback.h>
#include <linux/pagevec.h>
#include <linux/prefetch.h>
#include <linux/cleancache.h>
#include "extent_io.h"
#include "extent_map.h"
#include "compat.h"
#include "ctree.h"
#include "btrfs_inode.h"
#include "volumes.h"
#include "check-integrity.h"
#include "locking.h"
#include "rcu-string.h"

Go to the source code of this file.

Data Structures

struct  tree_entry
 
struct  extent_page_data
 
struct  io_failure_record
 

Macros

#define LEAK_DEBUG   0
 
#define BUFFER_LRU_MAX   64
 

Functions

int __init extent_io_init (void)
 
void extent_io_exit (void)
 
void extent_io_tree_init (struct extent_io_tree *tree, struct address_space *mapping)
 
void free_extent_state (struct extent_state *state)
 
void extent_io_tree_panic (struct extent_io_tree *tree, int err)
 
int clear_extent_bit (struct extent_io_tree *tree, u64 start, u64 end, int bits, int wake, int delete, struct extent_state **cached_state, gfp_t mask)
 
void wait_extent_bit (struct extent_io_tree *tree, u64 start, u64 end, int bits)
 
int set_extent_bit (struct extent_io_tree *tree, u64 start, u64 end, int bits, u64 *failed_start, struct extent_state **cached_state, gfp_t mask)
 
int convert_extent_bit (struct extent_io_tree *tree, u64 start, u64 end, int bits, int clear_bits, struct extent_state **cached_state, gfp_t mask)
 
int set_extent_dirty (struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask)
 
int set_extent_bits (struct extent_io_tree *tree, u64 start, u64 end, int bits, gfp_t mask)
 
int clear_extent_bits (struct extent_io_tree *tree, u64 start, u64 end, int bits, gfp_t mask)
 
int set_extent_delalloc (struct extent_io_tree *tree, u64 start, u64 end, struct extent_state **cached_state, gfp_t mask)
 
int set_extent_defrag (struct extent_io_tree *tree, u64 start, u64 end, struct extent_state **cached_state, gfp_t mask)
 
int clear_extent_dirty (struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask)
 
int set_extent_new (struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask)
 
int set_extent_uptodate (struct extent_io_tree *tree, u64 start, u64 end, struct extent_state **cached_state, gfp_t mask)
 
int clear_extent_uptodate (struct extent_io_tree *tree, u64 start, u64 end, struct extent_state **cached_state, gfp_t mask)
 
int lock_extent_bits (struct extent_io_tree *tree, u64 start, u64 end, int bits, struct extent_state **cached_state)
 
int lock_extent (struct extent_io_tree *tree, u64 start, u64 end)
 
int try_lock_extent (struct extent_io_tree *tree, u64 start, u64 end)
 
int unlock_extent_cached (struct extent_io_tree *tree, u64 start, u64 end, struct extent_state **cached, gfp_t mask)
 
int unlock_extent (struct extent_io_tree *tree, u64 start, u64 end)
 
struct extent_statefind_first_extent_bit_state (struct extent_io_tree *tree, u64 start, int bits)
 
int find_first_extent_bit (struct extent_io_tree *tree, u64 start, u64 *start_ret, u64 *end_ret, int bits, struct extent_state **cached_state)
 
int extent_clear_unlock_delalloc (struct inode *inode, struct extent_io_tree *tree, u64 start, u64 end, struct page *locked_page, unsigned long op)
 
u64 count_range_bits (struct extent_io_tree *tree, u64 *start, u64 search_end, u64 max_bytes, unsigned long bits, int contig)
 
int set_state_private (struct extent_io_tree *tree, u64 start, u64 private)
 
int get_state_private (struct extent_io_tree *tree, u64 start, u64 *private)
 
int test_range_bit (struct extent_io_tree *tree, u64 start, u64 end, int bits, int filled, struct extent_state *cached)
 
int repair_io_failure (struct btrfs_mapping_tree *map_tree, u64 start, u64 length, u64 logical, struct page *page, int mirror_num)
 
int repair_eb_io_failure (struct btrfs_root *root, struct extent_buffer *eb, int mirror_num)
 
int end_extent_writepage (struct page *page, int err, u64 start, u64 end)
 
struct bio * btrfs_bio_alloc (struct block_device *bdev, u64 first_sector, int nr_vecs, gfp_t gfp_flags)
 
void attach_extent_buffer_page (struct extent_buffer *eb, struct page *page)
 
void set_page_extent_mapped (struct page *page)
 
int extent_read_full_page (struct extent_io_tree *tree, struct page *page, get_extent_t *get_extent, int mirror_num)
 
int btree_write_cache_pages (struct address_space *mapping, struct writeback_control *wbc)
 
int extent_write_full_page (struct extent_io_tree *tree, struct page *page, get_extent_t *get_extent, struct writeback_control *wbc)
 
int extent_write_locked_range (struct extent_io_tree *tree, struct inode *inode, u64 start, u64 end, get_extent_t *get_extent, int mode)
 
int extent_writepages (struct extent_io_tree *tree, struct address_space *mapping, get_extent_t *get_extent, struct writeback_control *wbc)
 
int extent_readpages (struct extent_io_tree *tree, struct address_space *mapping, struct list_head *pages, unsigned nr_pages, get_extent_t get_extent)
 
int extent_invalidatepage (struct extent_io_tree *tree, struct page *page, unsigned long offset)
 
int try_release_extent_state (struct extent_map_tree *map, struct extent_io_tree *tree, struct page *page, gfp_t mask)
 
int try_release_extent_mapping (struct extent_map_tree *map, struct extent_io_tree *tree, struct page *page, gfp_t mask)
 
int extent_fiemap (struct inode *inode, struct fiemap_extent_info *fieinfo, __u64 start, __u64 len, get_extent_t *get_extent)
 
struct extent_bufferbtrfs_clone_extent_buffer (struct extent_buffer *src)
 
struct extent_bufferalloc_dummy_extent_buffer (u64 start, unsigned long len)
 
struct extent_bufferalloc_extent_buffer (struct extent_io_tree *tree, u64 start, unsigned long len)
 
struct extent_bufferfind_extent_buffer (struct extent_io_tree *tree, u64 start, unsigned long len)
 
void free_extent_buffer (struct extent_buffer *eb)
 
void free_extent_buffer_stale (struct extent_buffer *eb)
 
void clear_extent_buffer_dirty (struct extent_buffer *eb)
 
int set_extent_buffer_dirty (struct extent_buffer *eb)
 
int clear_extent_buffer_uptodate (struct extent_buffer *eb)
 
int set_extent_buffer_uptodate (struct extent_buffer *eb)
 
int extent_range_uptodate (struct extent_io_tree *tree, u64 start, u64 end)
 
int extent_buffer_uptodate (struct extent_buffer *eb)
 
int read_extent_buffer_pages (struct extent_io_tree *tree, struct extent_buffer *eb, u64 start, int wait, get_extent_t *get_extent, int mirror_num)
 
void read_extent_buffer (struct extent_buffer *eb, void *dstv, unsigned long start, unsigned long len)
 
int map_private_extent_buffer (struct extent_buffer *eb, unsigned long start, unsigned long min_len, char **map, unsigned long *map_start, unsigned long *map_len)
 
int memcmp_extent_buffer (struct extent_buffer *eb, const void *ptrv, unsigned long start, unsigned long len)
 
void write_extent_buffer (struct extent_buffer *eb, const void *srcv, unsigned long start, unsigned long len)
 
void memset_extent_buffer (struct extent_buffer *eb, char c, unsigned long start, unsigned long len)
 
void copy_extent_buffer (struct extent_buffer *dst, struct extent_buffer *src, unsigned long dst_offset, unsigned long src_offset, unsigned long len)
 
void memcpy_extent_buffer (struct extent_buffer *dst, unsigned long dst_offset, unsigned long src_offset, unsigned long len)
 
void memmove_extent_buffer (struct extent_buffer *dst, unsigned long dst_offset, unsigned long src_offset, unsigned long len)
 
int try_release_extent_buffer (struct page *page, gfp_t mask)
 

Macro Definition Documentation

#define BUFFER_LRU_MAX   64

Definition at line 36 of file extent_io.c.

#define LEAK_DEBUG   0

Definition at line 31 of file extent_io.c.

Function Documentation

struct extent_buffer* alloc_dummy_extent_buffer ( u64  start,
unsigned long  len 
)
read

Definition at line 4092 of file extent_io.c.

struct extent_buffer* alloc_extent_buffer ( struct extent_io_tree tree,
u64  start,
unsigned long  len 
)
read

Definition at line 4230 of file extent_io.c.

void attach_extent_buffer_page ( struct extent_buffer eb,
struct page page 
)

Definition at line 2573 of file extent_io.c.

int btree_write_cache_pages ( struct address_space mapping,
struct writeback_control wbc 
)

Definition at line 3258 of file extent_io.c.

struct bio* btrfs_bio_alloc ( struct block_device bdev,
u64  first_sector,
int  nr_vecs,
gfp_t  gfp_flags 
)
read

Definition at line 2449 of file extent_io.c.

struct extent_buffer* btrfs_clone_extent_buffer ( struct extent_buffer src)
read

Definition at line 4065 of file extent_io.c.

int clear_extent_bit ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
int  wake,
int  delete,
struct extent_state **  cached_state,
gfp_t  mask 
)

Definition at line 488 of file extent_io.c.

int clear_extent_bits ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
gfp_t  mask 
)

Definition at line 1155 of file extent_io.c.

void clear_extent_buffer_dirty ( struct extent_buffer eb)

Definition at line 4447 of file extent_io.c.

int clear_extent_buffer_uptodate ( struct extent_buffer eb)

Definition at line 4507 of file extent_io.c.

int clear_extent_dirty ( struct extent_io_tree tree,
u64  start,
u64  end,
gfp_t  mask 
)

Definition at line 1177 of file extent_io.c.

int clear_extent_uptodate ( struct extent_io_tree tree,
u64  start,
u64  end,
struct extent_state **  cached_state,
gfp_t  mask 
)

Definition at line 1199 of file extent_io.c.

int convert_extent_bit ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
int  clear_bits,
struct extent_state **  cached_state,
gfp_t  mask 
)

convert_extent_bit - convert all bits in a given range from one bit to another : the io tree to search : the start offset in bytes : the end offset in bytes (inclusive) : the bits to set in this range : the bits to clear in this range : state that we're going to cache : the allocation mask

This will go through and set bits for the given range. If any states exist already in this range they are set with the given bit and cleared of the clear_bits. This is only meant to be used by things that are mergeable, ie converting from say DELALLOC to DIRTY. This is not meant to be used with boundary bits like LOCK.

Definition at line 955 of file extent_io.c.

void copy_extent_buffer ( struct extent_buffer dst,
struct extent_buffer src,
unsigned long  dst_offset,
unsigned long  src_offset,
unsigned long  len 
)

Definition at line 4834 of file extent_io.c.

u64 count_range_bits ( struct extent_io_tree tree,
u64 start,
u64  search_end,
u64  max_bytes,
unsigned long  bits,
int  contig 
)

Definition at line 1662 of file extent_io.c.

int end_extent_writepage ( struct page page,
int  err,
u64  start,
u64  end 
)

Definition at line 2257 of file extent_io.c.

int extent_buffer_uptodate ( struct extent_buffer eb)

Definition at line 4569 of file extent_io.c.

int extent_clear_unlock_delalloc ( struct inode inode,
struct extent_io_tree tree,
u64  start,
u64  end,
struct page locked_page,
unsigned long  op 
)

Definition at line 1600 of file extent_io.c.

int extent_fiemap ( struct inode inode,
struct fiemap_extent_info fieinfo,
__u64  start,
__u64  len,
get_extent_t get_extent 
)

Definition at line 3828 of file extent_io.c.

int extent_invalidatepage ( struct extent_io_tree tree,
struct page page,
unsigned long  offset 
)

Definition at line 3681 of file extent_io.c.

void extent_io_exit ( void  )

Definition at line 86 of file extent_io.c.

int __init extent_io_init ( void  )

Definition at line 66 of file extent_io.c.

void extent_io_tree_init ( struct extent_io_tree tree,
struct address_space mapping 
)

Definition at line 123 of file extent_io.c.

void extent_io_tree_panic ( struct extent_io_tree tree,
int  err 
)

Definition at line 469 of file extent_io.c.

int extent_range_uptodate ( struct extent_io_tree tree,
u64  start,
u64  end 
)

Definition at line 4538 of file extent_io.c.

int extent_read_full_page ( struct extent_io_tree tree,
struct page page,
get_extent_t get_extent,
int  mirror_num 
)

Definition at line 2781 of file extent_io.c.

int extent_readpages ( struct extent_io_tree tree,
struct address_space mapping,
struct list_head pages,
unsigned  nr_pages,
get_extent_t  get_extent 
)

Definition at line 3630 of file extent_io.c.

int extent_write_full_page ( struct extent_io_tree tree,
struct page page,
get_extent_t get_extent,
struct writeback_control wbc 
)

Definition at line 3544 of file extent_io.c.

int extent_write_locked_range ( struct extent_io_tree tree,
struct inode inode,
u64  start,
u64  end,
get_extent_t get_extent,
int  mode 
)

Definition at line 3564 of file extent_io.c.

int extent_writepages ( struct extent_io_tree tree,
struct address_space mapping,
get_extent_t get_extent,
struct writeback_control wbc 
)

Definition at line 3608 of file extent_io.c.

struct extent_buffer* find_extent_buffer ( struct extent_io_tree tree,
u64  start,
unsigned long  len 
)
read

Definition at line 4357 of file extent_io.c.

int find_first_extent_bit ( struct extent_io_tree tree,
u64  start,
u64 start_ret,
u64 end_ret,
int  bits,
struct extent_state **  cached_state 
)

Definition at line 1320 of file extent_io.c.

struct extent_state* find_first_extent_bit_state ( struct extent_io_tree tree,
u64  start,
int  bits 
)
read

Definition at line 1286 of file extent_io.c.

void free_extent_buffer ( struct extent_buffer eb)

Definition at line 4410 of file extent_io.c.

void free_extent_buffer_stale ( struct extent_buffer eb)

Definition at line 4433 of file extent_io.c.

void free_extent_state ( struct extent_state state)

Definition at line 159 of file extent_io.c.

int get_state_private ( struct extent_io_tree tree,
u64  start,
u64 private 
)

Definition at line 1750 of file extent_io.c.

int lock_extent ( struct extent_io_tree tree,
u64  start,
u64  end 
)

Definition at line 1229 of file extent_io.c.

int lock_extent_bits ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
struct extent_state **  cached_state 
)

Definition at line 1210 of file extent_io.c.

int map_private_extent_buffer ( struct extent_buffer eb,
unsigned long  start,
unsigned long  min_len,
char **  map,
unsigned long map_start,
unsigned long map_len 
)

Definition at line 4699 of file extent_io.c.

int memcmp_extent_buffer ( struct extent_buffer eb,
const void ptrv,
unsigned long  start,
unsigned long  len 
)

Definition at line 4738 of file extent_io.c.

void memcpy_extent_buffer ( struct extent_buffer dst,
unsigned long  dst_offset,
unsigned long  src_offset,
unsigned long  len 
)

Definition at line 4912 of file extent_io.c.

void memmove_extent_buffer ( struct extent_buffer dst,
unsigned long  dst_offset,
unsigned long  src_offset,
unsigned long  len 
)

Definition at line 4957 of file extent_io.c.

void memset_extent_buffer ( struct extent_buffer eb,
char  c,
unsigned long  start,
unsigned long  len 
)

Definition at line 4805 of file extent_io.c.

void read_extent_buffer ( struct extent_buffer eb,
void dstv,
unsigned long  start,
unsigned long  len 
)

Definition at line 4668 of file extent_io.c.

int read_extent_buffer_pages ( struct extent_io_tree tree,
struct extent_buffer eb,
u64  start,
int  wait,
get_extent_t get_extent,
int  mirror_num 
)

Definition at line 4574 of file extent_io.c.

int repair_eb_io_failure ( struct btrfs_root root,
struct extent_buffer eb,
int  mirror_num 
)

Definition at line 1984 of file extent_io.c.

int repair_io_failure ( struct btrfs_mapping_tree map_tree,
u64  start,
u64  length,
u64  logical,
struct page page,
int  mirror_num 
)

Definition at line 1927 of file extent_io.c.

int set_extent_bit ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
u64 failed_start,
struct extent_state **  cached_state,
gfp_t  mask 
)

Definition at line 929 of file extent_io.c.

int set_extent_bits ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
gfp_t  mask 
)

Definition at line 1148 of file extent_io.c.

int set_extent_buffer_dirty ( struct extent_buffer eb)

Definition at line 4477 of file extent_io.c.

int set_extent_buffer_uptodate ( struct extent_buffer eb)

Definition at line 4523 of file extent_io.c.

int set_extent_defrag ( struct extent_io_tree tree,
u64  start,
u64  end,
struct extent_state **  cached_state,
gfp_t  mask 
)

Definition at line 1169 of file extent_io.c.

int set_extent_delalloc ( struct extent_io_tree tree,
u64  start,
u64  end,
struct extent_state **  cached_state,
gfp_t  mask 
)

Definition at line 1161 of file extent_io.c.

int set_extent_dirty ( struct extent_io_tree tree,
u64  start,
u64  end,
gfp_t  mask 
)

Definition at line 1141 of file extent_io.c.

int set_extent_new ( struct extent_io_tree tree,
u64  start,
u64  end,
gfp_t  mask 
)

Definition at line 1185 of file extent_io.c.

int set_extent_uptodate ( struct extent_io_tree tree,
u64  start,
u64  end,
struct extent_state **  cached_state,
gfp_t  mask 
)

Definition at line 1192 of file extent_io.c.

void set_page_extent_mapped ( struct page page)

Definition at line 2584 of file extent_io.c.

int set_state_private ( struct extent_io_tree tree,
u64  start,
u64  private 
)

Definition at line 1723 of file extent_io.c.

int test_range_bit ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits,
int  filled,
struct extent_state cached 
)

Definition at line 1783 of file extent_io.c.

int try_lock_extent ( struct extent_io_tree tree,
u64  start,
u64  end 
)

Definition at line 1234 of file extent_io.c.

int try_release_extent_buffer ( struct page page,
gfp_t  mask 
)

Definition at line 5005 of file extent_io.c.

int try_release_extent_mapping ( struct extent_map_tree map,
struct extent_io_tree tree,
struct page page,
gfp_t  mask 
)

Definition at line 3745 of file extent_io.c.

int try_release_extent_state ( struct extent_map_tree map,
struct extent_io_tree tree,
struct page page,
gfp_t  mask 
)

Definition at line 3707 of file extent_io.c.

int unlock_extent ( struct extent_io_tree tree,
u64  start,
u64  end 
)

Definition at line 1257 of file extent_io.c.

int unlock_extent_cached ( struct extent_io_tree tree,
u64  start,
u64  end,
struct extent_state **  cached,
gfp_t  mask 
)

Definition at line 1250 of file extent_io.c.

void wait_extent_bit ( struct extent_io_tree tree,
u64  start,
u64  end,
int  bits 
)

Definition at line 650 of file extent_io.c.

void write_extent_buffer ( struct extent_buffer eb,
const void srcv,
unsigned long  start,
unsigned long  len 
)

Definition at line 4774 of file extent_io.c.