Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
drbd_int.h File Reference
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/crypto.h>
#include <linux/ratelimit.h>
#include <linux/tcp.h>
#include <linux/mutex.h>
#include <linux/major.h>
#include <linux/blkdev.h>
#include <linux/genhd.h>
#include <net/tcp.h>
#include <linux/lru_cache.h>
#include <linux/prefetch.h>
#include <linux/drbd_nl.h>

Go to the source code of this file.

Data Structures

struct  bm_xfer_ctx
 
struct  p_header80
 
struct  p_header95
 
union  p_header
 
struct  p_data
 
struct  p_block_ack
 
struct  p_block_req
 
struct  p_handshake
 
struct  p_barrier
 
struct  p_barrier_ack
 
struct  p_rs_param
 
struct  p_rs_param_89
 
struct  p_rs_param_95
 
struct  p_protocol
 
struct  p_uuids
 
struct  p_rs_uuid
 
struct  p_sizes
 
struct  p_state
 
struct  p_req_state
 
struct  p_req_state_reply
 
struct  p_drbd06_param
 
struct  p_discard
 
struct  p_block_desc
 
struct  p_compressed_bm
 
struct  p_delay_probe93
 
union  p_polymorph
 
struct  drbd_thread
 
struct  drbd_work
 
struct  drbd_request
 
struct  drbd_tl_epoch
 
struct  drbd_epoch
 
struct  drbd_wq_barrier
 
struct  digest_info
 
struct  drbd_epoch_entry
 
struct  drbd_work_queue
 
struct  drbd_socket
 
struct  drbd_md
 
struct  drbd_backing_dev
 
struct  drbd_md_io
 
struct  bm_io_work
 
struct  fifo_buffer
 
struct  drbd_conf
 
struct  bm_extent
 

Macros

#define __protected_by(x)
 
#define __protected_read_by(x)
 
#define __protected_write_by(x)
 
#define __must_hold(x)
 
#define __no_warn(lock, stmt)   do { __acquire(lock); stmt; __release(lock); } while (0)
 
#define DRBD_SIG   SIGXCPU
 
#define DRBD_SIGKILL   SIGHUP
 
#define ID_IN_SYNC   (4711ULL)
 
#define ID_OUT_OF_SYNC   (4712ULL)
 
#define ID_SYNCER   (-1ULL)
 
#define ID_VACANT   0
 
#define is_syncer_block_id(id)   ((id) == ID_SYNCER)
 
#define UUID_NEW_BM_OFFSET   ((u64)0x0001000000000000ULL)
 
#define DEV   (disk_to_dev(mdev->vdisk))
 
#define D_ASSERT(exp)
 
#define ERR_IF(exp)
 
#define div_ceil(A, B)   ((A)/(B) + ((A)%(B) ? 1 : 0))
 
#define div_floor(A, B)   ((A)/(B))
 
#define DRBD_MD_MAGIC   (DRBD_MAGIC+4)
 
#define DP_HARDBARRIER   1 /* depricated */
 
#define DP_RW_SYNC   2 /* equals REQ_SYNC */
 
#define DP_MAY_SET_IN_SYNC   4
 
#define DP_UNPLUG   8 /* not used anymore */
 
#define DP_FUA   16 /* equals REQ_FUA */
 
#define DP_FLUSH   32 /* equals REQ_FLUSH */
 
#define DP_DISCARD   64 /* equals REQ_DISCARD */
 
#define BM_PACKET_PAYLOAD_BYTES   (4096 - sizeof(struct p_header80))
 
#define BM_PACKET_WORDS   (BM_PACKET_PAYLOAD_BYTES/sizeof(long))
 
#define BM_PACKET_VLI_BYTES_MAX   (4096 - sizeof(struct p_compressed_bm))
 
#define EE_CALL_AL_COMPLETE_IO   (1<<__EE_CALL_AL_COMPLETE_IO)
 
#define EE_MAY_SET_IN_SYNC   (1<<__EE_MAY_SET_IN_SYNC)
 
#define EE_RESUBMITTED   (1<<__EE_RESUBMITTED)
 
#define EE_WAS_ERROR   (1<<__EE_WAS_ERROR)
 
#define EE_HAS_DIGEST   (1<<__EE_HAS_DIGEST)
 
#define NL_PACKET(name, number, fields)   struct name { fields };
 
#define NL_INTEGER(pn, pr, member)   int member;
 
#define NL_INT64(pn, pr, member)   __u64 member;
 
#define NL_BIT(pn, pr, member)   unsigned member:1;
 
#define NL_STRING(pn, pr, member, len)   unsigned char member[len]; int member ## _len;
 
#define DRBD_SYNC_MARKS   8
 
#define DRBD_SYNC_MARK_STEP   (3*HZ)
 
#define drbd_thread_current_set_cpu(A)   ({})
 
#define drbd_calc_cpu_mask(A)   ({})
 
#define USE_DATA_SOCKET   1
 
#define USE_META_SOCKET   0
 
#define MD_RESERVED_SECT   (128LU << 11) /* 128 MB, unit sectors */
 
#define MD_AL_OFFSET   8 /* 8 Sectors after start of meta area */
 
#define MD_AL_MAX_SIZE   64 /* = 32 kb LOG ~ 3776 extents ~ 14 GB Storage */
 
#define MD_BM_OFFSET   (MD_AL_OFFSET + MD_AL_MAX_SIZE)
 
#define MD_SECTOR_SHIFT   9
 
#define MD_SECTOR_SIZE   (1<<MD_SECTOR_SHIFT)
 
#define AL_EXTENTS_PT   ((MD_SECTOR_SIZE-12)/8-1) /* 61 ; Extents per 512B sector */
 
#define AL_EXTENT_SHIFT   22 /* One extent represents 4M Storage */
 
#define AL_EXTENT_SIZE   (1<<AL_EXTENT_SHIFT)
 
#define BME_NO_WRITES   0 /* bm_extent.flags: no more requests on this one! */
 
#define BME_LOCKED   1 /* bm_extent.flags: syncer active on this one. */
 
#define BME_PRIORITY   2 /* finish resync IO on this extent ASAP! App IO waiting! */
 
#define SLEEP_TIME   (HZ/10)
 
#define BM_BLOCK_SHIFT   12 /* 4k per bit */
 
#define BM_BLOCK_SIZE   (1<<BM_BLOCK_SHIFT)
 
#define BM_EXT_SHIFT   (BM_BLOCK_SHIFT + MD_SECTOR_SHIFT + 3) /* = 24 */
 
#define BM_EXT_SIZE   (1<<BM_EXT_SHIFT)
 
#define BM_SECT_TO_BIT(x)   ((x)>>(BM_BLOCK_SHIFT-9))
 
#define BM_BIT_TO_SECT(x)   ((sector_t)(x)<<(BM_BLOCK_SHIFT-9))
 
#define BM_SECT_PER_BIT   BM_BIT_TO_SECT(1)
 
#define Bit2KB(bits)   ((bits)<<(BM_BLOCK_SHIFT-10))
 
#define BM_SECT_TO_EXT(x)   ((x)>>(BM_EXT_SHIFT-9))
 
#define BM_EXT_TO_SECT(x)   ((sector_t)(x) << (BM_EXT_SHIFT-9))
 
#define BM_SECT_PER_EXT   BM_EXT_TO_SECT(1)
 
#define AL_EXT_PER_BM_SECT   (1 << (BM_EXT_SHIFT - AL_EXTENT_SHIFT))
 
#define BM_WORDS_PER_AL_EXT   (1 << (AL_EXTENT_SHIFT-BM_BLOCK_SHIFT-LN2_BPL))
 
#define BM_BLOCKS_PER_BM_EXT_B   (BM_EXT_SHIFT - BM_BLOCK_SHIFT)
 
#define BM_BLOCKS_PER_BM_EXT_MASK   ((1<<BM_BLOCKS_PER_BM_EXT_B) - 1)
 
#define DRBD_MAX_SECTORS_32   (0xffffffffLU)
 
#define DRBD_MAX_SECTORS_BM   ((MD_RESERVED_SECT - MD_BM_OFFSET) * (1LL<<(BM_EXT_SHIFT-9)))
 
#define DRBD_MAX_SECTORS   DRBD_MAX_SECTORS_BM
 
#define DRBD_MAX_SECTORS_FLEX   (1UL << 51)
 
#define HT_SHIFT   8
 
#define DRBD_MAX_BIO_SIZE   (1U<<(9+HT_SHIFT))
 
#define DRBD_MAX_BIO_SIZE_SAFE   (1U << 12) /* Works always = 4k */
 
#define DRBD_MAX_SIZE_H80_PACKET   (1U << 15) /* The old header only allows packets up to 32Kib data */
 
#define APP_R_HSIZE   15
 
#define DRBD_END_OF_BITMAP   (~(unsigned long)0)
 
#define DRBD_MIN_POOL_PAGES   128
 
#define drbd_free_ee(m, e)   drbd_free_some_ee(m, e, 0)
 
#define drbd_free_net_ee(m, e)   drbd_free_some_ee(m, e, 1)
 
#define drbd_set_in_sync(mdev, sector, size)   __drbd_set_in_sync(mdev, sector, size, __FILE__, __LINE__)
 
#define drbd_set_out_of_sync(mdev, sector, size)   __drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__)
 
#define role_MASK   R_MASK
 
#define peer_MASK   R_MASK
 
#define disk_MASK   D_MASK
 
#define pdsk_MASK   D_MASK
 
#define conn_MASK   C_MASK
 
#define susp_MASK   1
 
#define user_isp_MASK   1
 
#define aftr_isp_MASK   1
 
#define susp_nod_MASK   1
 
#define susp_fen_MASK   1
 
#define NS(T, S)
 
#define NS2(T1, S1, T2, S2)
 
#define NS3(T1, S1, T2, S2, T3, S3)
 
#define _NS(D, T, S)   D, ({ union drbd_state __ns; __ns.i = D->state.i; __ns.T = (S); __ns; })
 
#define _NS2(D, T1, S1, T2, S2)
 
#define _NS3(D, T1, S1, T2, S2, T3, S3)
 
#define page_chain_for_each(page)
 
#define page_chain_for_each_safe(page, n)   for (; page && ({ n = page_chain_next(page); 1; }); page = n)
 
#define __drbd_chk_io_error(m, f)   __drbd_chk_io_error_(m,f, __func__)
 
#define drbd_chk_io_error(m, e, f)   drbd_chk_io_error_(m,e,f, __func__)
 
#define ERR_IF_CNT_IS_NEGATIVE(which)
 
#define dec_ap_pending(mdev)
 
