static int drbd_do_features(struct drbd_tconn *tconn);
static int drbd_do_auth(struct drbd_tconn *tconn);
-static int drbd_disconnected(struct drbd_conf *mdev);
+static int drbd_disconnected(struct drbd_device *mdev);
static enum finish_epoch drbd_may_finish_epoch(struct drbd_tconn *, struct drbd_epoch *, enum epoch_event);
static int e_end_block(struct drbd_work *, int);
*head = chain_first;
}
-static struct page *__drbd_alloc_pages(struct drbd_conf *mdev,
+static struct page *__drbd_alloc_pages(struct drbd_device *mdev,
unsigned int number)
{
struct page *page = NULL;
return NULL;
}
-static void reclaim_finished_net_peer_reqs(struct drbd_conf *mdev,
+static void reclaim_finished_net_peer_reqs(struct drbd_device *mdev,
struct list_head *to_be_freed)
{
struct drbd_peer_request *peer_req;
}
}
-static void drbd_kick_lo_and_reclaim_net(struct drbd_conf *mdev)
+static void drbd_kick_lo_and_reclaim_net(struct drbd_device *mdev)
{
LIST_HEAD(reclaimed);
struct drbd_peer_request *peer_req, *t;
*
* Returns a page chain linked via page->private.
*/
-struct page *drbd_alloc_pages(struct drbd_conf *mdev, unsigned int number,
+struct page *drbd_alloc_pages(struct drbd_device *mdev, unsigned int number,
bool retry)
{
struct page *page = NULL;
* Is also used from inside an other spin_lock_irq(&mdev->tconn->req_lock);
* Either links the page chain back to the global pool,
* or returns all pages to the system. */
-static void drbd_free_pages(struct drbd_conf *mdev, struct page *page, int is_net)
+static void drbd_free_pages(struct drbd_device *mdev, struct page *page, int is_net)
{
atomic_t *a = is_net ? &mdev->pp_in_use_by_net : &mdev->pp_in_use;
int i;
*/
struct drbd_peer_request *
-drbd_alloc_peer_req(struct drbd_conf *mdev, u64 id, sector_t sector,
+drbd_alloc_peer_req(struct drbd_device *mdev, u64 id, sector_t sector,
unsigned int data_size, gfp_t gfp_mask) __must_hold(local)
{
struct drbd_peer_request *peer_req;
return NULL;
}
-void __drbd_free_peer_req(struct drbd_conf *mdev, struct drbd_peer_request *peer_req,
+void __drbd_free_peer_req(struct drbd_device *mdev, struct drbd_peer_request *peer_req,
int is_net)
{
if (peer_req->flags & EE_HAS_DIGEST)
mempool_free(peer_req, drbd_ee_mempool);
}
-int drbd_free_peer_reqs(struct drbd_conf *mdev, struct list_head *list)
+int drbd_free_peer_reqs(struct drbd_device *mdev, struct list_head *list)
{
LIST_HEAD(work_list);
struct drbd_peer_request *peer_req, *t;
/*
* See also comments in _req_mod(,BARRIER_ACKED) and receive_Barrier.
*/
-static int drbd_finish_peer_reqs(struct drbd_conf *mdev)
+static int drbd_finish_peer_reqs(struct drbd_device *mdev)
{
LIST_HEAD(work_list);
LIST_HEAD(reclaimed);
return err;
}
-static void _drbd_wait_ee_list_empty(struct drbd_conf *mdev,
+static void _drbd_wait_ee_list_empty(struct drbd_device *mdev,
struct list_head *head)
{
DEFINE_WAIT(wait);
}
}
-static void drbd_wait_ee_list_empty(struct drbd_conf *mdev,
+static void drbd_wait_ee_list_empty(struct drbd_device *mdev,
struct list_head *head)
{
spin_lock_irq(&mdev->tconn->req_lock);
}
/* Gets called if a connection is established, or if a new minor gets created
in a connection */
-int drbd_connected(struct drbd_conf *mdev)
+int drbd_connected(struct drbd_device *mdev)
{
int err;
static int conn_connect(struct drbd_tconn *tconn)
{
struct drbd_socket sock, msock;
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct net_conf *nc;
int vnr, timeout, h, ok;
bool discard_my_data;
static void drbd_flush(struct drbd_tconn *tconn)
{
int rv;
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
int vnr;
if (tconn->write_ordering >= WO_bdev_flush) {
void drbd_bump_write_ordering(struct drbd_tconn *tconn, enum write_ordering_e wo)
{
struct disk_conf *dc;
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
enum write_ordering_e pwo;
int vnr;
static char *write_ordering_str[] = {
* on certain Xen deployments.
*/
/* TODO allocate from our own bio_set. */
-int drbd_submit_peer_request(struct drbd_conf *mdev,
+int drbd_submit_peer_request(struct drbd_device *mdev,
struct drbd_peer_request *peer_req,
const unsigned rw, const int fault_type)
{
return err;
}
-static void drbd_remove_epoch_entry_interval(struct drbd_conf *mdev,
+static void drbd_remove_epoch_entry_interval(struct drbd_device *mdev,
struct drbd_peer_request *peer_req)
{
struct drbd_interval *i = &peer_req->i;
static void conn_wait_active_ee_empty(struct drbd_tconn *tconn)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
int vnr;
rcu_read_lock();
/* used from receive_RSDataReply (recv_resync_read)
* and from receive_Data */
static struct drbd_peer_request *
-read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector,
+read_in_block(struct drbd_device *mdev, u64 id, sector_t sector,
int data_size) __must_hold(local)
{
const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
/* drbd_drain_block() just takes a data block
* out of the socket input buffer, and discards it.
*/
-static int drbd_drain_block(struct drbd_conf *mdev, int data_size)
+static int drbd_drain_block(struct drbd_device *mdev, int data_size)
{
struct page *page;
int err = 0;
return err;
}
-static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
+static int recv_dless_read(struct drbd_device *mdev, struct drbd_request *req,
sector_t sector, int data_size)
{
struct bio_vec bvec;
{
struct drbd_peer_request *peer_req =
container_of(w, struct drbd_peer_request, w);
- struct drbd_conf *mdev = w->mdev;
+ struct drbd_device *mdev = w->mdev;
sector_t sector = peer_req->i.sector;
int err;
return err;
}
-static int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_size) __releases(local)
+static int recv_resync_read(struct drbd_device *mdev, sector_t sector, int data_size) __releases(local)
{
struct drbd_peer_request *peer_req;
}
static struct drbd_request *
-find_request(struct drbd_conf *mdev, struct rb_root *root, u64 id,
+find_request(struct drbd_device *mdev, struct rb_root *root, u64 id,
sector_t sector, bool missing_ok, const char *func)
{
struct drbd_request *req;
static int receive_DataReply(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct drbd_request *req;
sector_t sector;
int err;
static int receive_RSDataReply(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
sector_t sector;
int err;
struct p_data *p = pi->data;
return err;
}
-static void restart_conflicting_writes(struct drbd_conf *mdev,
+static void restart_conflicting_writes(struct drbd_device *mdev,
sector_t sector, int size)
{
struct drbd_interval *i;
{
struct drbd_peer_request *peer_req =
container_of(w, struct drbd_peer_request, w);
- struct drbd_conf *mdev = w->mdev;
+ struct drbd_device *mdev = w->mdev;
sector_t sector = peer_req->i.sector;
int err = 0, pcmd;
static int e_send_ack(struct drbd_work *w, enum drbd_packet ack)
{
- struct drbd_conf *mdev = w->mdev;
+ struct drbd_device *mdev = w->mdev;
struct drbd_peer_request *peer_req =
container_of(w, struct drbd_peer_request, w);
int err;
return seq_greater(a, b) ? a : b;
}
-static void update_peer_seq(struct drbd_conf *mdev, unsigned int peer_seq)
+static void update_peer_seq(struct drbd_device *mdev, unsigned int peer_seq)
{
unsigned int newest_peer_seq;
}
/* maybe change sync_ee into interval trees as well? */
-static bool overlapping_resync_write(struct drbd_conf *mdev, struct drbd_peer_request *peer_req)
+static bool overlapping_resync_write(struct drbd_device *mdev, struct drbd_peer_request *peer_req)
{
struct drbd_peer_request *rs_req;
bool rv = 0;
*
* returns 0 if we may process the packet,
* -ERESTARTSYS if we were interrupted (by disconnect signal). */
-static int wait_for_and_update_peer_seq(struct drbd_conf *mdev, const u32 peer_seq)
+static int wait_for_and_update_peer_seq(struct drbd_device *mdev, const u32 peer_seq)
{
DEFINE_WAIT(wait);
long timeout;
/* see also bio_flags_to_wire()
* DRBD_REQ_*, because we need to semantically map the flags to data packet
* flags and back. We may replicate to other kernel versions. */
-static unsigned long wire_flags_to_bio(struct drbd_conf *mdev, u32 dpf)
+static unsigned long wire_flags_to_bio(struct drbd_device *mdev, u32 dpf)
{
return (dpf & DP_RW_SYNC ? REQ_SYNC : 0) |
(dpf & DP_FUA ? REQ_FUA : 0) |
(dpf & DP_DISCARD ? REQ_DISCARD : 0);
}
-static void fail_postponed_requests(struct drbd_conf *mdev, sector_t sector,
+static void fail_postponed_requests(struct drbd_device *mdev, sector_t sector,
unsigned int size)
{
struct drbd_interval *i;
}
}
-static int handle_write_conflicts(struct drbd_conf *mdev,
+static int handle_write_conflicts(struct drbd_device *mdev,
struct drbd_peer_request *peer_req)
{
struct drbd_tconn *tconn = mdev->tconn;
/* mirrored write */
static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
sector_t sector;
struct drbd_peer_request *peer_req;
struct p_data *p = pi->data;
* The current sync rate used here uses only the most recent two step marks,
* to have a short time average so we can react faster.
*/
-int drbd_rs_should_slow_down(struct drbd_conf *mdev, sector_t sector)
+int drbd_rs_should_slow_down(struct drbd_device *mdev, sector_t sector)
{
struct gendisk *disk = mdev->ldev->backing_bdev->bd_contains->bd_disk;
unsigned long db, dt, dbdt;
static int receive_DataRequest(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
sector_t sector;
sector_t capacity;
struct drbd_peer_request *peer_req;
return -EIO;
}
-static int drbd_asb_recover_0p(struct drbd_conf *mdev) __must_hold(local)
+static int drbd_asb_recover_0p(struct drbd_device *mdev) __must_hold(local)
{
int self, peer, rv = -100;
unsigned long ch_self, ch_peer;
return rv;
}
-static int drbd_asb_recover_1p(struct drbd_conf *mdev) __must_hold(local)
+static int drbd_asb_recover_1p(struct drbd_device *mdev) __must_hold(local)
{
int hg, rv = -100;
enum drbd_after_sb_p after_sb_1p;
return rv;
}
-static int drbd_asb_recover_2p(struct drbd_conf *mdev) __must_hold(local)
+static int drbd_asb_recover_2p(struct drbd_device *mdev) __must_hold(local)
{
int hg, rv = -100;
enum drbd_after_sb_p after_sb_2p;
return rv;
}
-static void drbd_uuid_dump(struct drbd_conf *mdev, char *text, u64 *uuid,
+static void drbd_uuid_dump(struct drbd_device *mdev, char *text, u64 *uuid,
u64 bits, u64 flags)
{
if (!uuid) {
-1091 requires proto 91
-1096 requires proto 96
*/
-static int drbd_uuid_compare(struct drbd_conf *mdev, int *rule_nr) __must_hold(local)
+static int drbd_uuid_compare(struct drbd_device *mdev, int *rule_nr) __must_hold(local)
{
u64 self, peer;
int i, j;
/* drbd_sync_handshake() returns the new conn state on success, or
CONN_MASK (-1) on failure.
*/
-static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_role peer_role,
+static enum drbd_conns drbd_sync_handshake(struct drbd_device *mdev, enum drbd_role peer_role,
enum drbd_disk_state peer_disk) __must_hold(local)
{
enum drbd_conns rv = C_MASK;
* ERR_PTR(error) if something goes wrong
* or the crypto hash ptr, if it worked out ok. */
static
-struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_conf *mdev,
+struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_device *mdev,
const char *alg, const char *name)
{
struct crypto_hash *tfm;
static int receive_SyncParam(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_rs_param_95 *p;
unsigned int header_size, data_size, exp_max_sz;
struct crypto_hash *verify_tfm = NULL;
}
/* warn if the arguments differ by more than 12.5% */
-static void warn_if_differ_considerably(struct drbd_conf *mdev,
+static void warn_if_differ_considerably(struct drbd_device *mdev,
const char *s, sector_t a, sector_t b)
{
sector_t d;
static int receive_sizes(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_sizes *p = pi->data;
enum determine_dev_size dd = DS_UNCHANGED;
sector_t p_size, p_usize, my_usize;
static int receive_uuids(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_uuids *p = pi->data;
u64 *p_uuid;
int i, updated_uuids = 0;
static int receive_req_state(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_req_state *p = pi->data;
union drbd_state mask, val;
enum drbd_state_rv rv;
static int receive_state(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_state *p = pi->data;
union drbd_state os, ns, peer_state;
enum drbd_disk_state real_peer_disk;
static int receive_sync_uuid(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_rs_uuid *p = pi->data;
mdev = vnr_to_mdev(tconn, pi->vnr);
* code upon failure.
*/
static int
-receive_bitmap_plain(struct drbd_conf *mdev, unsigned int size,
+receive_bitmap_plain(struct drbd_device *mdev, unsigned int size,
unsigned long *p, struct bm_xfer_ctx *c)
{
unsigned int data_size = DRBD_SOCKET_BUFFER_SIZE -
* code upon failure.
*/
static int
-recv_bm_rle_bits(struct drbd_conf *mdev,
+recv_bm_rle_bits(struct drbd_device *mdev,
struct p_compressed_bm *p,
struct bm_xfer_ctx *c,
unsigned int len)
* code upon failure.
*/
static int
-decode_bitmap_c(struct drbd_conf *mdev,
+decode_bitmap_c(struct drbd_device *mdev,
struct p_compressed_bm *p,
struct bm_xfer_ctx *c,
unsigned int len)
return -EIO;
}
-void INFO_bm_xfer_stats(struct drbd_conf *mdev,
+void INFO_bm_xfer_stats(struct drbd_device *mdev,
const char *direction, struct bm_xfer_ctx *c)
{
/* what would it take to transfer it "plaintext" */
returns 0 on failure, 1 if we successfully received it. */
static int receive_bitmap(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct bm_xfer_ctx c;
int err;
static int receive_out_of_sync(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_block_desc *p = pi->data;
mdev = vnr_to_mdev(tconn, pi->vnr);
static void conn_disconnect(struct drbd_tconn *tconn)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
enum drbd_conns oc;
int vnr;
conn_request_state(tconn, NS(conn, C_STANDALONE), CS_VERBOSE | CS_HARD);
}
-static int drbd_disconnected(struct drbd_conf *mdev)
+static int drbd_disconnected(struct drbd_device *mdev)
{
unsigned int i;
static int got_RqSReply(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_req_state_reply *p = pi->data;
int retcode = be32_to_cpu(p->retcode);
static int got_IsInSync(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_block_ack *p = pi->data;
sector_t sector = be64_to_cpu(p->sector);
int blksize = be32_to_cpu(p->blksize);
}
static int
-validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector,
+validate_req_change_req_state(struct drbd_device *mdev, u64 id, sector_t sector,
struct rb_root *root, const char *func,
enum drbd_req_event what, bool missing_ok)
{
static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_block_ack *p = pi->data;
sector_t sector = be64_to_cpu(p->sector);
int blksize = be32_to_cpu(p->blksize);
static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_block_ack *p = pi->data;
sector_t sector = be64_to_cpu(p->sector);
int size = be32_to_cpu(p->blksize);
static int got_NegDReply(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_block_ack *p = pi->data;
sector_t sector = be64_to_cpu(p->sector);
static int got_NegRSDReply(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
sector_t sector;
int size;
struct p_block_ack *p = pi->data;
static int got_BarrierAck(struct drbd_tconn *tconn, struct packet_info *pi)
{
struct p_barrier_ack *p = pi->data;
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
int vnr;
tl_release(tconn, p->barrier, be32_to_cpu(p->set_size));
static int got_OVResult(struct drbd_tconn *tconn, struct packet_info *pi)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
struct p_block_ack *p = pi->data;
struct drbd_work *w;
sector_t sector;
static int tconn_finish_peer_reqs(struct drbd_tconn *tconn)
{
- struct drbd_conf *mdev;
+ struct drbd_device *mdev;
int vnr, not_empty = 0;
do {