Linux Kernel
3.7.1
|
#include <linux/module.h>
#include <linux/drbd.h>
#include <asm/uaccess.h>
#include <asm/types.h>
#include <net/sock.h>
#include <linux/ctype.h>
#include <linux/mutex.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/memcontrol.h>
#include <linux/mm_inline.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/reboot.h>
#include <linux/notifier.h>
#include <linux/kthread.h>
#include <linux/unistd.h>
#include <linux/vmalloc.h>
#include <linux/drbd_limits.h>
#include "drbd_int.h"
#include "drbd_req.h"
#include "drbd_vli.h"
#include <linux/moduleparam.h>
Go to the source code of this file.
Data Structures | |
struct | after_state_chg_work |
struct | meta_data_on_disk |
Macros | |
#define | __KERNEL_SYSCALLS__ |
Enumerations | |
enum | sanitize_state_warnings { NO_WARNING, ABORTED_ONLINE_VERIFY, ABORTED_RESYNC, CONNECTION_LOST_NEGOTIATING, IMPLICITLY_UPGRADED_DISK, IMPLICITLY_UPGRADED_PDSK } |
Variables | |
unsigned int | minor_count = DRBD_MINOR_COUNT_DEF |
bool | disable_sendpage |
bool | allow_oos |
unsigned int | cn_idx = CN_IDX_DRBD |
int | proc_details |
char | usermode_helper [80] = "/sbin/drbdadm" |
struct drbd_conf ** | minor_table |
struct kmem_cache * | drbd_request_cache |
struct kmem_cache * | drbd_ee_cache |
struct kmem_cache * | drbd_bm_ext_cache |
struct kmem_cache * | drbd_al_ext_cache |
mempool_t * | drbd_request_mempool |
mempool_t * | drbd_ee_mempool |
mempool_t * | drbd_md_io_page_pool |
struct bio_set * | drbd_md_io_bio_set |
struct page * | drbd_pp_pool |
spinlock_t | drbd_pp_lock |
int | drbd_pp_vacant |
wait_queue_head_t | drbd_pp_wait |
struct meta_data_on_disk | __packed |
#define __KERNEL_SYSCALLS__ |
Definition at line 49 of file drbd_main.c.
NO_WARNING | |
ABORTED_ONLINE_VERIFY | |
ABORTED_RESYNC | |
CONNECTION_LOST_NEGOTIATING | |
IMPLICITLY_UPGRADED_DISK | |
IMPLICITLY_UPGRADED_PDSK |
Definition at line 564 of file drbd_main.c.
enum drbd_state_rv __drbd_set_state | ( | struct drbd_conf * | mdev, |
union drbd_state | ns, | ||
enum chg_state_flags | flags, | ||
struct completion * | done | ||
) |
__drbd_set_state() - Set a new DRBD state : DRBD device. : new state. : Flags : Optional completion, that will get completed after the after_state_ch() finished
Caller needs to hold req_lock, and global_state_lock. Do not call directly.
Definition at line 1123 of file drbd_main.c.
enum drbd_state_rv _drbd_request_state | ( | struct drbd_conf * | mdev, |
union drbd_state | mask, | ||
union drbd_state | val, | ||
enum chg_state_flags | f | ||
) |
_drbd_request_state() - Request a state change (with flags) : DRBD device. : mask of state bits to change. : value of new state bits. : flags
Cousin of drbd_request_state(), useful with the CS_WAIT_COMPLETE flag, or when logging of failed state change requests is not desired.
Definition at line 705 of file drbd_main.c.
Definition at line 2468 of file drbd_main.c.
int _drbd_send_cmd | ( | struct drbd_conf * | mdev, |
struct socket * | sock, | ||
enum drbd_packets | cmd, | ||
struct p_header80 * | h, | ||
size_t | size, | ||
unsigned | msg_flags | ||
) |
Definition at line 1954 of file drbd_main.c.
Definition at line 2120 of file drbd_main.c.
void _drbd_thread_stop | ( | struct drbd_thread * | thi, |
int | restart, | ||
int | wait | ||
) |
Definition at line 1866 of file drbd_main.c.
Definition at line 4022 of file drbd_main.c.
void _tl_add_barrier | ( | struct drbd_conf * | mdev, |
struct drbd_tl_epoch * | new | ||
) |
_tl_add_barrier() - Adds a barrier to the transfer log : DRBD device. : Barrier to be added before the current head of the TL.
The caller must hold the req_lock.
Definition at line 248 of file drbd_main.c.
Definition at line 165 of file drbd_main.c.
DEFINE_RATELIMIT_STATE | ( | drbd_ratelimit_state | , |
5 * | HZ, | ||
5 | |||
) |
int drbd_asender | ( | struct drbd_thread * | ) |
Definition at line 4595 of file drbd_receiver.c.
int drbd_bitmap_io | ( | struct drbd_conf * | mdev, |
int(*)(struct drbd_conf *) | io_fn, | ||
char * | why, | ||
enum bm_flag | flags | ||
) |
drbd_bitmap_io() - Does an IO operation on the whole bitmap : DRBD device. : IO callback to be called when bitmap IO is possible : Descriptive text of the reason for doing the IO
freezes application IO while that the actual IO operations runs. This functions MAY NOT be called from worker context.
Definition at line 4250 of file drbd_main.c.
int drbd_bitmap_io_from_worker | ( | struct drbd_conf * | mdev, |
int(*)(struct drbd_conf *) | io_fn, | ||
char * | why, | ||
enum bm_flag | flags | ||
) |
Definition at line 1389 of file drbd_main.c.
drbd_bmio_clear_n_write() - io_fn for drbd_queue_bitmap_io() or drbd_bitmap_io() : DRBD device.
Clears all bits in the bitmap and writes the whole bitmap to stable storage.
Definition at line 4124 of file drbd_main.c.
drbd_bmio_set_n_write() - io_fn for drbd_queue_bitmap_io() or drbd_bitmap_io() : DRBD device.
Sets all bits in the bitmap and writes the whole bitmap to stable storage.
Definition at line 4096 of file drbd_main.c.
Definition at line 4378 of file drbd_main.c.
enum drbd_state_rv drbd_change_state | ( | struct drbd_conf * | mdev, |
enum chg_state_flags | f, | ||
union drbd_state | mask, | ||
union drbd_state | val | ||
) |
Definition at line 531 of file drbd_main.c.
void drbd_force_state | ( | struct drbd_conf * | mdev, |
union drbd_state | mask, | ||
union drbd_state | val | ||
) |
drbd_force_state() - Impose a change which happens outside our control on our state : DRBD device. : mask of state bits to change. : value of new state bits.
Definition at line 554 of file drbd_main.c.
void drbd_free_bc | ( | struct drbd_backing_dev * | ldev | ) |
Definition at line 3774 of file drbd_main.c.
Definition at line 3678 of file drbd_main.c.
Definition at line 3804 of file drbd_main.c.
Definition at line 3785 of file drbd_main.c.
Definition at line 2172 of file drbd_main.c.
Definition at line 4194 of file drbd_main.c.
Definition at line 3694 of file drbd_main.c.
Definition at line 3129 of file drbd_main.c.
Definition at line 4166 of file drbd_main.c.
Definition at line 4278 of file drbd_main.c.
drbd_md_mark_dirty() - Mark meta data super block as dirty : DRBD device.
Call this function if you change anything that should be written to the meta-data super block. This function sets MD_DIRTY, and starts a timer that ensures that within five seconds you have to call drbd_md_sync().
Definition at line 4007 of file drbd_main.c.
int drbd_md_read | ( | struct drbd_conf * | mdev, |
struct drbd_backing_dev * | bdev | ||
) |
drbd_md_read() - Reads in the meta data super block : DRBD device. : Device from which the meta data should be read in.
Return 0 (NO_ERROR) on success, and an enum drbd_ret_code in case something goes wrong. Currently only: ERR_IO_MD_DISK, ERR_MD_INVALID.
Definition at line 3911 of file drbd_main.c.
Definition at line 4270 of file drbd_main.c.
drbd_md_sync() - Writes the meta data super block if the MD_DIRTY flag bit is set : DRBD device.
Definition at line 3848 of file drbd_main.c.
int drbd_md_test_flag | ( | struct drbd_backing_dev * | bdev, |
int | flag | ||
) |
Definition at line 4285 of file drbd_main.c.
Definition at line 3216 of file drbd_main.c.
Definition at line 3579 of file drbd_main.c.
Definition at line 2154 of file drbd_main.c.
void drbd_queue_bitmap_io | ( | struct drbd_conf * | mdev, |
int(*)(struct drbd_conf *) | io_fn, | ||
void(*)(struct drbd_conf *, int) | done, | ||
char * | why, | ||
enum bm_flag | flags | ||
) |
drbd_queue_bitmap_io() - Queues an IO operation on the whole bitmap : DRBD device. : IO callback to be called when bitmap IO is possible : callback to be called after the bitmap IO was performed : Descriptive text of the reason for doing the IO
While IO on the bitmap happens we freeze application IO thus we ensure that drbd_set_out_of_sync() can not be called. This function MAY ONLY be called from worker context. It MUST NOT be used while a previous such work is still pending!
Definition at line 4213 of file drbd_main.c.
int drbd_send | ( | struct drbd_conf * | mdev, |
struct socket * | sock, | ||
void * | buf, | ||
size_t | size, | ||
unsigned | msg_flags | ||
) |
Definition at line 2990 of file drbd_main.c.
int drbd_send_ack | ( | struct drbd_conf * | mdev, |
enum drbd_packets | cmd, | ||
struct drbd_epoch_entry * | e | ||
) |
drbd_send_ack() - Sends an ack packet : DRBD device. : Packet command code. : Epoch entry.
Definition at line 2592 of file drbd_main.c.
int drbd_send_ack_dp | ( | struct drbd_conf * | mdev, |
enum drbd_packets | cmd, | ||
struct p_data * | dp, | ||
int | data_size | ||
) |
Definition at line 2571 of file drbd_main.c.
int drbd_send_ack_ex | ( | struct drbd_conf * | mdev, |
enum drbd_packets | cmd, | ||
sector_t | sector, | ||
int | blksize, | ||
u64 | block_id | ||
) |
Definition at line 2603 of file drbd_main.c.
int drbd_send_ack_rp | ( | struct drbd_conf * | mdev, |
enum drbd_packets | cmd, | ||
struct p_block_req * | rp | ||
) |
Definition at line 2580 of file drbd_main.c.
Definition at line 2525 of file drbd_main.c.
Definition at line 2514 of file drbd_main.c.
int drbd_send_block | ( | struct drbd_conf * | mdev, |
enum drbd_packets | cmd, | ||
struct drbd_epoch_entry * | e | ||
) |
Definition at line 2916 of file drbd_main.c.
int drbd_send_cmd | ( | struct drbd_conf * | mdev, |
int | use_data_socket, | ||
enum drbd_packets | cmd, | ||
struct p_header80 * | h, | ||
size_t | size | ||
) |
Definition at line 1979 of file drbd_main.c.
Definition at line 2005 of file drbd_main.c.
drbd_send_current_state() - Sends the drbd state to the peer : DRBD device.
Definition at line 2236 of file drbd_main.c.
int drbd_send_dblock | ( | struct drbd_conf * | mdev, |
struct drbd_request * | req | ||
) |
Definition at line 2829 of file drbd_main.c.
int drbd_send_drequest | ( | struct drbd_conf * | mdev, |
int | cmd, | ||
sector_t | sector, | ||
int | size, | ||
u64 | block_id | ||
) |
Definition at line 2612 of file drbd_main.c.
int drbd_send_drequest_csum | ( | struct drbd_conf * | mdev, |
sector_t | sector, | ||
int | size, | ||
void * | digest, | ||
int | digest_size, | ||
enum drbd_packets | cmd | ||
) |
Definition at line 2627 of file drbd_main.c.
int drbd_send_oos | ( | struct drbd_conf * | mdev, |
struct drbd_request * | req | ||
) |
Definition at line 2964 of file drbd_main.c.
Definition at line 2653 of file drbd_main.c.
Definition at line 2075 of file drbd_main.c.
Definition at line 2193 of file drbd_main.c.
int drbd_send_sr_reply | ( | struct drbd_conf * | mdev, |
enum drbd_state_rv | retcode | ||
) |
Definition at line 2305 of file drbd_main.c.
int drbd_send_state | ( | struct drbd_conf * | mdev, |
union drbd_state | state | ||
) |
drbd_send_state() - After a state change, sends the new state to the peer : DRBD device. : the state to send, not necessarily the current state.
Each state change queues an "after_state_ch" work, which will eventually send the resulting new state to the peer. If more state changes happen between queuing and processing of the after_state_ch work, we still want to send each intermediary state in the order it occurred.
Definition at line 2272 of file drbd_main.c.
int drbd_send_state_req | ( | struct drbd_conf * | mdev, |
union drbd_state | mask, | ||
union drbd_state | val | ||
) |
Definition at line 2293 of file drbd_main.c.
Definition at line 2028 of file drbd_main.c.
Definition at line 2144 of file drbd_main.c.
Definition at line 2149 of file drbd_main.c.
int drbd_thread_start | ( | struct drbd_thread * | thi | ) |
Definition at line 1801 of file drbd_main.c.
drbd_uuid_new_current() - Creates a new current UUID : DRBD device.
Creates a new current UUID, and rotates the old current UUID into the bitmap slot. Causes an incremental resync upon next connect.
Definition at line 4054 of file drbd_main.c.
Definition at line 4038 of file drbd_main.c.
Definition at line 4071 of file drbd_main.c.
int drbd_worker | ( | struct drbd_thread * | ) |
Definition at line 1627 of file drbd_worker.c.
int drbdd_init | ( | struct drbd_thread * | ) |
Definition at line 4224 of file drbd_receiver.c.
int fill_bitmap_rle_bits | ( | struct drbd_conf * | mdev, |
struct p_compressed_bm * | p, | ||
struct bm_xfer_ctx * | c | ||
) |
Definition at line 2315 of file drbd_main.c.
MODULE_ALIAS_BLOCKDEV_MAJOR | ( | DRBD_MAJOR | ) |
MODULE_AUTHOR | ( | "Philipp Reisner <[email protected]> | , |
""Lars Ellenberg< lars @linbit.com >" | |||
) |
MODULE_LICENSE | ( | "GPL" | ) |
module_param | ( | minor_count | , |
uint | , | ||
0444 | |||
) |
module_param | ( | disable_sendpage | , |
bool | , | ||
0644 | |||
) |
module_param | ( | proc_details | , |
int | , | ||
0644 | |||
) |
module_param_string | ( | usermode_helper | , |
usermode_helper | , | ||
sizeof(usermode_helper) | , | ||
0644 | |||
) |
MODULE_PARM_DESC | ( | minor_count | , |
"Maximum number of drbd devices ("__stringify(DRBD_MINOR_COUNT_MIN)"-"__stringify(DRBD_MINOR_COUNT_MAX)")" | |||
) |
MODULE_PARM_DESC | ( | allow_oos | , |
"DONT USE!" | |||
) |
MODULE_VERSION | ( | REL_VERSION | ) |
void print_st_err | ( | struct drbd_conf * | mdev, |
union drbd_state | os, | ||
union drbd_state | ns, | ||
enum drbd_state_rv | err | ||
) |
Definition at line 732 of file drbd_main.c.
tl_abort_disk_io() - Abort disk I/O for all requests for a certain mdev in the TL : DRBD device.
Definition at line 484 of file drbd_main.c.
tl_clear() - Clears all requests and &struct drbd_tl_epoch objects out of the TL : DRBD device.
This is called after the connection to the peer was lost. The storage covered by the requests on the transfer gets marked as our of sync. Called from the receiver thread and the worker thread.
Definition at line 441 of file drbd_main.c.
tl_release() - Free or recycle the oldest &struct drbd_tl_epoch object of the TL : DRBD device. : Expected identifier of the DRBD write barrier packet. : Expected number of requests before that barrier.
In case the passed barrier_nr or set_size does not match the oldest &struct drbd_tl_epoch objects this function will cause a termination of the connection.
Definition at line 276 of file drbd_main.c.
void tl_restart | ( | struct drbd_conf * | mdev, |
enum drbd_req_event | what | ||
) |
Definition at line 473 of file drbd_main.c.
bool allow_oos |
Definition at line 122 of file drbd_main.c.
unsigned int cn_idx = CN_IDX_DRBD |
Definition at line 123 of file drbd_main.c.
bool disable_sendpage |
Definition at line 121 of file drbd_main.c.
struct kmem_cache* drbd_al_ext_cache |
Definition at line 140 of file drbd_main.c.
struct kmem_cache* drbd_bm_ext_cache |
Definition at line 139 of file drbd_main.c.
struct kmem_cache* drbd_ee_cache |
Definition at line 138 of file drbd_main.c.
mempool_t* drbd_ee_mempool |
Definition at line 142 of file drbd_main.c.
struct bio_set* drbd_md_io_bio_set |
Definition at line 144 of file drbd_main.c.
mempool_t* drbd_md_io_page_pool |
Definition at line 143 of file drbd_main.c.
spinlock_t drbd_pp_lock |
Definition at line 153 of file drbd_main.c.
Definition at line 152 of file drbd_main.c.
int drbd_pp_vacant |
Definition at line 154 of file drbd_main.c.
wait_queue_head_t drbd_pp_wait |
Definition at line 155 of file drbd_main.c.
struct kmem_cache* drbd_request_cache |
Definition at line 137 of file drbd_main.c.
mempool_t* drbd_request_mempool |
Definition at line 141 of file drbd_main.c.
unsigned int minor_count = DRBD_MINOR_COUNT_DEF |
Definition at line 120 of file drbd_main.c.
Definition at line 135 of file drbd_main.c.
int proc_details |
Definition at line 124 of file drbd_main.c.
char usermode_helper[80] = "/sbin/drbdadm" |
Definition at line 128 of file drbd_main.c.