#define dec_rs_pending(mdev)
 
#define dec_unacked(mdev)
 
#define sub_unacked(mdev, n)
 
#define get_ldev(M)   __cond_lock(local, _get_ldev_if_state(M,D_INCONSISTENT))
 
#define get_ldev_if_state(M, MINS)   __cond_lock(local, _get_ldev_if_state(M,MINS))
 
#define seq_lt(a, b)   (seq_cmp((a), (b)) < 0)
 
#define seq_gt(a, b)   (seq_cmp((a), (b)) > 0)
 
#define seq_ge(a, b)   (seq_cmp((a), (b)) >= 0)
 
#define seq_le(a, b)   (seq_cmp((a), (b)) <= 0)
 
#define seq_max(a, b)   ((u32)(seq_gt((a), (b)) ? (a) : (b)))
 
#define QUEUE_ORDERED_NONE   0
 
: the volume name

struct ubi_vtbl_record - a record in the volume table. : how many physical eraseblocks are reserved for this volume : volume alignment : how many bytes are unused at the end of the each physical eraseblock to satisfy the requested alignment : volume type (UBI_DYNAMIC_VOLUME or UBI_STATIC_VOLUME) : if volume update was started but not finished : volume name length

: volume flags (UBI_VTBL_AUTORESIZE_FLG) : reserved, zeroes : a CRC32 checksum of the record

The volume table records are stored in the volume table, which is stored in the layout volume. The layout volume consists of 2 logical eraseblock, each of which contains a copy of the volume table (i.e., the volume table is duplicated). The volume table is an array of &struct ubi_vtbl_record objects indexed by the volume ID.

If the size of the logical eraseblock is large enough to fit UBI_MAX_VOLUMES records, the volume table contains UBI_MAX_VOLUMES records. Otherwise, it contains as many records as it can fit (i.e., size of logical eraseblock divided by sizeof(struct ubi_vtbl_record)).

The flag is used to implement volume update. It is set to %1 before update and set to %0 after the update. So if the update operation was interrupted, UBI knows that the volume is corrupted.

The field is specified when the volume is created and cannot be later changed. It may be useful, for example, when a block-oriented file system works on top of UBI. The field is calculated using the logical eraseblock size and . The alignment must be multiple to the minimal flash I/O unit. If is 1, all the available space of the physical eraseblocks is used.

Empty records contain all zeroes and the CRC checksum of those zeroes.

#define __packed   __attribute__((packed))
 

Typedefs

typedef int(* drbd_work_cb )(struct drbd_conf *, struct drbd_work *, int cancel)
 

Enumerations

enum  {
  DRBD_FAULT_MD_WR = 0, DRBD_FAULT_MD_RD = 1, DRBD_FAULT_RS_WR = 2, DRBD_FAULT_RS_RD = 3,
  DRBD_FAULT_DT_WR = 4, DRBD_FAULT_DT_RD = 5, DRBD_FAULT_DT_RA = 6, DRBD_FAULT_BM_ALLOC = 7,
  DRBD_FAULT_AL_EE = 8, DRBD_FAULT_RECEIVE = 9, DRBD_FAULT_MAX
}
 
enum  drbd_packets {
  P_DATA = 0x00, P_DATA_REPLY = 0x01, P_RS_DATA_REPLY = 0x02, P_BARRIER = 0x03,
  P_BITMAP = 0x04, P_BECOME_SYNC_TARGET = 0x05, P_BECOME_SYNC_SOURCE = 0x06, P_UNPLUG_REMOTE = 0x07,
  P_DATA_REQUEST = 0x08, P_RS_DATA_REQUEST = 0x09, P_SYNC_PARAM = 0x0a, P_PROTOCOL = 0x0b,
  P_UUIDS = 0x0c, P_SIZES = 0x0d, P_STATE = 0x0e, P_SYNC_UUID = 0x0f,
  P_AUTH_CHALLENGE = 0x10, P_AUTH_RESPONSE = 0x11, P_STATE_CHG_REQ = 0x12, P_PING = 0x13,
  P_PING_ACK = 0x14, P_RECV_ACK = 0x15, P_WRITE_ACK = 0x16, P_RS_WRITE_ACK = 0x17,
  P_DISCARD_ACK = 0x18, P_NEG_ACK = 0x19, P_NEG_DREPLY = 0x1a, P_NEG_RS_DREPLY = 0x1b,
  P_BARRIER_ACK = 0x1c, P_STATE_CHG_REPLY = 0x1d, P_OV_REQUEST = 0x1e, P_OV_REPLY = 0x1f,
  P_OV_RESULT = 0x20, P_CSUM_RS_REQUEST = 0x21, P_RS_IS_IN_SYNC = 0x22, P_SYNC_PARAM89 = 0x23,
  P_COMPRESSED_BITMAP = 0x24, P_DELAY_PROBE = 0x27, P_OUT_OF_SYNC = 0x28, P_RS_CANCEL = 0x29,
  P_MAX_CMD = 0x2A, P_MAY_IGNORE = 0x100, P_MAX_OPT_CMD = 0x101, P_HAND_SHAKE_M = 0xfff1,
  P_HAND_SHAKE_S = 0xfff2, P_HAND_SHAKE = 0xfffe
}
 
enum  drbd_conn_flags { CF_WANT_LOSE = 1, CF_DRY_RUN = 2 }
 
enum  drbd_bitmap_code { RLE_VLI_Bits = 2 }
 
enum  drbd_thread_state { None, Running, Exiting, Restarting }
 
enum  { DE_HAVE_BARRIER_NUMBER }
 
enum  epoch_event { EV_PUT, EV_GOT_BARRIER_NR, EV_BECAME_LAST, EV_CLEANUP = 32 }
 
enum  {
  __EE_CALL_AL_COMPLETE_IO, __EE_MAY_SET_IN_SYNC, __EE_RESUBMITTED, __EE_WAS_ERROR,
  __EE_HAS_DIGEST
}
 
enum  {
  CREATE_BARRIER, SIGNAL_ASENDER, SEND_PING, UNPLUG_REMOTE,
  MD_DIRTY, DISCARD_CONCURRENT, USE_DEGR_WFC_T, CLUSTER_ST_CHANGE,
  CL_ST_CHG_SUCCESS, CL_ST_CHG_FAIL, CRASHED_PRIMARY, CONSIDER_RESYNC,
  MD_NO_FUA, SUSPEND_IO, BITMAP_IO, BITMAP_IO_QUEUED,
  GO_DISKLESS, WAS_IO_ERROR, FORCE_DETACH, RESYNC_AFTER_NEG,
  NET_CONGESTED, CONFIG_PENDING, DEVICE_DYING, RESIZE_PENDING,
  CONN_DRY_RUN, GOT_PING_ACK, NEW_CUR_UUID, AL_SUSPENDED,
  AHEAD_TO_SYNC_SOURCE, STATE_SENT, CALLBACK_PENDING
}
 
enum  bm_flag {
  BM_P_VMALLOCED = 0x10000, BM_LOCKED_MASK = 0xf, BM_DONT_CLEAR = 0x1, BM_DONT_SET = 0x2,
  BM_DONT_TEST = 0x4, BM_IS_LOCKED = 0x8, BM_LOCKED_TEST_ALLOWED = BM_DONT_CLEAR | BM_DONT_SET | BM_IS_LOCKED, BM_LOCKED_SET_ALLOWED = BM_DONT_CLEAR | BM_IS_LOCKED,
  BM_LOCKED_CHANGE_ALLOWED = BM_IS_LOCKED
}
 
enum  write_ordering_e { WO_none, WO_drain_io, WO_bdev_flush }
 
enum  chg_state_flags {
  CS_HARD = 1, CS_VERBOSE = 2, CS_WAIT_COMPLETE = 4, CS_SERIALIZE = 8,
  CS_ORDERED = CS_WAIT_COMPLETE + CS_SERIALIZE
}
 
enum  dds_flags { DDSF_FORCED = 1, DDSF_NO_RESYNC = 2 }
 
enum  determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }
 
enum  drbd_force_detach_flags { DRBD_IO_ERROR, DRBD_META_IO_ERROR, DRBD_FORCE_DETACH }
 

Functions

unsigned int _drbd_insert_fault (struct drbd_conf *mdev, unsigned int type)
 
void INFO_bm_xfer_stats (struct drbd_conf *mdev, const char *direction, struct bm_xfer_ctx *c)
 
void drbd_init_set_defaults (struct drbd_conf *mdev)
 
enum drbd_state_rv drbd_change_state (struct drbd_conf *mdev, enum chg_state_flags f, union drbd_state mask, union drbd_state val)
 
void drbd_force_state (struct drbd_conf *, union drbd_state, union drbd_state)
 
enum drbd_state_rv _drbd_request_state (struct drbd_conf *, union drbd_state, union drbd_state, enum chg_state_flags)
 
enum drbd_state_rv __drbd_set_state (struct drbd_conf *, union drbd_state, enum chg_state_flags, struct completion *done)
 
void print_st_err (struct drbd_conf *, union drbd_state, union drbd_state, int)
 
int drbd_thread_start (struct drbd_thread *thi)
 
void _drbd_thread_stop (struct drbd_thread *thi, int restart, int wait)
 
void drbd_free_resources (struct drbd_conf *mdev)
 
void tl_release (struct drbd_conf *mdev, unsigned int barrier_nr, unsigned int set_size)
 
void tl_clear (struct drbd_conf *mdev)
 
void _tl_add_barrier (struct drbd_conf *, struct drbd_tl_epoch *)
 
void drbd_free_sock (struct drbd_conf *mdev)
 
int drbd_send (struct drbd_conf *mdev, struct socket *sock, void *buf, size_t size, unsigned msg_flags)
 
int drbd_send_protocol (struct drbd_conf *mdev)
 
int drbd_send_uuids (struct drbd_conf *mdev)
 
int drbd_send_uuids_skip_initial_sync (struct drbd_conf *mdev)
 
int drbd_gen_and_send_sync_uuid (struct drbd_conf *mdev)
 
int drbd_send_sizes (struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags)
 
int drbd_send_state (struct drbd_conf *mdev, union drbd_state s)
 
int drbd_send_current_state (struct drbd_conf *mdev)
 
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)
 
int drbd_send_cmd (struct drbd_conf *mdev, int use_data_socket, enum drbd_packets cmd, struct p_header80 *h, size_t size)
 
int drbd_send_cmd2 (struct drbd_conf *mdev, enum drbd_packets cmd, char *data, size_t size)
 
int drbd_send_sync_param (struct drbd_conf *mdev, struct syncer_conf *sc)
 
