aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/drbd/drbd_protocol.h')
-rw-r--r--drivers/block/drbd/drbd_protocol.h77
1 files changed, 74 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_protocol.h b/drivers/block/drbd/drbd_protocol.h
index 129f8c76c9b1..4d296800f706 100644
--- a/drivers/block/drbd/drbd_protocol.h
+++ b/drivers/block/drbd/drbd_protocol.h
@@ -60,6 +60,15 @@ enum drbd_packet {
60 * which is why I chose TRIM here, to disambiguate. */ 60 * which is why I chose TRIM here, to disambiguate. */
61 P_TRIM = 0x31, 61 P_TRIM = 0x31,
62 62
63 /* Only use these two if both support FF_THIN_RESYNC */
64 P_RS_THIN_REQ = 0x32, /* Request a block for resync or reply P_RS_DEALLOCATED */
65 P_RS_DEALLOCATED = 0x33, /* Contains only zeros on sync source node */
66
67 /* REQ_WRITE_SAME.
68 * On a receiving side without REQ_WRITE_SAME,
69 * we may fall back to an opencoded loop instead. */
70 P_WSAME = 0x34,
71
63 P_MAY_IGNORE = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */ 72 P_MAY_IGNORE = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */
64 P_MAX_OPT_CMD = 0x101, 73 P_MAX_OPT_CMD = 0x101,
65 74
@@ -106,8 +115,11 @@ struct p_header100 {
106 u32 pad; 115 u32 pad;
107} __packed; 116} __packed;
108 117
109/* these defines must not be changed without changing the protocol version */ 118/* These defines must not be changed without changing the protocol version.
110#define DP_HARDBARRIER 1 /* depricated */ 119 * New defines may only be introduced together with protocol version bump or
120 * new protocol feature flags.
121 */
122#define DP_HARDBARRIER 1 /* no longer used */
111#define DP_RW_SYNC 2 /* equals REQ_SYNC */ 123#define DP_RW_SYNC 2 /* equals REQ_SYNC */
112#define DP_MAY_SET_IN_SYNC 4 124#define DP_MAY_SET_IN_SYNC 4
113#define DP_UNPLUG 8 /* not used anymore */ 125#define DP_UNPLUG 8 /* not used anymore */
@@ -116,6 +128,7 @@ struct p_header100 {
116#define DP_DISCARD 64 /* equals REQ_DISCARD */ 128#define DP_DISCARD 64 /* equals REQ_DISCARD */
117#define DP_SEND_RECEIVE_ACK 128 /* This is a proto B write request */ 129#define DP_SEND_RECEIVE_ACK 128 /* This is a proto B write request */
118#define DP_SEND_WRITE_ACK 256 /* This is a proto C write request */ 130#define DP_SEND_WRITE_ACK 256 /* This is a proto C write request */
131#define DP_WSAME 512 /* equiv. REQ_WRITE_SAME */
119 132
120struct p_data { 133struct p_data {
121 u64 sector; /* 64 bits sector number */ 134 u64 sector; /* 64 bits sector number */
@@ -129,6 +142,11 @@ struct p_trim {
129 u32 size; /* == bio->bi_size */ 142 u32 size; /* == bio->bi_size */
130} __packed; 143} __packed;
131 144
145struct p_wsame {
146 struct p_data p_data;
147 u32 size; /* == bio->bi_size */
148} __packed;
149
132/* 150/*
133 * commands which share a struct: 151 * commands which share a struct:
134 * p_block_ack: 152 * p_block_ack:
@@ -160,7 +178,23 @@ struct p_block_req {
160 * ReportParams 178 * ReportParams
161 */ 179 */
162 180
163#define FF_TRIM 1 181/* supports TRIM/DISCARD on the "wire" protocol */
182#define DRBD_FF_TRIM 1
183
184/* Detect all-zeros during resync, and rather TRIM/UNMAP/DISCARD those blocks
185 * instead of fully allocate a supposedly thin volume on initial resync */
186#define DRBD_FF_THIN_RESYNC 2
187
188/* supports REQ_WRITE_SAME on the "wire" protocol.
189 * Note: this flag is overloaded,
190 * its presence also
191 * - indicates support for 128 MiB "batch bios",
192 * max discard size of 128 MiB
193 * instead of 4M before that.
194 * - indicates that we exchange additional settings in p_sizes
195 * drbd_send_sizes()/receive_sizes()
196 */
197#define DRBD_FF_WSAME 4
164 198
165struct p_connection_features { 199struct p_connection_features {
166 u32 protocol_min; 200 u32 protocol_min;
@@ -235,6 +269,40 @@ struct p_rs_uuid {
235 u64 uuid; 269 u64 uuid;
236} __packed; 270} __packed;
237 271
272/* optional queue_limits if (agreed_features & DRBD_FF_WSAME)
273 * see also struct queue_limits, as of late 2015 */
274struct o_qlim {
275 /* we don't need it yet, but we may as well communicate it now */
276 u32 physical_block_size;
277
278 /* so the original in struct queue_limits is unsigned short,
279 * but I'd have to put in padding anyways. */
280 u32 logical_block_size;
281
282 /* One incoming bio becomes one DRBD request,
283 * which may be translated to several bio on the receiving side.
284 * We don't need to communicate chunk/boundary/segment ... limits.
285 */
286
287 /* various IO hints may be useful with "diskless client" setups */
288 u32 alignment_offset;
289 u32 io_min;
290 u32 io_opt;
291
292 /* We may need to communicate integrity stuff at some point,
293 * but let's not get ahead of ourselves. */
294
295 /* Backend discard capabilities.
296 * Receiving side uses "blkdev_issue_discard()", no need to communicate
297 * more specifics. If the backend cannot do discards, the DRBD peer
298 * may fall back to blkdev_issue_zeroout().
299 */
300 u8 discard_enabled;
301 u8 discard_zeroes_data;
302 u8 write_same_capable;
303 u8 _pad;
304} __packed;
305
238struct p_sizes { 306struct p_sizes {
239 u64 d_size; /* size of disk */ 307 u64 d_size; /* size of disk */
240 u64 u_size; /* user requested size */ 308 u64 u_size; /* user requested size */
@@ -242,6 +310,9 @@ struct p_sizes {
242 u32 max_bio_size; /* Maximal size of a BIO */ 310 u32 max_bio_size; /* Maximal size of a BIO */
243 u16 queue_order_type; /* not yet implemented in DRBD*/ 311 u16 queue_order_type; /* not yet implemented in DRBD*/
244 u16 dds_flags; /* use enum dds_flags here. */ 312 u16 dds_flags; /* use enum dds_flags here. */
313
314 /* optional queue_limits if (agreed_features & DRBD_FF_WSAME) */
315 struct o_qlim qlim[0];
245} __packed; 316} __packed;
246 317
247struct p_state { 318struct p_state {