Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
extent_map.h File Reference
#include <linux/rbtree.h>

Go to the source code of this file.

Data Structures

struct  extent_map
 
struct  extent_map_tree
 

Macros

#define EXTENT_MAP_LAST_BYTE   (u64)-4
 
#define EXTENT_MAP_HOLE   (u64)-3
 
#define EXTENT_MAP_INLINE   (u64)-2
 
#define EXTENT_MAP_DELALLOC   (u64)-1
 
#define EXTENT_FLAG_PINNED   0 /* this entry not yet on disk, don't free it */
 
#define EXTENT_FLAG_COMPRESSED   1
 
#define EXTENT_FLAG_VACANCY   2 /* no file extent item found */
 
#define EXTENT_FLAG_PREALLOC   3 /* pre-allocated extent */
 
#define EXTENT_FLAG_LOGGING   4 /* Logging this extent */
 

Functions

void extent_map_tree_init (struct extent_map_tree *tree)
 
struct extent_maplookup_extent_mapping (struct extent_map_tree *tree, u64 start, u64 len)
 
int add_extent_mapping (struct extent_map_tree *tree, struct extent_map *em)
 
int remove_extent_mapping (struct extent_map_tree *tree, struct extent_map *em)
 
struct extent_mapalloc_extent_map (void)
 
void free_extent_map (struct extent_map *em)
 
int __init extent_map_init (void)
 
void extent_map_exit (void)
 
int unpin_extent_cache (struct extent_map_tree *tree, u64 start, u64 len, u64 gen)
 
struct extent_mapsearch_extent_mapping (struct extent_map_tree *tree, u64 start, u64 len)
 

Macro Definition Documentation

#define EXTENT_FLAG_COMPRESSED   1

Definition at line 13 of file extent_map.h.

#define EXTENT_FLAG_LOGGING   4 /* Logging this extent */

Definition at line 16 of file extent_map.h.

#define EXTENT_FLAG_PINNED   0 /* this entry not yet on disk, don't free it */

Definition at line 12 of file extent_map.h.

#define EXTENT_FLAG_PREALLOC   3 /* pre-allocated extent */

Definition at line 15 of file extent_map.h.

#define EXTENT_FLAG_VACANCY   2 /* no file extent item found */

Definition at line 14 of file extent_map.h.

#define EXTENT_MAP_DELALLOC   (u64)-1

Definition at line 9 of file extent_map.h.

#define EXTENT_MAP_HOLE   (u64)-3

Definition at line 7 of file extent_map.h.

#define EXTENT_MAP_INLINE   (u64)-2

Definition at line 8 of file extent_map.h.

#define EXTENT_MAP_LAST_BYTE   (u64)-4

Definition at line 6 of file extent_map.h.

Function Documentation

int add_extent_mapping ( struct extent_map_tree tree,
struct extent_map em 
)

add_extent_mapping - add new extent map to the extent tree : tree to insert new map in : map to insert

Insert into or perform a simple forward/backward merge with existing mappings. The extent_map struct passed in will be inserted into the tree directly, with an additional reference taken, or a reference dropped if the merge attempt was successful.

Definition at line 298 of file extent_map.c.

struct extent_map* alloc_extent_map ( void  )
read

alloc_extent_map - allocate new extent map structure

Allocate a new extent_map structure. The new structure is returned with a reference count of one and needs to be freed using free_extent_map()

Definition at line 49 of file extent_map.c.

void extent_map_exit ( void  )

Definition at line 22 of file extent_map.c.

int __init extent_map_init ( void  )

Definition at line 12 of file extent_map.c.

void extent_map_tree_init ( struct extent_map_tree tree)

extent_map_tree_init - initialize extent map tree : tree to initialize

Initialize the extent tree . Should be called for each new inode or other user of the extent_map interface.

Definition at line 35 of file extent_map.c.

void free_extent_map ( struct extent_map em)

free_extent_map - drop reference count of an extent_map : extent map beeing releasead

Drops the reference out on by one and free the structure if the reference count hits zero.

Definition at line 71 of file extent_map.c.

struct extent_map* lookup_extent_mapping ( struct extent_map_tree tree,
u64  start,
u64  len 
)
read

lookup_extent_mapping - lookup extent_map : tree to lookup in : byte offset to start the search : length of the lookup range

Find and return the first extent_map struct in that intersects the [start, len] range. There may be additional objects in the tree that intersect, so check the object returned carefully to make sure that no additional lookups are needed.

Definition at line 373 of file extent_map.c.

int remove_extent_mapping ( struct extent_map_tree tree,
struct extent_map em 
)

remove_extent_mapping - removes an extent_map from the extent tree : extent tree to remove from : extent map beeing removed

Removes from . No reference counts are dropped, and no checks are done to see if the range is in use

Definition at line 404 of file extent_map.c.

struct extent_map* search_extent_mapping ( struct extent_map_tree tree,
u64  start,
u64  len 
)
read

search_extent_mapping - find a nearby extent map : tree to lookup in : byte offset to start the search : length of the lookup range

Find and return the first extent_map struct in that intersects the [start, len] range.

If one can't be found, any nearby extent may be returned

Definition at line 390 of file extent_map.c.

int unpin_extent_cache ( struct extent_map_tree tree,
u64  start,
u64  len,
u64  gen 
)

unpint_extent_cache - unpin an extent from the cache : tree to unpin the extent in : logical offset in the file : length of the extent : generation that this extent has been modified in : if this is set we need to clear the prealloc flag

Called after an extent has been written to disk properly. Set the generation to the generation that actually added the file item to the inode so we know we need to sync this extent when we call fsync().

Definition at line 248 of file extent_map.c.