int drbd_send_b_ack (struct drbd_conf *mdev, u32 barrier_nr, u32 set_size)
 
int drbd_send_ack (struct drbd_conf *mdev, enum drbd_packets cmd, struct drbd_epoch_entry *e)
 
int drbd_send_ack_rp (struct drbd_conf *mdev, enum drbd_packets cmd, struct p_block_req *rp)
 
int drbd_send_ack_dp (struct drbd_conf *mdev, enum drbd_packets cmd, struct p_data *dp, int data_size)
 
int drbd_send_ack_ex (struct drbd_conf *mdev, enum drbd_packets cmd, sector_t sector, int blksize, u64 block_id)
 
int drbd_send_oos (struct drbd_conf *mdev, struct drbd_request *req)
 
int drbd_send_block (struct drbd_conf *mdev, enum drbd_packets cmd, struct drbd_epoch_entry *e)
 
int drbd_send_dblock (struct drbd_conf *mdev, struct drbd_request *req)
 
int drbd_send_drequest (struct drbd_conf *mdev, int cmd, sector_t sector, int size, u64 block_id)
 
int drbd_send_drequest_csum (struct drbd_conf *mdev, sector_t sector, int size, void *digest, int digest_size, enum drbd_packets cmd)
 
int drbd_send_ov_request (struct drbd_conf *mdev, sector_t sector, int size)
 
int drbd_send_bitmap (struct drbd_conf *mdev)
 
int _drbd_send_bitmap (struct drbd_conf *mdev)
 
int drbd_send_sr_reply (struct drbd_conf *mdev, enum drbd_state_rv retcode)
 
void drbd_free_bc (struct drbd_backing_dev *ldev)
 
void drbd_mdev_cleanup (struct drbd_conf *mdev)
 
void drbd_print_uuids (struct drbd_conf *mdev, const char *text)
 
void drbd_md_sync (struct drbd_conf *mdev)
 
int drbd_md_read (struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
 
void drbd_uuid_set (struct drbd_conf *mdev, int idx, u64 val) __must_hold(local)
 
void _drbd_uuid_set (struct drbd_conf *mdev, int idx, u64 val) __must_hold(local)
 
void drbd_uuid_new_current (struct drbd_conf *mdev) __must_hold(local)
 
void _drbd_uuid_new_current (struct drbd_conf *mdev) __must_hold(local)
 
void drbd_uuid_set_bm (struct drbd_conf *mdev, u64 val) __must_hold(local)
 
void drbd_md_set_flag (struct drbd_conf *mdev, int flags) __must_hold(local)
 
void drbd_md_clear_flag (struct drbd_conf *mdev, int flags) __must_hold(local)
 
int drbd_md_test_flag (struct drbd_backing_dev *, int)
 
void drbd_md_mark_dirty (struct drbd_conf *mdev)
 
void drbd_queue_bitmap_io (struct drbd_conf *mdev, int(*io_fn)(struct drbd_conf *), void(*done)(struct drbd_conf *, int), char *why, enum bm_flag flags)
 
int drbd_bitmap_io (struct drbd_conf *mdev, int(*io_fn)(struct drbd_conf *), char *why, enum bm_flag flags)
 
int drbd_bmio_set_n_write (struct drbd_conf *mdev)
 
int drbd_bmio_clear_n_write (struct drbd_conf *mdev)
 
void drbd_go_diskless (struct drbd_conf *mdev)
 
void drbd_ldev_destroy (struct drbd_conf *mdev)
 
int drbd_bm_init (struct drbd_conf *mdev)
 
int drbd_bm_resize (struct drbd_conf *mdev, sector_t sectors, int set_new_bits)
 
void drbd_bm_cleanup (struct drbd_conf *mdev)
 
void drbd_bm_set_all (struct drbd_conf *mdev)
 
void drbd_bm_clear_all (struct drbd_conf *mdev)
 
int drbd_bm_set_bits (struct drbd_conf *mdev, unsigned long s, unsigned long e)
 
int drbd_bm_clear_bits (struct drbd_conf *mdev, unsigned long s, unsigned long e)
 
int drbd_bm_count_bits (struct drbd_conf *mdev, const unsigned long s, const unsigned long e)
 
void _drbd_bm_set_bits (struct drbd_conf *mdev, const unsigned long s, const unsigned long e)
 
int drbd_bm_test_bit (struct drbd_conf *mdev, unsigned long bitnr)
 
int drbd_bm_e_weight (struct drbd_conf *mdev, unsigned long enr)
 
int drbd_bm_write_page (struct drbd_conf *mdev, unsigned int idx) __must_hold(local)
 
int drbd_bm_read (struct drbd_conf *mdev) __must_hold(local)
 
int drbd_bm_write (struct drbd_conf *mdev) __must_hold(local)
 
int drbd_bm_write_all (struct drbd_conf *mdev) __must_hold(local)
 
int drbd_bm_write_copy_pages (struct drbd_conf *mdev) __must_hold(local)
 
unsigned long drbd_bm_ALe_set_all (struct drbd_conf *mdev, unsigned long al_enr)
 
size_t drbd_bm_words (struct drbd_conf *mdev)
 
unsigned long drbd_bm_bits (struct drbd_conf *mdev)
 
sector_t drbd_bm_capacity (struct drbd_conf *mdev)
 
unsigned long drbd_bm_find_next (struct drbd_conf *mdev, unsigned long bm_fo)
 
unsigned long _drbd_bm_find_next (struct drbd_conf *mdev, unsigned long bm_fo)
 
unsigned long _drbd_bm_find_next_zero (struct drbd_conf *mdev, unsigned long bm_fo)
 
unsigned long _drbd_bm_total_weight (struct drbd_conf *mdev)
 
unsigned long drbd_bm_total_weight (struct drbd_conf *mdev)
 
int drbd_bm_rs_done (struct drbd_conf *mdev)
 
void drbd_bm_merge_lel (struct drbd_conf *mdev, size_t offset, size_t number, unsigned long *buffer)
 
void drbd_bm_get_lel (struct drbd_conf *mdev, size_t offset, size_t number, unsigned long *buffer)
 
void drbd_bm_lock (struct drbd_conf *mdev, char *why, enum bm_flag flags)
 
void drbd_bm_unlock (struct drbd_conf *mdev)
 
struct bio * bio_alloc_drbd (gfp_t gfp_mask)
 
struct drbd_confdrbd_new_device (unsigned int minor)
 
void drbd_free_mdev (struct drbd_conf *mdev)
 
void drbd_make_request (struct request_queue *q, struct bio *bio)
 
int drbd_read_remote (struct drbd_conf *mdev, struct drbd_request *req)
 
int drbd_merge_bvec (struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *bvec)
 
int is_valid_ar_handle (struct drbd_request *, sector_t)
 
void drbd_suspend_io (struct drbd_conf *mdev)
 
void drbd_resume_io (struct drbd_conf *mdev)
 
charppsize (char *buf, unsigned long long size)
 
sector_t drbd_new_dev_size (struct drbd_conf *, struct drbd_backing_dev *, int)
 
enum determine_dev_size drbd_determine_dev_size (struct drbd_conf *, enum dds_flags) __must_hold(local)
 
void resync_after_online_grow (struct drbd_conf *)
 
void drbd_reconsider_max_bio_size (struct drbd_conf *mdev)
 
enum drbd_state_rv drbd_set_role (struct drbd_conf *mdev, enum drbd_role new_role, int force)
 
enum drbd_disk_state drbd_try_outdate_peer (struct drbd_conf *mdev)
 
void drbd_try_outdate_peer_async (struct drbd_conf *mdev)
 
int drbd_khelper (struct drbd_conf *mdev, char *cmd)
 
int drbd_worker (struct drbd_thread *thi)
 
int drbd_alter_sa (struct drbd_conf *mdev, int na)
 
void drbd_start_resync (struct drbd_conf *mdev, enum drbd_conns side)
 
void resume_next_sg (struct drbd_conf *mdev)
 
void suspend_other_sg (struct drbd_conf *mdev)
 
int drbd_resync_finished (struct drbd_conf *mdev)
 
voiddrbd_md_get_buffer (struct drbd_conf *mdev)
 
void drbd_md_put_buffer (struct drbd_conf *mdev)
 
int drbd_md_sync_page_io (struct drbd_conf *mdev, struct drbd_backing_dev *bdev, sector_t sector, int rw)
 
void wait_until_done_or_disk_failure (struct drbd_conf *mdev, struct drbd_backing_dev *bdev, unsigned int *done)
 
void drbd_ov_oos_found (struct drbd_conf *, sector_t, int)
 
void drbd_rs_controller_reset (struct drbd_conf *mdev)
 
void drbd_csum_bio (struct drbd_conf *, struct crypto_hash *, struct bio *, void *)
 
void drbd_csum_ee (struct drbd_conf *, struct crypto_hash *, struct drbd_epoch_entry *, void *)
 
int w_req_cancel_conflict (struct drbd_conf *, struct drbd_work *, int)
 
int w_read_retry_remote (struct drbd_conf *, struct drbd_work *, int)
 
int w_e_end_data_req (struct drbd_conf *, struct drbd_work *, int)
 
int w_e_end_rsdata_req (struct drbd_conf *, struct drbd_work *, int)
 
int w_e_end_csum_rs_req (struct drbd_conf *, struct drbd_work *, int)
 
int w_e_end_ov_reply (struct drbd_conf *, struct drbd_work *, int)
 
int w_e_end_ov_req (struct drbd_conf *, struct drbd_work *, int)
 
int w_ov_finished (struct drbd_conf *, struct drbd_work *, int)
 
int w_resync_timer (struct drbd_conf *, struct drbd_work *, int)
 
int w_resume_next_sg (struct drbd_conf *, struct drbd_work *, int)
 
int w_send_write_hint (struct drbd_conf *, struct drbd_work *, int)
 
int w_send_dblock (struct drbd_conf *, struct drbd_work *, int)
 
int w_send_barrier (struct drbd_conf *, struct drbd_work *, int)
 
int w_send_read_req (struct drbd_conf *, struct drbd_work *, int)
 
int w_prev_work_done (struct drbd_conf *, struct drbd_work *, int)
 
int w_e_reissue (struct drbd_conf *, struct drbd_work *, int)
 
int w_restart_disk_io (struct drbd_conf *, struct drbd_work *, int)
 
int w_send_oos (struct drbd_conf *, struct drbd_work *, int)
 
int w_start_resync (struct drbd_conf *, struct drbd_work *, int)
 
void resync_timer_fn (unsigned long data)
 
void start_resync_timer_fn (unsigned long data)
 
int drbd_rs_should_slow_down (struct drbd_conf *mdev, sector_t sector)
 
int drbd_submit_ee (struct drbd_conf *mdev, struct drbd_epoch_entry *e, const unsigned rw, const int fault_type)
 
int drbd_release_ee (struct drbd_conf *mdev, struct list_head *list)
 
struct drbd_epoch_entrydrbd_alloc_ee (struct drbd_conf *mdev, u64 id, sector_t sector, unsigned int data_size, gfp_t gfp_mask) __must_hold(local)
 
void drbd_free_some_ee (struct drbd_conf *mdev, struct drbd_epoch_entry *e, int is_net)
 
void drbd_wait_ee_list_empty (struct drbd_conf *mdev, struct list_head *head)
 
void _drbd_wait_ee_list_empty (struct drbd_conf *mdev, struct list_head *head)
 
void drbd_set_recv_tcq (struct drbd_conf *mdev, int tcq_enabled)
 
void _drbd_clear_done_ee (struct drbd_conf *mdev, struct list_head *to_be_freed)
 
void drbd_flush_workqueue (struct drbd_conf *mdev)
 
void drbd_free_tl_hash (struct drbd_conf *mdev)
 
void drbd_bump_write_ordering (struct drbd_conf *mdev, enum write_ordering_e wo)
 
const chardrbd_conn_str (enum drbd_conns s)
 
const chardrbd_role_str (enum drbd_role s)
 
void drbd_al_begin_io (struct drbd_conf *mdev, sector_t sector)
 
void drbd_al_complete_io (struct drbd_conf *mdev, sector_t sector)
 
void drbd_rs_complete_io (struct drbd_conf *mdev, sector_t sector)
 
int drbd_rs_begin_io (struct drbd_conf *mdev, sector_t sector)
 
int drbd_try_rs_begin_io (struct drbd_conf *mdev, sector_t sector)
 
void drbd_rs_cancel_all (struct drbd_conf *mdev)
 
int drbd_rs_del_all (struct drbd_conf *mdev)
 
void drbd_rs_failed_io (struct drbd_conf *mdev, sector_t sector, int size)
 
int drbd_al_read_log (struct drbd_conf *mdev, struct drbd_backing_dev *)
 
void drbd_advance_rs_marks (struct drbd_conf *mdev, unsigned long still_to_go)
 
void __drbd_set_in_sync (struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line)
 
int __drbd_set_out_of_sync (struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line)
 
void drbd_al_apply_to_bm (struct drbd_conf *mdev)
 
void drbd_al_shrink (struct drbd_conf *mdev)
 
void drbd_nl_cleanup (void)
 
int __init drbd_nl_init (void)
 
void drbd_bcast_state (struct drbd_conf *mdev, union drbd_state)
 
void drbd_bcast_sync_progress (struct drbd_conf *mdev)
 
void drbd_bcast_ee (struct drbd_conf *mdev, const char *reason, const int dgs, const char *seen_hash, const char *calc_hash, const struct drbd_epoch_entry *e)
 

Variables

unsigned int minor_count
 
bool disable_sendpage
 
bool allow_oos
 
unsigned int cn_idx
 
char usermode_helper []
 
struct drbd_conf ** minor_table
 
struct ratelimit_state drbd_ratelimit_state
 
struct p_header80 __packed
 
struct kmem_cachedrbd_request_cache
 
struct kmem_cachedrbd_ee_cache
 
struct kmem_cachedrbd_bm_ext_cache
 
struct kmem_cachedrbd_al_ext_cache
 
mempool_tdrbd_request_mempool
 
mempool_tdrbd_ee_mempool
 
struct pagedrbd_pp_pool
 
spinlock_t drbd_pp_lock
 
int drbd_pp_vacant
 
wait_queue_head_t drbd_pp_wait
 
mempool_tdrbd_md_io_page_pool
 
struct bio_set * drbd_md_io_bio_set
 
rwlock_t global_state_lock
 
int proc_details
 
struct proc_dir_entrydrbd_proc
 
struct file_operations drbd_proc_fops
 

Macro Definition Documentation

#define __drbd_chk_io_error (   m,
  f 
)    __drbd_chk_io_error_(m,f, __func__)

