Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
dm-bufio.c File Reference
#include "dm-bufio.h"
#include <linux/device-mapper.h>
#include <linux/dm-io.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/shrinker.h>
#include <linux/module.h>

Go to the source code of this file.

Data Structures

struct  dm_bufio_client
 
struct  dm_buffer
 

Macros

#define DM_MSG_PREFIX   "bufio"
 
#define DM_BUFIO_MIN_BUFFERS   8
 
#define DM_BUFIO_MEMORY_PERCENT   2
 
#define DM_BUFIO_VMALLOC_PERCENT   25
 
#define DM_BUFIO_WRITEBACK_PERCENT   75
 
#define DM_BUFIO_WORK_TIMER_SECS   10
 
#define DM_BUFIO_DEFAULT_AGE_SECS   60
 
#define DM_BUFIO_INLINE_VECS   16
 
#define DM_BUFIO_HASH_BITS   20
 
#define DM_BUFIO_HASH(block)
 
#define DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT   (PAGE_SIZE >> 1)
 
#define DM_BUFIO_BLOCK_SIZE_GFP_LIMIT   (PAGE_SIZE << (MAX_ORDER - 1))
 
#define LIST_CLEAN   0
 
#define LIST_DIRTY   1
 
#define LIST_SIZE   2
 
#define B_READING   0
 
#define B_WRITING   1
 
#define B_DIRTY   2
 
#define DM_BUFIO_CACHE(c)   (dm_bufio_caches[dm_bufio_cache_index(c)])
 
#define DM_BUFIO_CACHE_NAME(c)   (dm_bufio_cache_names[dm_bufio_cache_index(c)])
 
#define dm_bufio_in_request()   (!!current->bio_list)
 
#define dm_bufio_cond_resched()   do { } while (0)
 

Enumerations

enum  data_mode { DATA_MODE_SLAB = 0, DATA_MODE_GET_FREE_PAGES = 1, DATA_MODE_VMALLOC = 2, DATA_MODE_LIMIT = 3 }
 
enum  new_flag { NF_FRESH = 0, NF_READ = 1, NF_GET = 2, NF_PREFETCH = 3 }
 

Functions

voiddm_bufio_get (struct dm_bufio_client *c, sector_t block, struct dm_buffer **bp)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get)
 
voiddm_bufio_read (struct dm_bufio_client *c, sector_t block, struct dm_buffer **bp)
 
 EXPORT_SYMBOL_GPL (dm_bufio_read)
 
voiddm_bufio_new (struct dm_bufio_client *c, sector_t block, struct dm_buffer **bp)
 
 EXPORT_SYMBOL_GPL (dm_bufio_new)
 
void dm_bufio_prefetch (struct dm_bufio_client *c, sector_t block, unsigned n_blocks)
 
 EXPORT_SYMBOL_GPL (dm_bufio_prefetch)
 
void dm_bufio_release (struct dm_buffer *b)
 
 EXPORT_SYMBOL_GPL (dm_bufio_release)
 
void dm_bufio_mark_buffer_dirty (struct dm_buffer *b)
 
 EXPORT_SYMBOL_GPL (dm_bufio_mark_buffer_dirty)
 
void dm_bufio_write_dirty_buffers_async (struct dm_bufio_client *c)
 
 EXPORT_SYMBOL_GPL (dm_bufio_write_dirty_buffers_async)
 
int dm_bufio_write_dirty_buffers (struct dm_bufio_client *c)
 
 EXPORT_SYMBOL_GPL (dm_bufio_write_dirty_buffers)
 
int dm_bufio_issue_flush (struct dm_bufio_client *c)
 
 EXPORT_SYMBOL_GPL (dm_bufio_issue_flush)
 
void dm_bufio_release_move (struct dm_buffer *b, sector_t new_block)
 
 EXPORT_SYMBOL_GPL (dm_bufio_release_move)
 
unsigned dm_bufio_get_block_size (struct dm_bufio_client *c)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get_block_size)
 
sector_t dm_bufio_get_device_size (struct dm_bufio_client *c)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get_device_size)
 
sector_t dm_bufio_get_block_number (struct dm_buffer *b)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get_block_number)
 
