Lines Matching +full:wire +full:- +full:sized
1 /* SPDX-License-Identifier: GPL-2.0-only */
7 Copyright (C) 2001-2008, LINBIT Information Technologies GmbH.
8 Copyright (C) 1999-2008, Philipp Reisner <[email protected]>.
9 Copyright (C) 2002-2008, Lars Ellenberg <[email protected]>.
29 #include <linux/backing-dev.h>
63 #define ID_SYNCER (-1ULL)
125 /* statistics; index: (h->command == P_BITMAP) */
143 c->word_offset = c->bit_offset >> 6; in bm_xfer_ctx_bit_to_word_offset()
145 c->word_offset = c->bit_offset >> 5; in bm_xfer_ctx_bit_to_word_offset()
146 c->word_offset &= ~(1UL); in bm_xfer_ctx_bit_to_word_offset()
178 * --lge */ in get_t_state()
181 return thi->t_state; in get_t_state()
336 ((peer_req)->opf & REQ_OP_MASK)
342 * non-atomic modification to ee->flags is ok.
350 /* explicit zero-out requested, or
370 /* The peer wants a write ACK for this (wire proto C) */
413 USE_DEGR_WFC_T, /* degr-wfc-timeout instead of wfc-timeout. */
428 FORCE_DETACH, /* Force-detach from local disk, aborting any pending local IO */
434 AHEAD_TO_SYNC_SOURCE, /* Ahead -> SyncSource queued */
439 FLUSH_PENDING, /* if set, device->flush_jif is when we submitted that flush
443 GOING_DISKLESS, /* Disk is being detached, because of io-error, or admin request. */
468 * and still allow all non-bulk operations */
476 * requires sending of "out-of-sync" information, though. */
512 /* cached value of bdev->disk_conf->meta_dev_idx (see below) */
527 struct disk_conf *disk_conf; /* RCU, for updates: resource->conf_update */
593 struct mutex conf_update; /* mutex for ready-copy-update of net_conf and disk_conf */
648 …pto_shash *integrity_tfm; /* checksums we compute, updates protected by connection->data->mutex */
672 * protected by resource->req_lock */
697 * with req->epoch == current_epoch_nr.
708 has_net_conf = rcu_dereference(connection->net_conf); in has_net_conf()
721 __update_timing_details(c->w_timing_details, &c->w_cb_nr, cb, __func__ , __LINE__ )
723 __update_timing_details(c->r_timing_details, &c->r_cb_nr, cb, __func__ , __LINE__ )
729 /* protected by ..->resource->req_lock */
796 atomic_t ap_pending_cnt; /* AP data packets on the wire, ack expected */
797 atomic_t rs_pending_cnt; /* RS request/data packets on the wire */
825 /* block not up-to-date at mark [unit BM_BLOCK_SIZE] */
840 /* size of out-of-sync range in sectors. */
861 struct list_head net_ee; /* zero-copy network send in progress */
881 …struct mutex *state_mutex; /* either own_state_mutex or first_peer_device(device)->connection->cst…
889 …struct fifo_buffer *rs_plan_s; /* correction values of resync planer (RCU, connection->conn_update…
896 * are deferred to this single-threaded work queue */
902 struct list_head list; /* on device->pending_bitmap_io */;
920 #define VOLUME_UNSPECIFIED (-1U)
944 return list_first_entry_or_null(&device->peer_devices, struct drbd_peer_device, peer_devices); in first_peer_device()
950 return idr_find(&connection->peer_devices, volume_number); in conn_peer_device()
963 list_for_each_entry(connection, &resource->connections, connections)
966 list_for_each_entry_rcu(connection, &resource->connections, connections)
969 list_for_each_entry_safe(connection, tmp, &resource->connections, connections)
972 list_for_each_entry(peer_device, &device->peer_devices, peer_devices)
975 list_for_each_entry_rcu(peer_device, &device->peer_devices, peer_devices)
978 list_for_each_entry_safe(peer_device, tmp, &device->peer_devices, peer_devices)
982 return device->minor; in device_to_minor()
1089 * |----------- md_size_sect ------------------|
1093 * ==> bitmap sectors = md_size_sect - bm_offset
1099 * |----------- md_size_sect ------------------|
1102 * | bm_offset = al_offset - Y |
1103 * ==> bitmap sectors = Y = al_offset - bm_offset
1109 * which are written in a ring-buffer, or striped ring-buffer like fashion,
1126 * variables at create-md time (or even re-configurable at runtime?).
1140 #define AL_CONTEXT_PER_TRANSACTION 919 // (4096 - 36 - 6*64)/4
1155 /* 16MB sized 'bitmap extent' to track syncer usage */
1192 #define BM_SECT_TO_BIT(x) ((x)>>(BM_BLOCK_SHIFT-9))
1193 #define BM_BIT_TO_SECT(x) ((sector_t)(x)<<(BM_BLOCK_SHIFT-9))
1197 #define Bit2KB(bits) ((bits)<<(BM_BLOCK_SHIFT-10))
1201 #define BM_SECT_TO_EXT(x) ((x)>>(BM_EXT_SHIFT-9))
1202 #define BM_BIT_TO_EXT(x) ((x) >> (BM_EXT_SHIFT - BM_BLOCK_SHIFT))
1205 #define BM_EXT_TO_SECT(x) ((sector_t)(x) << (BM_EXT_SHIFT-9))
1209 #define BM_BITS_PER_EXT (1UL << (BM_EXT_SHIFT - BM_BLOCK_SHIFT))
1211 #define BM_BLOCKS_PER_BM_EXT_MASK (BM_BITS_PER_EXT - 1)
1215 #define AL_EXT_PER_BM_SECT (1 << (BM_EXT_SHIFT - AL_EXTENT_SHIFT))
1222 * bit 0 bit 37 bit 38 bit (512*8)-1
1224 * sect. 0 `296 `304 ^(512*8*8)-1
1232 /* we have a certain meta data variant that has a fixed on-disk size of 128
1238 ((MD_128MB_SECT - MD_32kB_SECT - MD_4kB_SECT) * (1LL<<(BM_EXT_SHIFT-9)))
1254 * Since we may live in a mixed-platform cluster,
1350 /* We also need a standard (emergency-reserve backed) page pool
1397 DS_ERROR_SHRINK = -3,
1398 DS_ERROR_SPACE_MD = -2,
1399 DS_ERROR = -1,
1443 struct drbd_device *device = peer_device->device; in ov_out_of_sync_print()
1445 if (device->ov_last_oos_size) { in ov_out_of_sync_print()
1447 (unsigned long long)device->ov_last_oos_start, in ov_out_of_sync_print()
1448 (unsigned long)device->ov_last_oos_size); in ov_out_of_sync_print()
1450 device->ov_last_oos_size = 0; in ov_out_of_sync_print()
1509 if (!bio->bi_bdev) { in drbd_submit_bio_noacct()
1510 drbd_err(device, "drbd_submit_bio_noacct: bio->bi_bdev == NULL\n"); in drbd_submit_bio_noacct()
1511 bio->bi_status = BLK_STS_IOERR; in drbd_submit_bio_noacct()
1615 struct page *page = peer_req->pages; in drbd_peer_req_has_active_page()
1625 struct drbd_resource *resource = device->resource; in drbd_read_state()
1628 rv.i = device->state.i; in drbd_read_state()
1629 rv.susp = resource->susp; in drbd_read_state()
1630 rv.susp_nod = resource->susp_nod; in drbd_read_state()
1631 rv.susp_fen = resource->susp_fen; in drbd_read_state()
1651 ep = rcu_dereference(device->ldev->disk_conf)->on_io_error; in __drbd_chk_io_error_()
1658 if (device->state.disk > D_INCONSISTENT) in __drbd_chk_io_error_()
1671 * blocks, which triggers block re-allocation in lower layers. in __drbd_chk_io_error_()
1676 * Force-detach is not really an IO error, but rather a in __drbd_chk_io_error_()
1685 set_bit(WAS_IO_ERROR, &device->flags); in __drbd_chk_io_error_()
1687 set_bit(WAS_READ_ERROR, &device->flags); in __drbd_chk_io_error_()
1689 set_bit(FORCE_DETACH, &device->flags); in __drbd_chk_io_error_()
1690 if (device->state.disk > D_FAILED) { in __drbd_chk_io_error_()
1713 spin_lock_irqsave(&device->resource->req_lock, flags); in drbd_chk_io_error_()
1715 spin_unlock_irqrestore(&device->resource->req_lock, flags); in drbd_chk_io_error_()
1721 * drbd_md_first_sector() - Returns the first sector number of the meta data area
1729 switch (bdev->md.meta_dev_idx) { in drbd_md_first_sector()
1732 return bdev->md.md_offset + bdev->md.bm_offset; in drbd_md_first_sector()
1735 return bdev->md.md_offset; in drbd_md_first_sector()
1740 * drbd_md_last_sector() - Return the last sector number of the meta data area
1745 switch (bdev->md.meta_dev_idx) { in drbd_md_last_sector()
1748 return bdev->md.md_offset + MD_4kB_SECT -1; in drbd_md_last_sector()
1751 return bdev->md.md_offset + bdev->md.md_size_sect -1; in drbd_md_last_sector()
1762 * drbd_get_max_capacity() - Returns the capacity we announce to out peer
1773 switch (bdev->md.meta_dev_idx) { in drbd_get_max_capacity()
1776 s = drbd_get_capacity(bdev->backing_bdev) in drbd_get_max_capacity()
1783 drbd_get_capacity(bdev->backing_bdev)); in drbd_get_max_capacity()
1786 BM_EXT_TO_SECT(bdev->md.md_size_sect in drbd_get_max_capacity()
1787 - bdev->md.bm_offset)); in drbd_get_max_capacity()
1791 drbd_get_capacity(bdev->backing_bdev)); in drbd_get_max_capacity()
1797 * drbd_md_ss() - Return the sector number of our meta data super block
1802 const int meta_dev_idx = bdev->md.meta_dev_idx; in drbd_md_ss()
1811 return (drbd_get_capacity(bdev->backing_bdev) & ~7ULL) - 8; in drbd_md_ss()
1814 return MD_128MB_SECT * bdev->md.meta_dev_idx; in drbd_md_ss()
1821 spin_lock_irqsave(&q->q_lock, flags); in drbd_queue_work()
1822 list_add_tail(&w->list, &q->q); in drbd_queue_work()
1823 spin_unlock_irqrestore(&q->q_lock, flags); in drbd_queue_work()
1824 wake_up(&q->q_wait); in drbd_queue_work()
1831 spin_lock_irqsave(&q->q_lock, flags); in drbd_queue_work_if_unqueued()
1832 if (list_empty_careful(&w->list)) in drbd_queue_work_if_unqueued()
1833 list_add_tail(&w->list, &q->q); in drbd_queue_work_if_unqueued()
1834 spin_unlock_irqrestore(&q->q_lock, flags); in drbd_queue_work_if_unqueued()
1835 wake_up(&q->q_wait); in drbd_queue_work_if_unqueued()
1841 if (!test_and_set_bit(work_bit, &device->flags)) { in drbd_device_post_work()
1843 first_peer_device(device)->connection; in drbd_device_post_work()
1844 struct drbd_work_queue *q = &connection->sender_work; in drbd_device_post_work()
1845 if (!test_and_set_bit(DEVICE_WORK_PENDING, &connection->flags)) in drbd_device_post_work()
1846 wake_up(&q->q_wait); in drbd_device_post_work()
1853 * so it can change its sk_rcvtimeo from idle- to ping-timeout,
1858 struct task_struct *task = connection->ack_receiver.task; in wake_ack_receiver()
1859 if (task && get_t_state(&connection->ack_receiver) == RUNNING) in wake_ack_receiver()
1865 set_bit(SEND_PING, &connection->flags); in request_ping()
1906 * (drbd_make_request_common; recovery path on read io-error)
1922 atomic_inc(&device->ap_pending_cnt); in inc_ap_pending()
1928 int ap_pending_cnt = atomic_dec_return(&device->ap_pending_cnt); in __dec_ap_pending()
1931 wake_up(&device->misc_wait); in __dec_ap_pending()
1935 /* counts how many resync-related answers we still expect from the peer
1943 atomic_inc(&peer_device->device->rs_pending_cnt); in inc_rs_pending()
1950 return atomic_dec_return(&peer_device->device->rs_pending_cnt); in __dec_rs_pending()
1964 atomic_inc(&device->unacked_cnt); in inc_unacked()
1970 return atomic_dec_return(&device->unacked_cnt); in __dec_unacked()
1976 return atomic_sub_return(n, &device->unacked_cnt); in __sub_unacked()
1998 * get_ldev() - Increase the ref count on device->ldev. Returns 0 if there is no ldev
2002 * You have to call put_ldev() when finished working with device->ldev.
2011 enum drbd_disk_state disk_state = device->state.disk; in put_ldev()
2016 int i = atomic_dec_return(&device->local_cnt); in put_ldev()
2029 if (!test_and_set_bit(GOING_DISKLESS, &device->flags)) in put_ldev()
2031 wake_up(&device->misc_wait); in put_ldev()
2041 if (device->state.disk == D_DISKLESS) in _get_ldev_if_state()
2044 atomic_inc(&device->local_cnt); in _get_ldev_if_state()
2045 io_allowed = (device->state.disk >= mins); in _get_ldev_if_state()
2054 /* this throttles on-the-fly application requests
2056 * maybe re-implement using semaphores? */
2063 nc = rcu_dereference(first_peer_device(device)->connection->net_conf); in drbd_get_max_buffers()
2064 mxb = nc ? nc->max_buffers : 1000000; /* arbitrary limit on open requests */ in drbd_get_max_buffers()
2072 union drbd_dev_state s = device->state; in drbd_state_is_stable()
2106 if (first_peer_device(device)->connection->agreed_pro_version < 96) in drbd_state_is_stable()
2142 struct drbd_resource *resource = device->resource; in drbd_suspended()
2144 return resource->susp || resource->susp_fen || resource->susp_nod; in drbd_suspended()
2153 if (atomic_read(&device->suspend_cnt)) in may_inc_ap_bio()
2166 if (atomic_read(&device->ap_bio_cnt) > mxb) in may_inc_ap_bio()
2168 if (test_bit(BITMAP_IO, &device->flags)) in may_inc_ap_bio()
2177 spin_lock_irq(&device->resource->req_lock); in inc_ap_bio_cond()
2180 atomic_inc(&device->ap_bio_cnt); in inc_ap_bio_cond()
2181 spin_unlock_irq(&device->resource->req_lock); in inc_ap_bio_cond()
2196 wait_event(device->misc_wait, inc_ap_bio_cond(device)); in inc_ap_bio()
2202 int ap_bio = atomic_dec_return(&device->ap_bio_cnt); in dec_ap_bio()
2206 if (ap_bio == 0 && test_bit(BITMAP_IO, &device->flags)) { in dec_ap_bio()
2207 if (!test_and_set_bit(BITMAP_IO_QUEUED, &device->flags)) in dec_ap_bio()
2208 drbd_queue_work(&first_peer_device(device)-> in dec_ap_bio()
2209 connection->sender_work, in dec_ap_bio()
2210 &device->bm_io_work.w); in dec_ap_bio()
2217 wake_up(&device->misc_wait); in dec_ap_bio()
2222 return first_peer_device(device)->connection->agreed_pro_version >= 97 && in verify_can_do_stop_sector()
2223 first_peer_device(device)->connection->agreed_pro_version != 100; in verify_can_do_stop_sector()
2228 int changed = device->ed_uuid != val; in drbd_set_ed_uuid()
2229 device->ed_uuid = val; in drbd_set_ed_uuid()
2245 return list_first_entry_or_null(&resource->connections, in first_connection()