Definition at line 1856 of file drbd_int.h.

#define __must_hold (   x)

Definition at line 55 of file drbd_int.h.

#define __no_warn (   lock,
  stmt 
)    do { __acquire(lock); stmt; __release(lock); } while (0)

Definition at line 58 of file drbd_int.h.

Definition at line 323 of file drbd_int.h.

#define __protected_by (   x)

Definition at line 52 of file drbd_int.h.

#define __protected_read_by (   x)

Definition at line 53 of file drbd_int.h.

#define __protected_write_by (   x)

Definition at line 54 of file drbd_int.h.

#define _NS (   D,
  T,
  S 
)    D, ({ union drbd_state __ns; __ns.i = D->state.i; __ns.T = (S); __ns; })

Definition at line 1774 of file drbd_int.h.

#define _NS2 (   D,
  T1,
  S1,
  T2,
  S2 
)
Value:
D, ({ union drbd_state __ns; __ns.i = D->state.i; __ns.T1 = (S1); \
__ns.T2 = (S2); __ns; })

Definition at line 1776 of file drbd_int.h.

#define _NS3 (   D,
  T1,
  S1,
  T2,
  S2,
  T3,
  S3 
)
Value:
D, ({ union drbd_state __ns; __ns.i = D->state.i; __ns.T1 = (S1); \
__ns.T2 = (S2); __ns.T3 = (S3); __ns; })

Definition at line 1779 of file drbd_int.h.

#define aftr_isp_MASK   1

Definition at line 1756 of file drbd_int.h.

#define AL_EXT_PER_BM_SECT   (1 << (BM_EXT_SHIFT - AL_EXTENT_SHIFT))

Definition at line 1395 of file drbd_int.h.

#define AL_EXTENT_SHIFT   22 /* One extent represents 4M Storage */

Definition at line 1329 of file drbd_int.h.

#define AL_EXTENT_SIZE   (1<<AL_EXTENT_SHIFT)

Definition at line 1330 of file drbd_int.h.

#define AL_EXTENTS_PT   ((MD_SECTOR_SIZE-12)/8-1) /* 61 ; Extents per 512B sector */

Definition at line 1328 of file drbd_int.h.

#define APP_R_HSIZE   15

Definition at line 1449 of file drbd_int.h.

#define Bit2KB (   bits)    ((bits)<<(BM_BLOCK_SHIFT-10))

Definition at line 1384 of file drbd_int.h.

#define BM_BIT_TO_SECT (   x)    ((sector_t)(x)<<(BM_BLOCK_SHIFT-9))

Definition at line 1380 of file drbd_int.h.

#define BM_BLOCK_SHIFT   12 /* 4k per bit */

Definition at line 1367 of file drbd_int.h.

#define BM_BLOCK_SIZE   (1<<BM_BLOCK_SHIFT)

Definition at line 1368 of file drbd_int.h.

#define BM_BLOCKS_PER_BM_EXT_B   (BM_EXT_SHIFT - BM_BLOCK_SHIFT)

Definition at line 1398 of file drbd_int.h.

#define BM_BLOCKS_PER_BM_EXT_MASK   ((1<<BM_BLOCKS_PER_BM_EXT_B) - 1)

Definition at line 1399 of file drbd_int.h.

#define BM_EXT_SHIFT   (BM_BLOCK_SHIFT + MD_SECTOR_SHIFT + 3) /* = 24 */

Definition at line 1371 of file drbd_int.h.

#define BM_EXT_SIZE   (1<<BM_EXT_SHIFT)

Definition at line 1372 of file drbd_int.h.

#define BM_EXT_TO_SECT (   x)    ((sector_t)(x) << (BM_EXT_SHIFT-9))

Definition at line 1391 of file drbd_int.h.

#define BM_PACKET_PAYLOAD_BYTES   (4096 - sizeof(struct p_header80))

Definition at line 627 of file drbd_int.h.

#define BM_PACKET_VLI_BYTES_MAX   (4096 - sizeof(struct p_compressed_bm))

Definition at line 629 of file drbd_int.h.

#define BM_PACKET_WORDS   (BM_PACKET_PAYLOAD_BYTES/sizeof(long))

Definition at line 628 of file drbd_int.h.

#define BM_SECT_PER_BIT   BM_BIT_TO_SECT(1)

Definition at line 1381 of file drbd_int.h.

#define BM_SECT_PER_EXT   BM_EXT_TO_SECT(1)

Definition at line 1392 of file drbd_int.h.

#define BM_SECT_TO_BIT (   x)    ((x)>>(BM_BLOCK_SHIFT-9))

Definition at line 1379 of file drbd_int.h.

#define BM_SECT_TO_EXT (   x)    ((x)>>(BM_EXT_SHIFT-9))

Definition at line 1388 of file drbd_int.h.

#define BM_WORDS_PER_AL_EXT   (1 << (AL_EXTENT_SHIFT-BM_BLOCK_SHIFT-LN2_BPL))

Definition at line 1396 of file drbd_int.h.

#define BME_LOCKED   1 /* bm_extent.flags: syncer active on this one. */

Definition at line 1354 of file drbd_int.h.

#define BME_NO_WRITES   0 /* bm_extent.flags: no more requests on this one! */

Definition at line 1353 of file drbd_int.h.

#define BME_PRIORITY   2 /* finish resync IO on this extent ASAP! App IO waiting! */

Definition at line 1355 of file drbd_int.h.

#define conn_MASK   C_MASK

Definition at line 1753 of file drbd_int.h.

#define D_ASSERT (   exp)
Value:
if (!(exp)) \
dev_err(DEV, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)

Definition at line 108 of file drbd_int.h.

#define dec_ap_pending (   mdev)
Value:
do { \
typecheck(struct drbd_conf *, mdev); \
if (atomic_dec_and_test(&mdev->ap_pending_cnt)) \
wake_up(&mdev->misc_wait); \
ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt); } while (0)

Definition at line 2113 of file drbd_int.h.

#define dec_rs_pending (   mdev)
Value:
do { \
typecheck(struct drbd_conf *, mdev); \
atomic_dec(&mdev->rs_pending_cnt); \
ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt); } while (0)

Definition at line 2130 of file drbd_int.h.

#define dec_unacked (   mdev)
Value:
do { \
typecheck(struct drbd_conf *, mdev); \
atomic_dec(&mdev->unacked_cnt); \
ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)

Definition at line 2149 of file drbd_int.h.

#define DEV   (disk_to_dev(mdev->vdisk))

Definition at line 106 of file drbd_int.h.

#define disk_MASK   D_MASK

Definition at line 1751 of file drbd_int.h.