voiddm_bufio_get_block_data (struct dm_buffer *b)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get_block_data)
 
voiddm_bufio_get_aux_data (struct dm_buffer *b)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get_aux_data)
 
struct dm_bufio_clientdm_bufio_get_client (struct dm_buffer *b)
 
 EXPORT_SYMBOL_GPL (dm_bufio_get_client)
 
struct dm_bufio_clientdm_bufio_client_create (struct block_device *bdev, unsigned block_size, unsigned reserved_buffers, unsigned aux_size, void(*alloc_callback)(struct dm_buffer *), void(*write_callback)(struct dm_buffer *))
 
 EXPORT_SYMBOL_GPL (dm_bufio_client_create)
 
void dm_bufio_client_destroy (struct dm_bufio_client *c)
 
 EXPORT_SYMBOL_GPL (dm_bufio_client_destroy)
 

Macro Definition Documentation

#define B_DIRTY   2

Definition at line 121 of file dm-bufio.c.

#define B_READING   0

Definition at line 119 of file dm-bufio.c.

#define B_WRITING   1

Definition at line 120 of file dm-bufio.c.

#define DM_BUFIO_BLOCK_SIZE_GFP_LIMIT   (PAGE_SIZE << (MAX_ORDER - 1))

Definition at line 63 of file dm-bufio.c.

#define DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT   (PAGE_SIZE >> 1)

Definition at line 62 of file dm-bufio.c.

#define DM_BUFIO_CACHE (   c)    (dm_bufio_caches[dm_bufio_cache_index(c)])

Definition at line 166 of file dm-bufio.c.

#define DM_BUFIO_CACHE_NAME (   c)    (dm_bufio_cache_names[dm_bufio_cache_index(c)])

Definition at line 167 of file dm-bufio.c.

#define dm_bufio_cond_resched ( )    do { } while (0)

Definition at line 196 of file dm-bufio.c.

#define DM_BUFIO_DEFAULT_AGE_SECS   60

Definition at line 42 of file dm-bufio.c.

#define DM_BUFIO_HASH (   block)
Value:
((((block) >> DM_BUFIO_HASH_BITS) ^ (block)) & \
((1 << DM_BUFIO_HASH_BITS) - 1))

Definition at line 54 of file dm-bufio.c.

#define DM_BUFIO_HASH_BITS   20

Definition at line 53 of file dm-bufio.c.

#define dm_bufio_in_request ( )    (!!current->bio_list)

Definition at line 169 of file dm-bufio.c.

#define DM_BUFIO_INLINE_VECS   16

Definition at line 48 of file dm-bufio.c.

#define DM_BUFIO_MEMORY_PERCENT   2

Definition at line 30 of file dm-bufio.c.

#define DM_BUFIO_MIN_BUFFERS   8

Definition at line 28 of file dm-bufio.c.

#define DM_BUFIO_VMALLOC_PERCENT   25

Definition at line 31 of file dm-bufio.c.

#define DM_BUFIO_WORK_TIMER_SECS   10

Definition at line 37 of file dm-bufio.c.

#define DM_BUFIO_WRITEBACK_PERCENT   75

Definition at line 32 of file dm-bufio.c.

#define DM_MSG_PREFIX   "bufio"

Definition at line 18 of file dm-bufio.c.

#define LIST_CLEAN   0

Definition at line 68 of file dm-bufio.c.

#define LIST_DIRTY   1

Definition at line 69 of file dm-bufio.c.

#define LIST_SIZE   2

Definition at line 70 of file dm-bufio.c.

Enumeration Type Documentation

enum data_mode
Enumerator:
DATA_MODE_SLAB 
DATA_MODE_GET_FREE_PAGES 
DATA_MODE_VMALLOC 
DATA_MODE_LIMIT 

Definition at line 128 of file dm-bufio.c.

enum new_flag
Enumerator:
NF_FRESH 
NF_READ 
NF_GET 
NF_PREFETCH 

Definition at line 697 of file dm-bufio.c.

Function Documentation