#define div_ceil (   A,
  B 
)    ((A)/(B) + ((A)%(B) ? 1 : 0))

Definition at line 149 of file drbd_int.h.

#define div_floor (   A,
  B 
)    ((A)/(B))

Definition at line 151 of file drbd_int.h.

#define DP_DISCARD   64 /* equals REQ_DISCARD */

Definition at line 379 of file drbd_int.h.

#define DP_FLUSH   32 /* equals REQ_FLUSH */

Definition at line 378 of file drbd_int.h.

#define DP_FUA   16 /* equals REQ_FUA */

Definition at line 377 of file drbd_int.h.

#define DP_HARDBARRIER   1 /* depricated */

Definition at line 373 of file drbd_int.h.

#define DP_MAY_SET_IN_SYNC   4

Definition at line 375 of file drbd_int.h.

#define DP_RW_SYNC   2 /* equals REQ_SYNC */

Definition at line 374 of file drbd_int.h.

#define DP_UNPLUG   8 /* not used anymore */

Definition at line 376 of file drbd_int.h.

#define drbd_calc_cpu_mask (   A)    ({})

Definition at line 1224 of file drbd_int.h.

#define drbd_chk_io_error (   m,
  e,
  f 
)    drbd_chk_io_error_(m,e,f, __func__)

drbd_chk_io_error: Handle the on_io_error setting, should be called from all io completion handlers : DRBD device. : Error code passed to the IO completion callback : Force detach. I.e. the error happened while accessing the meta data

See also drbd_main.c:after_state_ch() if (os.disk > D_FAILED && ns.disk == D_FAILED)

Definition at line 1893 of file drbd_int.h.

#define DRBD_END_OF_BITMAP   (~(unsigned long)0)

Definition at line 1480 of file drbd_int.h.

#define drbd_free_ee (   m,
  e 
)    drbd_free_some_ee(m, e, 0)

Definition at line 1634 of file drbd_int.h.

#define drbd_free_net_ee (   m,
  e 
)    drbd_free_some_ee(m, e, 1)

Definition at line 1635 of file drbd_int.h.

#define DRBD_MAX_BIO_SIZE   (1U<<(9+HT_SHIFT))

Definition at line 1443 of file drbd_int.h.

#define DRBD_MAX_BIO_SIZE_SAFE   (1U << 12) /* Works always = 4k */

Definition at line 1444 of file drbd_int.h.

#define DRBD_MAX_SECTORS   DRBD_MAX_SECTORS_BM

Definition at line 1425 of file drbd_int.h.

#define DRBD_MAX_SECTORS_32   (0xffffffffLU)

Definition at line 1415 of file drbd_int.h.

#define DRBD_MAX_SECTORS_BM   ((MD_RESERVED_SECT - MD_BM_OFFSET) * (1LL<<(BM_EXT_SHIFT-9)))

Definition at line 1416 of file drbd_int.h.

#define DRBD_MAX_SECTORS_FLEX   (1UL << 51)

Definition at line 1434 of file drbd_int.h.

#define DRBD_MAX_SIZE_H80_PACKET   (1U << 15) /* The old header only allows packets up to 32Kib data */

Definition at line 1446 of file drbd_int.h.

#define DRBD_MD_MAGIC   (DRBD_MAGIC+4)

Definition at line 155 of file drbd_int.h.

#define DRBD_MIN_POOL_PAGES   128

Definition at line 1529 of file drbd_int.h.

#define drbd_set_in_sync (   mdev,
  sector,
  size 
)    __drbd_set_in_sync(mdev, sector, size, __FILE__, __LINE__)

Definition at line 1709 of file drbd_int.h.

#define drbd_set_out_of_sync (   mdev,
  sector,
  size 
)    __drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__)

Definition at line 1713 of file drbd_int.h.

#define DRBD_SIG   SIGXCPU

Definition at line 80 of file drbd_int.h.

#define DRBD_SIGKILL   SIGHUP

Definition at line 87 of file drbd_int.h.

#define DRBD_SYNC_MARK_STEP   (3*HZ)

Definition at line 1044 of file drbd_int.h.

#define DRBD_SYNC_MARKS   8

Definition at line 1043 of file drbd_int.h.

#define drbd_thread_current_set_cpu (   A)    ({})

Definition at line 1223 of file drbd_int.h.

#define EE_CALL_AL_COMPLETE_IO   (1<<__EE_CALL_AL_COMPLETE_IO)

Definition at line 804 of file drbd_int.h.

#define EE_HAS_DIGEST   (1<<__EE_HAS_DIGEST)

Definition at line 808 of file drbd_int.h.

#define EE_MAY_SET_IN_SYNC   (1<<__EE_MAY_SET_IN_SYNC)

Definition at line 805 of file drbd_int.h.

#define EE_RESUBMITTED   (1<<__EE_RESUBMITTED)

Definition at line 806 of file drbd_int.h.

#define EE_WAS_ERROR   (1<<__EE_WAS_ERROR)

Definition at line 807 of file drbd_int.h.

#define ERR_IF (   exp)
Value:
if (({ \
int _b = (exp) != 0; \
if (_b) dev_err(DEV, "ASSERT FAILED: %s: (%s) in %s:%d\n", \
__func__, #exp, __FILE__, __LINE__); \
_b; \
}))

Definition at line 111 of file drbd_int.h.

#define ERR_IF_CNT_IS_NEGATIVE (   which)
Value:
if (atomic_read(&mdev->which) < 0) \
dev_err(DEV, "in %s:%d: " #which " = %d < 0 !\n", \
__func__ , __LINE__ , \
atomic_read(&mdev->which))

Definition at line 2107 of file drbd_int.h.

#define get_ldev (   M)    __cond_lock(local, _get_ldev_if_state(M,D_INCONSISTENT))

get_ldev() - Increase the ref count on mdev->ldev. Returns 0 if there is no ldev : DRBD device.

You have to call put_ldev() when finished working with mdev->ldev.

Definition at line 2189 of file drbd_int.h.

#define get_ldev_if_state (   M,
  MINS 
)    __cond_lock(local, _get_ldev_if_state(M,MINS))

Definition at line 2190 of file drbd_int.h.

#define HT_SHIFT   8

Definition at line 1442 of file drbd_int.h.

#define ID_IN_SYNC   (4711ULL)

Definition at line 94 of file drbd_int.h.

#define ID_OUT_OF_SYNC   (4712ULL)

Definition at line 95 of file drbd_int.h.

#define ID_SYNCER   (-1ULL)

Definition at line 97 of file drbd_int.h.

#define ID_VACANT   0

Definition at line 98 of file drbd_int.h.

#define is_syncer_block_id (   id)    ((id) == ID_SYNCER)

Definition at line 99 of file drbd_int.h.

#define MD_AL_MAX_SIZE   64 /* = 32 kb LOG ~ 3776 extents ~ 14 GB Storage */

Definition at line 1319 of file drbd_int.h.

#define MD_AL_OFFSET   8 /* 8 Sectors after start of meta area */

Definition at line 1318 of file drbd_int.h.

#define MD_BM_OFFSET   (MD_AL_OFFSET + MD_AL_MAX_SIZE)

Definition at line 1321 of file drbd_int.h.

#define MD_RESERVED_SECT   (128LU << 11) /* 128 MB, unit sectors */

Definition at line 1316 of file drbd_int.h.

#define MD_SECTOR_SHIFT   9

Definition at line 1324 of file drbd_int.h.

#define MD_SECTOR_SIZE   (1<<MD_SECTOR_SHIFT)

Definition at line 1325 of file drbd_int.h.

#define NL_BIT (   pn,
  pr,
  member 
)    unsigned member:1;

Definition at line 933 of file drbd_int.h.

#define NL_INT64 (   pn,
  pr,
  member 
)    __u64 member;

Definition at line 932 of file drbd_int.h.

#define NL_INTEGER (   pn,
  pr,
  member 
)    int member;

Definition at line 931 of file drbd_int.h.

#define NL_PACKET (   name,
  number,
  fields 
)    struct name { fields };

Definition at line 930 of file drbd_int.h.

#define NL_STRING (   pn,
  pr,
  member,
  len 
)    unsigned char member[len]; int member ## _len;

Definition at line 934 of file drbd_int.h.

#define NS (   T,
  S 
)
Value:
({ union drbd_state mask; mask.i = 0; mask.T = T##_MASK; mask; }), \
({ union drbd_state val; val.i = 0; val.T = (S); val; })

Definition at line 1760 of file drbd_int.h.

#define NS2 (   T1,
  S1,
  T2,
  S2 
)
Value:
({ union drbd_state mask; mask.i = 0; mask.T1 = T1##_MASK; \
mask.T2 = T2##_MASK; mask; }), \
({ union drbd_state val; val.i = 0; val.T1 = (S1); \
val.T2 = (S2); val; })

Definition at line 1763 of file drbd_int.h.

#define NS3 (   T1,
  S1,
  T2,
  S2,
  T3,
  S3 
)
Value:
({ union drbd_state mask; mask.i = 0; mask.T1 = T1##_MASK; \
mask.T2 = T2##_MASK; mask.T3 = T3##_MASK; mask; }), \
({ union drbd_state val; val.i = 0; val.T1 = (S1); \
val.T2 = (S2); val.T3 = (S3); val; })

Definition at line 1768 of file drbd_int.h.

#define page_chain_for_each (   page)
Value:
for (; page && ({ prefetch(page_chain_next(page)); 1; }); \
page = page_chain_next(page))

Definition at line 1792 of file drbd_int.h.

#define page_chain_for_each_safe (   page,
  n 
)    for (; page && ({ n = page_chain_next(page); 1; }); page = n)

Definition at line 1795 of file drbd_int.h.

#define pdsk_MASK   D_MASK

Definition at line 1752 of file drbd_int.h.

#define peer_MASK   R_MASK

Definition at line 1750 of file drbd_int.h.

#define QUEUE_ORDERED_NONE   0
#define role_MASK   R_MASK

DOC: DRBD State macros

These macros are used to express state changes in easily readable form.

The NS macros expand to a mask and a value, that can be bit ored onto the current state as soon as the spinlock (req_lock) was taken.

The _NS macros are used for state functions that get called with the spinlock. These macros expand directly to the new state value.

Besides the basic forms NS() and _NS() additional _?NS[23] are defined to express state changes that affect more than one aspect of the state.

E.g. NS2(conn, C_CONNECTED, peer, R_SECONDARY) Means that the network connection was established and that the peer is in secondary role.

Definition at line 1749 of file drbd_int.h.

#define seq_ge (   a,
  b 
)    (seq_cmp((a), (b)) >= 0)

Definition at line 2456 of file drbd_int.h.

#define seq_gt (   a,
  b 
)    (seq_cmp((a), (b)) > 0)

Definition at line 2455 of file drbd_int.h.

#define seq_le (   a,
  b 
)    (seq_cmp((a), (b)) <= 0)