struct dm_bufio_client* dm_bufio_client_create ( struct block_device bdev,
unsigned  block_size,
unsigned  reserved_buffers,
unsigned  aux_size,
void(*)(struct dm_buffer *)  alloc_callback,
void(*)(struct dm_buffer *)  write_callback 
)
read

Definition at line 1423 of file dm-bufio.c.

void dm_bufio_client_destroy ( struct dm_bufio_client c)

Definition at line 1548 of file dm-bufio.c.

void* dm_bufio_get ( struct dm_bufio_client c,
sector_t  block,
struct dm_buffer **  bp 
)

Definition at line 999 of file dm-bufio.c.

void* dm_bufio_get_aux_data ( struct dm_buffer b)

Definition at line 1312 of file dm-bufio.c.

void* dm_bufio_get_block_data ( struct dm_buffer b)

Definition at line 1306 of file dm-bufio.c.

sector_t dm_bufio_get_block_number ( struct dm_buffer b)

Definition at line 1300 of file dm-bufio.c.

unsigned dm_bufio_get_block_size ( struct dm_bufio_client c)

Definition at line 1287 of file dm-bufio.c.

struct dm_bufio_client* dm_bufio_get_client ( struct dm_buffer b)
read

Definition at line 1318 of file dm-bufio.c.

sector_t dm_bufio_get_device_size ( struct dm_bufio_client c)

Definition at line 1293 of file dm-bufio.c.

int dm_bufio_issue_flush ( struct dm_bufio_client c)

Definition at line 1193 of file dm-bufio.c.

void dm_bufio_mark_buffer_dirty ( struct dm_buffer b)

Definition at line 1089 of file dm-bufio.c.

void* dm_bufio_new ( struct dm_bufio_client c,
sector_t  block,
struct dm_buffer **  bp 
)

Definition at line 1015 of file dm-bufio.c.

void dm_bufio_prefetch ( struct dm_bufio_client c,
sector_t  block,
unsigned  n_blocks 
)

Definition at line 1024 of file dm-bufio.c.

void* dm_bufio_read ( struct dm_bufio_client c,
sector_t  block,
struct dm_buffer **  bp 
)

Definition at line 1006 of file dm-bufio.c.

void dm_bufio_release ( struct dm_buffer b)

Definition at line 1059 of file dm-bufio.c.

void dm_bufio_release_move ( struct dm_buffer b,
sector_t  new_block 
)

Definition at line 1225 of file dm-bufio.c.

int dm_bufio_write_dirty_buffers ( struct dm_bufio_client c)

Definition at line 1121 of file dm-bufio.c.

void dm_bufio_write_dirty_buffers_async ( struct dm_bufio_client c)

Definition at line 1104 of file dm-bufio.c.

EXPORT_SYMBOL_GPL ( dm_bufio_get  )
EXPORT_SYMBOL_GPL ( dm_bufio_read  )
EXPORT_SYMBOL_GPL ( dm_bufio_new  )
EXPORT_SYMBOL_GPL ( dm_bufio_prefetch  )
EXPORT_SYMBOL_GPL ( dm_bufio_release  )
EXPORT_SYMBOL_GPL ( dm_bufio_mark_buffer_dirty  )
EXPORT_SYMBOL_GPL ( dm_bufio_write_dirty_buffers_async  )
EXPORT_SYMBOL_GPL ( dm_bufio_write_dirty_buffers  )
EXPORT_SYMBOL_GPL ( dm_bufio_issue_flush  )
EXPORT_SYMBOL_GPL ( dm_bufio_release_move  )
EXPORT_SYMBOL_GPL ( dm_bufio_get_block_size  )
EXPORT_SYMBOL_GPL ( dm_bufio_get_device_size  )
EXPORT_SYMBOL_GPL ( dm_bufio_get_block_number  )
EXPORT_SYMBOL_GPL ( dm_bufio_get_block_data  )
EXPORT_SYMBOL_GPL ( dm_bufio_get_aux_data  )
EXPORT_SYMBOL_GPL ( dm_bufio_get_client  )
EXPORT_SYMBOL_GPL ( dm_bufio_client_create  )
EXPORT_SYMBOL_GPL ( dm_bufio_client_destroy  )