Definition at line 2457 of file drbd_int.h.

#define seq_lt (   a,
  b 
)    (seq_cmp((a), (b)) < 0)

Definition at line 2454 of file drbd_int.h.

#define seq_max (   a,
  b 
)    ((u32)(seq_gt((a), (b)) ? (a) : (b)))

Definition at line 2459 of file drbd_int.h.

#define SLEEP_TIME   (HZ/10)

Definition at line 1365 of file drbd_int.h.

#define sub_unacked (   mdev,
  n 
)
Value:
do { \
typecheck(struct drbd_conf *, mdev); \
atomic_sub(n, &mdev->unacked_cnt); \
ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)

Definition at line 2154 of file drbd_int.h.

#define susp_fen_MASK   1

Definition at line 1758 of file drbd_int.h.

#define susp_MASK   1

Definition at line 1754 of file drbd_int.h.

#define susp_nod_MASK   1

Definition at line 1757 of file drbd_int.h.

#define USE_DATA_SOCKET   1

Definition at line 1244 of file drbd_int.h.

#define USE_META_SOCKET   0

Definition at line 1245 of file drbd_int.h.

#define user_isp_MASK   1

Definition at line 1755 of file drbd_int.h.

#define UUID_NEW_BM_OFFSET   ((u64)0x0001000000000000ULL)

Definition at line 100 of file drbd_int.h.

Typedef Documentation

typedef int(* drbd_work_cb)(struct drbd_conf *, struct drbd_work *, int cancel)

Definition at line 685 of file drbd_int.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
DRBD_FAULT_MD_WR 
DRBD_FAULT_MD_RD 
DRBD_FAULT_RS_WR 
DRBD_FAULT_RS_RD 
DRBD_FAULT_DT_WR 
DRBD_FAULT_DT_RD 
DRBD_FAULT_DT_RA 
DRBD_FAULT_BM_ALLOC 
DRBD_FAULT_AL_EE 
DRBD_FAULT_RECEIVE 
DRBD_FAULT_MAX 

Definition at line 119 of file drbd_int.h.

anonymous enum
Enumerator:
DE_HAVE_BARRIER_NUMBER 

Definition at line 744 of file drbd_int.h.

anonymous enum
Enumerator:
__EE_CALL_AL_COMPLETE_IO 
__EE_MAY_SET_IN_SYNC 
__EE_RESUBMITTED 
__EE_WAS_ERROR 
__EE_HAS_DIGEST 

Definition at line 788 of file drbd_int.h.

anonymous enum
Enumerator:
CREATE_BARRIER 
SIGNAL_ASENDER 
SEND_PING 
UNPLUG_REMOTE 
MD_DIRTY 
DISCARD_CONCURRENT 
USE_DEGR_WFC_T 
CLUSTER_ST_CHANGE 
CL_ST_CHG_SUCCESS 
CL_ST_CHG_FAIL 
CRASHED_PRIMARY 
CONSIDER_RESYNC 
MD_NO_FUA 
SUSPEND_IO 
BITMAP_IO 
BITMAP_IO_QUEUED 
GO_DISKLESS 
WAS_IO_ERROR 
FORCE_DETACH 
RESYNC_AFTER_NEG 
NET_CONGESTED 
CONFIG_PENDING 
DEVICE_DYING 
RESIZE_PENDING 
CONN_DRY_RUN 
GOT_PING_ACK 
NEW_CUR_UUID 
AL_SUSPENDED 
AHEAD_TO_SYNC_SOURCE 
STATE_SENT 
CALLBACK_PENDING 

Definition at line 811 of file drbd_int.h.

enum bm_flag
Enumerator:
BM_P_VMALLOCED 
BM_LOCKED_MASK 
BM_DONT_CLEAR 
BM_DONT_SET 
BM_DONT_TEST 
BM_IS_LOCKED 
BM_LOCKED_TEST_ALLOWED 
BM_LOCKED_SET_ALLOWED 
BM_LOCKED_CHANGE_ALLOWED 

Definition at line 866 of file drbd_int.h.

Enumerator:
CS_HARD 
CS_VERBOSE 
CS_WAIT_COMPLETE 
CS_SERIALIZE 
CS_ORDERED 

Definition at line 1188 of file drbd_int.h.

enum dds_flags
Enumerator:
DDSF_FORCED 
DDSF_NO_RESYNC 

Definition at line 1196 of file drbd_int.h.

Enumerator:
dev_size_error 
unchanged 
shrunk 
grew 

Definition at line 1557 of file drbd_int.h.

Enumerator:
RLE_VLI_Bits 

Definition at line 558 of file drbd_int.h.

Enumerator:
CF_WANT_LOSE 
CF_DRY_RUN 

Definition at line 477 of file drbd_int.h.

Enumerator:
DRBD_IO_ERROR 
DRBD_META_IO_ERROR 
DRBD_FORCE_DETACH 

Definition at line 1850 of file drbd_int.h.

Enumerator:
P_DATA 
P_DATA_REPLY 
P_RS_DATA_REPLY 
P_BARRIER 
P_BITMAP 
P_BECOME_SYNC_TARGET 
P_BECOME_SYNC_SOURCE 
P_UNPLUG_REMOTE 
P_DATA_REQUEST 
P_RS_DATA_REQUEST 
P_SYNC_PARAM 
P_PROTOCOL 
P_UUIDS 
P_SIZES 
P_STATE 
P_SYNC_UUID 
P_AUTH_CHALLENGE 
P_AUTH_RESPONSE 
P_STATE_CHG_REQ 
P_PING 
P_PING_ACK 
P_RECV_ACK 
P_WRITE_ACK 
P_RS_WRITE_ACK 
P_DISCARD_ACK 
P_NEG_ACK 
P_NEG_DREPLY 
P_NEG_RS_DREPLY 
P_BARRIER_ACK 
P_STATE_CHG_REPLY 
P_OV_REQUEST 
P_OV_REPLY 
P_OV_RESULT 
P_CSUM_RS_REQUEST 
P_RS_IS_IN_SYNC 
P_SYNC_PARAM89 
P_COMPRESSED_BITMAP 
P_DELAY_PROBE 
P_OUT_OF_SYNC 
P_RS_CANCEL 
P_MAX_CMD 
P_MAY_IGNORE 
P_MAX_OPT_CMD 
P_HAND_SHAKE_M 
P_HAND_SHAKE_S 
P_HAND_SHAKE 

Definition at line 161 of file drbd_int.h.

Enumerator:
None 
Running 
Exiting 
Restarting 

Definition at line 657 of file drbd_int.h.

Enumerator:
EV_PUT 
EV_GOT_BARRIER_NR 
EV_BECAME_LAST 
EV_CLEANUP 

Definition at line 748 of file drbd_int.h.

Enumerator:
WO_none 
WO_drain_io 
WO_bdev_flush 

Definition at line 958 of file drbd_int.h.

Function Documentation

void __drbd_set_in_sync ( struct drbd_conf mdev,
sector_t  sector,
int  size,
const char file,
const unsigned int  line 
)

Definition at line 806 of file drbd_actlog.c.

int __drbd_set_out_of_sync ( struct drbd_conf mdev,
sector_t  sector,
int  size,
const char file,
const unsigned int  line 
)

Definition at line 871 of file drbd_actlog.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.

unsigned long _drbd_bm_find_next ( struct drbd_conf mdev,
unsigned long  bm_fo 
)

Definition at line 1320 of file drbd_bitmap.c.

unsigned long _drbd_bm_find_next_zero ( struct drbd_conf mdev,
unsigned long  bm_fo 
)

Definition at line 1326 of file drbd_bitmap.c.

void _drbd_bm_set_bits ( struct drbd_conf mdev,
const unsigned long  s,
const unsigned long  e 
)

Definition at line 1440 of file drbd_bitmap.c.

unsigned long _drbd_bm_total_weight ( struct drbd_conf mdev)

Definition at line 729 of file drbd_bitmap.c.

void _drbd_clear_done_ee ( struct drbd_conf mdev,
struct list_head to_be_freed 
)
unsigned int _drbd_insert_fault ( struct drbd_conf mdev,
unsigned int  type 
)
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.

int _drbd_send_bitmap ( struct drbd_conf mdev)

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.

void _drbd_thread_stop ( struct drbd_thread thi,
int  restart,
int  wait 
)

Definition at line 1866 of file drbd_main.c.

void _drbd_uuid_new_current ( struct drbd_conf mdev)
void _drbd_uuid_set ( struct drbd_conf mdev,
int  idx,
u64  val 
)

Definition at line 4022 of file drbd_main.c.

void _drbd_wait_ee_list_empty ( struct drbd_conf mdev,
struct list_head head 
)

Definition at line 425 of file drbd_receiver.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.

struct bio* bio_alloc_drbd ( gfp_t  gfp_mask)
read

Definition at line 165 of file drbd_main.c.

void drbd_advance_rs_marks ( struct drbd_conf mdev,
unsigned long  still_to_go 
)

Definition at line 783 of file drbd_actlog.c.

void drbd_al_apply_to_bm ( struct drbd_conf mdev)

drbd_al_apply_to_bm() - Sets the bitmap to diry(1) where covered ba active AL extents : DRBD device.

Definition at line 596 of file drbd_actlog.c.

void drbd_al_begin_io ( struct drbd_conf mdev,
sector_t  sector 
)

Definition at line 250 of file drbd_actlog.c.

void drbd_al_complete_io ( struct drbd_conf mdev,
sector_t  sector 
)

Definition at line 284 of file drbd_actlog.c.

int drbd_al_read_log ( struct drbd_conf mdev,
struct drbd_backing_dev bdev 
)

drbd_al_read_log() - Restores the activity log from its on disk representation. : DRBD device. : Block device to read form.

Returns 1 on success, returns 0 when reading the log failed due to IO errors.

Definition at line 472 of file drbd_actlog.c.

void drbd_al_shrink ( struct drbd_conf mdev)

drbd_al_shrink() - Removes all active extents form the activity log : DRBD device.

Removes all active extents form the activity log, waiting until the reference count of each entry dropped to 0 first, of course.

You need to lock mdev->act_log with lc_try_lock() / lc_unlock()

Definition at line 643 of file drbd_actlog.c.

struct drbd_epoch_entry* drbd_alloc_ee ( struct drbd_conf mdev,
u64  id,
sector_t  sector,
unsigned int  data_size,
gfp_t  gfp_mask 
)
read

Definition at line 315 of file drbd_receiver.c.

int drbd_alter_sa ( struct drbd_conf mdev,
int  na 
)

Definition at line 1457 of file drbd_worker.c.

void drbd_bcast_ee ( struct drbd_conf mdev,
const char reason,
const int  dgs,
const char seen_hash,
const char calc_hash,
const struct drbd_epoch_entry e 
)

Definition at line 2526 of file drbd_nl.c.

void drbd_bcast_state ( struct drbd_conf mdev,
union drbd_state   
)

Definition at line 2461 of file drbd_nl.c.

void drbd_bcast_sync_progress ( struct drbd_conf mdev)

Definition at line 2605 of file drbd_nl.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.

unsigned long drbd_bm_ALe_set_all ( struct drbd_conf mdev,
unsigned long  al_enr 
)

Definition at line 1636 of file drbd_bitmap.c.

unsigned long drbd_bm_bits ( struct drbd_conf mdev)

Definition at line 765 of file drbd_bitmap.c.

sector_t drbd_bm_capacity ( struct drbd_conf mdev)

Definition at line 440 of file drbd_bitmap.c.

void drbd_bm_cleanup ( struct drbd_conf mdev)

Definition at line 448 of file drbd_bitmap.c.

void drbd_bm_clear_all ( struct drbd_conf mdev)

Definition at line 874 of file drbd_bitmap.c.

int drbd_bm_clear_bits ( struct drbd_conf mdev,
unsigned long  s,
unsigned long  e 
)

Definition at line 1414 of file drbd_bitmap.c.

int drbd_bm_count_bits ( struct drbd_conf mdev,
const unsigned long  s,
const unsigned long  e 
)

Definition at line 1549 of file drbd_bitmap.c.

int drbd_bm_e_weight ( struct drbd_conf mdev,
unsigned long  enr 
)

Definition at line 1603 of file drbd_bitmap.c.

unsigned long drbd_bm_find_next ( struct drbd_conf mdev,
unsigned long  bm_fo 
)

Definition at line 1305 of file drbd_bitmap.c.

void drbd_bm_get_lel ( struct drbd_conf mdev,
size_t  offset,
size_t  number,
unsigned long buffer 
)

Definition at line 825 of file drbd_bitmap.c.

int drbd_bm_init ( struct drbd_conf mdev)

Definition at line 424 of file drbd_bitmap.c.

void drbd_bm_lock ( struct drbd_conf mdev,
char why,
enum bm_flag  flags 
)

Definition at line 131 of file drbd_bitmap.c.

void drbd_bm_merge_lel ( struct drbd_conf mdev,
size_t  offset,
size_t  number,
unsigned long buffer 
)

Definition at line 778 of file drbd_bitmap.c.

int drbd_bm_read ( struct drbd_conf mdev)

drbd_bm_read() - Read the whole bitmap from its on disk location. : DRBD device.

Definition at line 1129 of file drbd_bitmap.c.

int drbd_bm_resize ( struct drbd_conf mdev,
sector_t  sectors,
int  set_new_bits 
)

Definition at line 604 of file drbd_bitmap.c.

int drbd_bm_rs_done ( struct drbd_conf mdev)
void drbd_bm_set_all ( struct drbd_conf mdev)

Definition at line 860 of file drbd_bitmap.c.

int drbd_bm_set_bits ( struct drbd_conf mdev,
unsigned long  s,
unsigned long  e 
)

Definition at line 1408 of file drbd_bitmap.c.

int drbd_bm_test_bit ( struct drbd_conf mdev,
unsigned long  bitnr 
)

Definition at line 1520 of file drbd_bitmap.c.

unsigned long drbd_bm_total_weight ( struct drbd_conf mdev)

Definition at line 745 of file drbd_bitmap.c.

void drbd_bm_unlock ( struct drbd_conf mdev)

Definition at line 162 of file drbd_bitmap.c.

size_t drbd_bm_words ( struct drbd_conf mdev)

Definition at line 756 of file drbd_bitmap.c.

int drbd_bm_write ( struct drbd_conf mdev)

drbd_bm_write() - Write the whole bitmap to its on disk location. : DRBD device.

Will only write pages that have changed since last IO.

Definition at line 1140 of file drbd_bitmap.c.

int drbd_bm_write_all ( struct drbd_conf mdev)

drbd_bm_write_all() - Write the whole bitmap to its on disk location. : DRBD device.

Will write all pages.

Definition at line 1151 of file drbd_bitmap.c.

int drbd_bm_write_copy_pages ( struct drbd_conf mdev)

drbd_bm_write_copy_pages() - Write the whole bitmap to its on disk location. : DRBD device.

Will only write pages that have changed since last IO. In contrast to drbd_bm_write(), this will copy the bitmap pages to temporary writeout pages. It is intended to trigger a full write-out while still allowing the bitmap to change, for example if a resync or online verify is aborted due to a failed peer disk, while local IO continues, or pending resync acks are still being processed.

Definition at line 1177 of file drbd_bitmap.c.

int drbd_bm_write_page ( struct drbd_conf mdev,
unsigned int  idx 
)

drbd_bm_write_page: Writes a PAGE_SIZE aligned piece of bitmap : DRBD device. : bitmap page index

We don't want to special case on logical_block_size of the backend device, so we submit PAGE_SIZE aligned pieces. Note that on "most" systems, PAGE_SIZE is 4k.

In case this becomes an issue on systems with larger PAGE_SIZE, we may want to change this again to write 4k aligned 4k pieces.

Definition at line 1195 of file drbd_bitmap.c.

int drbd_bmio_clear_n_write ( struct drbd_conf mdev)

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.

int drbd_bmio_set_n_write ( struct drbd_conf mdev)

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.

void drbd_bump_write_ordering ( struct drbd_conf mdev,
enum write_ordering_e  wo 
)

drbd_bump_write_ordering() - Fall back to an other write ordering method : DRBD device. : Write ordering method to try.

Definition at line 1062 of file drbd_receiver.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.

const char* drbd_conn_str ( enum drbd_conns  s)

Definition at line 94 of file drbd_strings.c.

void drbd_csum_bio ( struct drbd_conf ,
struct crypto_hash ,
struct bio *  ,
void  
)

Definition at line 299 of file drbd_worker.c.

void drbd_csum_ee ( struct drbd_conf ,
struct crypto_hash ,
struct drbd_epoch_entry ,
void  
)

Definition at line 272 of file drbd_worker.c.

enum determine_dev_size drbd_determine_dev_size ( struct drbd_conf mdev,
enum dds_flags  flags 
)

drbd_determine_dev_size() - Sets the right device size obeying all constraints : DRBD device.

Returns 0 on success, negative return values indicate errors. You should call drbd_md_sync() after calling this function.

Definition at line 605 of file drbd_nl.c.

void drbd_flush_workqueue ( struct drbd_conf mdev)

Definition at line 3786 of file drbd_receiver.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.

void drbd_free_mdev ( struct drbd_conf mdev)

Definition at line 3678 of file drbd_main.c.

void drbd_free_resources ( struct drbd_conf mdev)

Definition at line 3804 of file drbd_main.c.

void drbd_free_sock ( struct drbd_conf mdev)

Definition at line 3785 of file drbd_main.c.

void drbd_free_some_ee ( struct drbd_conf mdev,
struct drbd_epoch_entry e,
int  is_net 
)

Definition at line 358 of file drbd_receiver.c.

void drbd_free_tl_hash ( struct drbd_conf mdev)

Definition at line 3796 of file drbd_receiver.c.

int drbd_gen_and_send_sync_uuid ( struct drbd_conf mdev)

Definition at line 2172 of file drbd_main.c.

void drbd_go_diskless ( struct drbd_conf mdev)

Definition at line 4194 of file drbd_main.c.

void drbd_init_set_defaults ( struct drbd_conf mdev)

Definition at line 3129 of file drbd_main.c.

int drbd_khelper ( struct drbd_conf mdev,
char cmd 
)

Definition at line 137 of file drbd_nl.c.

void drbd_ldev_destroy ( struct drbd_conf mdev)

Definition at line 4166 of file drbd_main.c.

void drbd_make_request ( struct request_queue q,
struct bio *  bio 
)

Definition at line 1126 of file drbd_req.c.

void drbd_md_clear_flag ( struct drbd_conf mdev,
int  flags 
)

Definition at line 4278 of file drbd_main.c.

void* drbd_md_get_buffer ( struct drbd_conf mdev)

Definition at line 68 of file drbd_actlog.c.

void drbd_md_mark_dirty ( struct drbd_conf mdev)

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.

void drbd_md_put_buffer ( struct drbd_conf mdev)

Definition at line 79 of file drbd_actlog.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.

void drbd_md_set_flag ( struct drbd_conf mdev,
int  flags 
)

Definition at line 4270 of file drbd_main.c.

void drbd_md_sync ( struct drbd_conf mdev)

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_sync_page_io ( struct drbd_conf mdev,
struct drbd_backing_dev bdev,
sector_t  sector,
int  rw 
)

Definition at line 148 of file drbd_actlog.c.

int drbd_md_test_flag ( struct drbd_backing_dev ,
int   
)

Definition at line 4285 of file drbd_main.c.

void drbd_mdev_cleanup ( struct drbd_conf mdev)

Definition at line 3216 of file drbd_main.c.

int drbd_merge_bvec ( struct request_queue q,
struct bvec_merge_data *  bvm,
struct bio_vec *  bvec 
)

Definition at line 1216 of file drbd_req.c.

sector_t drbd_new_dev_size ( struct drbd_conf ,
struct drbd_backing_dev ,
int   
)

Definition at line 699 of file drbd_nl.c.

struct drbd_conf* drbd_new_device ( unsigned int  minor)
read

Definition at line 3579 of file drbd_main.c.

void drbd_nl_cleanup ( void  )

Definition at line 2665 of file drbd_nl.c.

int __init drbd_nl_init ( void  )

Definition at line 2643 of file drbd_nl.c.

void drbd_ov_oos_found ( struct drbd_conf ,
sector_t  ,
int   
)

Definition at line 1141 of file drbd_worker.c.

void drbd_print_uuids ( struct drbd_conf mdev,
const char text 
)

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_read_remote ( struct drbd_conf mdev,
struct drbd_request req 
)
void drbd_reconsider_max_bio_size ( struct drbd_conf mdev)

Definition at line 836 of file drbd_nl.c.

int drbd_release_ee ( struct drbd_conf mdev,
struct list_head list 
)

Definition at line 368 of file drbd_receiver.c.

void drbd_resume_io ( struct drbd_conf mdev)

Definition at line 592 of file drbd_nl.c.

int drbd_resync_finished ( struct drbd_conf mdev)

Definition at line 780 of file drbd_worker.c.

const char* drbd_role_str ( enum drbd_role  s)

Definition at line 100 of file drbd_strings.c.

int drbd_rs_begin_io ( struct drbd_conf mdev,
sector_t  sector 
)

drbd_rs_begin_io() - Gets an extent in the resync LRU cache and sets it to BME_LOCKED : DRBD device. : The sector number.

This functions sleeps on al_wait. Returns 0 on success, -EINTR if interrupted.

Definition at line 997 of file drbd_actlog.c.

void drbd_rs_cancel_all ( struct drbd_conf mdev)

drbd_rs_cancel_all() - Removes all extents from the resync LRU (even BME_LOCKED) : DRBD device.

Definition at line 1189 of file drbd_actlog.c.

void drbd_rs_complete_io ( struct drbd_conf mdev,
sector_t  sector 
)

Definition at line 1151 of file drbd_actlog.c.

void drbd_rs_controller_reset ( struct drbd_conf mdev)

Definition at line 1475 of file drbd_worker.c.

int drbd_rs_del_all ( struct drbd_conf mdev)

drbd_rs_del_all() - Gracefully remove all extents from the resync LRU : DRBD device.

Returns 0 upon success, -EAGAIN if at least one reference count was not zero.

Definition at line 1210 of file drbd_actlog.c.

void drbd_rs_failed_io ( struct drbd_conf mdev,
sector_t  sector,
int  size 
)

drbd_rs_failed_io() - Record information on a failure to resync the specified blocks : DRBD device. : The sector number. : Size of failed IO operation, in byte.

Definition at line 1261 of file drbd_actlog.c.

int drbd_rs_should_slow_down ( struct drbd_conf mdev,
sector_t  sector 
)

Definition at line 1929 of file drbd_receiver.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.

int drbd_send_b_ack ( struct drbd_conf mdev,
u32  barrier_nr,
u32  set_size 
)

Definition at line 2525 of file drbd_main.c.

int drbd_send_bitmap ( struct drbd_conf mdev)

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.

int drbd_send_cmd2 ( struct drbd_conf mdev,
enum drbd_packets  cmd,
char data,
size_t  size 
)

Definition at line 2005 of file drbd_main.c.

int drbd_send_current_state ( struct drbd_conf mdev)

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.

int drbd_send_ov_request ( struct drbd_conf mdev,
sector_t  sector,
int  size 
)

Definition at line 2653 of file drbd_main.c.

int drbd_send_protocol ( struct drbd_conf mdev)

Definition at line 2075 of file drbd_main.c.

int drbd_send_sizes ( struct drbd_conf mdev,
int  trigger_reply,
enum dds_flags  flags 
)

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_sync_param ( struct drbd_conf mdev,
struct syncer_conf *  sc 
)

Definition at line 2028 of file drbd_main.c.

int drbd_send_uuids ( struct drbd_conf mdev)

Definition at line 2144 of file drbd_main.c.

int drbd_send_uuids_skip_initial_sync ( struct drbd_conf mdev)

Definition at line 2149 of file drbd_main.c.

void drbd_set_recv_tcq ( struct drbd_conf mdev,
int  tcq_enabled 
)
enum drbd_state_rv drbd_set_role ( struct drbd_conf mdev,
enum drbd_role  new_role,
int  force 
)

Definition at line 317 of file drbd_nl.c.

void drbd_start_resync ( struct drbd_conf mdev,
enum drbd_conns  side 
)

drbd_start_resync() - Start the resync process : DRBD device. : Either C_SYNC_SOURCE or C_SYNC_TARGET

This function might bring you directly into one of the C_PAUSED_SYNC_* states.

Definition at line 1494 of file drbd_worker.c.

int drbd_submit_ee ( struct drbd_conf mdev,
struct drbd_epoch_entry e,
const unsigned  rw,
const int  fault_type 
)

drbd_submit_ee() : DRBD device. : epoch entry : flag field, see bio->bi_rw

May spread the pages to multiple bios, depending on bio_add_page restrictions.

Returns 0 if all bios have been submitted, -ENOMEM if we could not allocate enough bios, -ENOSPC (any better suggestion?) if we have not been able to bio_add_page a single page to an empty bio (which should never happen and likely indicates that the lower level IO stack is in some way broken). This has been observed on certain Xen deployments.

Definition at line 1099 of file drbd_receiver.c.

void drbd_suspend_io ( struct drbd_conf mdev)

Definition at line 584 of file drbd_nl.c.

int drbd_thread_start ( struct drbd_thread thi)

Definition at line 1801 of file drbd_main.c.

enum drbd_disk_state drbd_try_outdate_peer ( struct drbd_conf mdev)

Definition at line 204 of file drbd_nl.c.

void drbd_try_outdate_peer_async ( struct drbd_conf mdev)

Definition at line 307 of file drbd_nl.c.

int drbd_try_rs_begin_io ( struct drbd_conf mdev,
sector_t  sector 
)

drbd_try_rs_begin_io() - Gets an extent in the resync LRU cache, does not sleep : DRBD device. : The sector number.

Gets an extent in the resync LRU cache, sets it to BME_NO_WRITES, then tries to set it to BME_LOCKED. Returns 0 upon success, and -EAGAIN if there is still application IO going on in this area.

Definition at line 1050 of file drbd_actlog.c.

void drbd_uuid_new_current ( struct drbd_conf mdev)

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.

void drbd_uuid_set ( struct drbd_conf mdev,
int  idx,
u64  val 
)

Definition at line 4038 of file drbd_main.c.

void drbd_uuid_set_bm ( struct drbd_conf mdev,
u64  val 
)

Definition at line 4071 of file drbd_main.c.

void drbd_wait_ee_list_empty ( struct drbd_conf mdev,
struct list_head head 
)

Definition at line 440 of file drbd_receiver.c.

int drbd_worker ( struct drbd_thread thi)

Definition at line 1627 of file drbd_worker.c.

void INFO_bm_xfer_stats ( struct drbd_conf mdev,
const char direction,
struct bm_xfer_ctx c 
)

Definition at line 3512 of file drbd_receiver.c.

int is_valid_ar_handle ( struct drbd_request ,
sector_t   
)
char* ppsize ( char buf,
unsigned long long  size 
)

Definition at line 555 of file drbd_nl.c.

void print_st_err ( struct drbd_conf ,
union drbd_state  ,
union drbd_state  ,
int   
)
void resume_next_sg ( struct drbd_conf mdev)

Definition at line 1419 of file drbd_worker.c.

void resync_after_online_grow ( struct drbd_conf )

Definition at line 1700 of file drbd_nl.c.

void resync_timer_fn ( unsigned long  data)

Definition at line 422 of file drbd_worker.c.

void start_resync_timer_fn ( unsigned long  data)

Definition at line 733 of file drbd_worker.c.

void suspend_other_sg ( struct drbd_conf mdev)

Definition at line 1426 of file drbd_worker.c.

void tl_clear ( struct drbd_conf mdev)

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.

void tl_release ( struct drbd_conf mdev,
unsigned int  barrier_nr,
unsigned int  set_size 
)

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.

int w_e_end_csum_rs_req ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1032 of file drbd_worker.c.

int w_e_end_data_req ( struct drbd_conf mdev,
struct drbd_work w,
int  cancel 
)

w_e_end_data_req() - Worker callback, to send a P_DATA_REPLY packet in response to a P_DATA_REQUEST : DRBD device. : work object. : The connection will be closed anyways

Definition at line 948 of file drbd_worker.c.

int w_e_end_ov_reply ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1152 of file drbd_worker.c.

int w_e_end_ov_req ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1095 of file drbd_worker.c.

int w_e_end_rsdata_req ( struct drbd_conf mdev,
struct drbd_work w,
int  cancel 
)

w_e_end_rsdata_req() - Worker callback to send a P_RS_DATA_REPLY packet in response to a P_RS_DATA_REQUESTRS : DRBD device. : work object. : The connection will be closed anyways

Definition at line 984 of file drbd_worker.c.

int w_e_reissue ( struct drbd_conf ,
struct drbd_work ,
int   
)
int w_ov_finished ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 754 of file drbd_worker.c.

int w_prev_work_done ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1219 of file drbd_worker.c.

int w_read_retry_remote ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 253 of file drbd_worker.c.

int w_req_cancel_conflict ( struct drbd_conf ,
struct drbd_work ,
int   
)
int w_restart_disk_io ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1332 of file drbd_worker.c.

int w_resume_next_sg ( struct drbd_conf ,
struct drbd_work ,
int   
)
int w_resync_timer ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 408 of file drbd_worker.c.

int w_send_barrier ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1226 of file drbd_worker.c.

int w_send_dblock ( struct drbd_conf mdev,
struct drbd_work w,
int  cancel 
)

w_send_dblock() - Worker callback to send a P_DATA packet in order to mirror a write request : DRBD device. : work object. : The connection will be closed anyways

Definition at line 1286 of file drbd_worker.c.

int w_send_oos ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1264 of file drbd_worker.c.

int w_send_read_req ( struct drbd_conf mdev,
struct drbd_work w,
int  cancel 
)

w_send_read_req() - Worker callback to send a read request (P_DATA_REQUEST) packet : DRBD device. : work object. : The connection will be closed anyways

Definition at line 1308 of file drbd_worker.c.

int w_send_write_hint ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 1257 of file drbd_worker.c.

int w_start_resync ( struct drbd_conf ,
struct drbd_work ,
int   
)

Definition at line 740 of file drbd_worker.c.

void wait_until_done_or_disk_failure ( struct drbd_conf mdev,
struct drbd_backing_dev bdev,
unsigned int done 
)

Definition at line 91 of file drbd_actlog.c.

Variable Documentation

bool allow_oos

Definition at line 122 of file drbd_main.c.

unsigned int cn_idx

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.

struct page* drbd_pp_pool

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 proc_dir_entry* drbd_proc

Definition at line 40 of file drbd_proc.c.

struct file_operations drbd_proc_fops

Definition at line 41 of file drbd_proc.c.

struct ratelimit_state drbd_ratelimit_state
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.

rwlock_t global_state_lock

Definition at line 65 of file drbd_worker.c.

unsigned int minor_count

Definition at line 120 of file drbd_main.c.

struct drbd_conf** minor_table

Definition at line 135 of file drbd_main.c.

int proc_details

Definition at line 124 of file drbd_main.c.

char usermode_helper[]

Definition at line 128 of file drbd_main.c.