Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | drbd.h |
| 3 | Kernel module for 2.6.x Kernels |
| 4 | |
| 5 | This file is part of DRBD by Philipp Reisner and Lars Ellenberg. |
| 6 | |
| 7 | Copyright (C) 2001-2008, LINBIT Information Technologies GmbH. |
| 8 | Copyright (C) 2001-2008, Philipp Reisner <philipp.reisner@linbit.com>. |
| 9 | Copyright (C) 2001-2008, Lars Ellenberg <lars.ellenberg@linbit.com>. |
| 10 | |
| 11 | drbd is free software; you can redistribute it and/or modify |
| 12 | it under the terms of the GNU General Public License as published by |
| 13 | the Free Software Foundation; either version 2, or (at your option) |
| 14 | any later version. |
| 15 | |
| 16 | drbd is distributed in the hope that it will be useful, |
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | GNU General Public License for more details. |
| 20 | |
| 21 | You should have received a copy of the GNU General Public License |
| 22 | along with drbd; see the file COPYING. If not, write to |
| 23 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | |
| 25 | */ |
| 26 | #ifndef DRBD_H |
| 27 | #define DRBD_H |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 28 | #include <asm/types.h> |
| 29 | |
| 30 | #ifdef __KERNEL__ |
| 31 | #include <linux/types.h> |
| 32 | #include <asm/byteorder.h> |
| 33 | #else |
| 34 | #include <sys/types.h> |
| 35 | #include <sys/wait.h> |
| 36 | #include <limits.h> |
| 37 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 38 | /* Although the Linux source code makes a difference between |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 39 | generic endianness and the bitfields' endianness, there is no |
Bart Van Assche | 24c4830 | 2011-05-21 18:32:29 +0200 | [diff] [blame] | 40 | architecture as of Linux-2.6.24-rc4 where the bitfields' endianness |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 41 | does not match the generic endianness. */ |
| 42 | |
| 43 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 44 | #define __LITTLE_ENDIAN_BITFIELD |
| 45 | #elif __BYTE_ORDER == __BIG_ENDIAN |
| 46 | #define __BIG_ENDIAN_BITFIELD |
| 47 | #else |
| 48 | # error "sorry, weird endianness on this box" |
| 49 | #endif |
| 50 | |
| 51 | #endif |
| 52 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 53 | extern const char *drbd_buildtag(void); |
Lars Ellenberg | 1b57e66 | 2016-06-14 00:26:39 +0200 | [diff] [blame] | 54 | #define REL_VERSION "8.4.7" |
Philipp Reisner | 328e0f12 | 2012-10-19 14:37:47 +0200 | [diff] [blame] | 55 | #define API_VERSION 1 |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 56 | #define PRO_VERSION_MIN 86 |
Lars Ellenberg | 58ffa58 | 2012-07-26 14:09:49 +0200 | [diff] [blame] | 57 | #define PRO_VERSION_MAX 101 |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 58 | |
| 59 | |
| 60 | enum drbd_io_error_p { |
| 61 | EP_PASS_ON, /* FIXME should the better be named "Ignore"? */ |
| 62 | EP_CALL_HELPER, |
| 63 | EP_DETACH |
| 64 | }; |
| 65 | |
| 66 | enum drbd_fencing_p { |
Philipp Reisner | cb70345 | 2011-03-24 11:03:07 +0100 | [diff] [blame] | 67 | FP_NOT_AVAIL = -1, /* Not a policy */ |
| 68 | FP_DONT_CARE = 0, |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 69 | FP_RESOURCE, |
| 70 | FP_STONITH |
| 71 | }; |
| 72 | |
| 73 | enum drbd_disconnect_p { |
| 74 | DP_RECONNECT, |
| 75 | DP_DROP_NET_CONF, |
| 76 | DP_FREEZE_IO |
| 77 | }; |
| 78 | |
| 79 | enum drbd_after_sb_p { |
| 80 | ASB_DISCONNECT, |
| 81 | ASB_DISCARD_YOUNGER_PRI, |
| 82 | ASB_DISCARD_OLDER_PRI, |
| 83 | ASB_DISCARD_ZERO_CHG, |
| 84 | ASB_DISCARD_LEAST_CHG, |
| 85 | ASB_DISCARD_LOCAL, |
| 86 | ASB_DISCARD_REMOTE, |
| 87 | ASB_CONSENSUS, |
| 88 | ASB_DISCARD_SECONDARY, |
| 89 | ASB_CALL_HELPER, |
| 90 | ASB_VIOLENTLY |
| 91 | }; |
| 92 | |
Philipp Reisner | 265be2d | 2010-05-31 10:14:17 +0200 | [diff] [blame] | 93 | enum drbd_on_no_data { |
| 94 | OND_IO_ERROR, |
| 95 | OND_SUSPEND_IO |
| 96 | }; |
| 97 | |
Philipp Reisner | 422028b | 2010-10-27 11:12:07 +0200 | [diff] [blame] | 98 | enum drbd_on_congestion { |
| 99 | OC_BLOCK, |
| 100 | OC_PULL_AHEAD, |
| 101 | OC_DISCONNECT, |
| 102 | }; |
| 103 | |
Philipp Reisner | 380207d | 2011-11-11 12:31:20 +0100 | [diff] [blame] | 104 | enum drbd_read_balancing { |
| 105 | RB_PREFER_LOCAL, |
| 106 | RB_PREFER_REMOTE, |
| 107 | RB_ROUND_ROBIN, |
| 108 | RB_LEAST_PENDING, |
| 109 | RB_CONGESTED_REMOTE, |
Philipp Reisner | d60de03 | 2011-11-17 10:12:31 +0100 | [diff] [blame] | 110 | RB_32K_STRIPING, |
| 111 | RB_64K_STRIPING, |
| 112 | RB_128K_STRIPING, |
| 113 | RB_256K_STRIPING, |
| 114 | RB_512K_STRIPING, |
| 115 | RB_1M_STRIPING, |
Philipp Reisner | 380207d | 2011-11-11 12:31:20 +0100 | [diff] [blame] | 116 | }; |
| 117 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 118 | /* KEEP the order, do not delete or insert. Only append. */ |
Andreas Gruenbacher | 116676c | 2010-12-08 13:33:11 +0100 | [diff] [blame] | 119 | enum drbd_ret_code { |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 120 | ERR_CODE_BASE = 100, |
| 121 | NO_ERROR = 101, |
| 122 | ERR_LOCAL_ADDR = 102, |
| 123 | ERR_PEER_ADDR = 103, |
| 124 | ERR_OPEN_DISK = 104, |
| 125 | ERR_OPEN_MD_DISK = 105, |
| 126 | ERR_DISK_NOT_BDEV = 107, |
| 127 | ERR_MD_NOT_BDEV = 108, |
Lars Ellenberg | 67b58bf | 2011-06-06 15:36:04 +0200 | [diff] [blame] | 128 | ERR_DISK_TOO_SMALL = 111, |
| 129 | ERR_MD_DISK_TOO_SMALL = 112, |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 130 | ERR_BDCLAIM_DISK = 114, |
| 131 | ERR_BDCLAIM_MD_DISK = 115, |
| 132 | ERR_MD_IDX_INVALID = 116, |
| 133 | ERR_IO_MD_DISK = 118, |
| 134 | ERR_MD_INVALID = 119, |
| 135 | ERR_AUTH_ALG = 120, |
| 136 | ERR_AUTH_ALG_ND = 121, |
| 137 | ERR_NOMEM = 122, |
Lars Ellenberg | eb12010 | 2012-08-01 12:46:20 +0200 | [diff] [blame] | 138 | ERR_DISCARD_IMPOSSIBLE = 123, |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 139 | ERR_DISK_CONFIGURED = 124, |
| 140 | ERR_NET_CONFIGURED = 125, |
| 141 | ERR_MANDATORY_TAG = 126, |
| 142 | ERR_MINOR_INVALID = 127, |
| 143 | ERR_INTR = 129, /* EINTR */ |
| 144 | ERR_RESIZE_RESYNC = 130, |
| 145 | ERR_NO_PRIMARY = 131, |
Andreas Gruenbacher | 95f8efd | 2011-05-12 11:15:34 +0200 | [diff] [blame] | 146 | ERR_RESYNC_AFTER = 132, |
| 147 | ERR_RESYNC_AFTER_CYCLE = 133, |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 148 | ERR_PAUSE_IS_SET = 134, |
| 149 | ERR_PAUSE_IS_CLEAR = 135, |
| 150 | ERR_PACKET_NR = 137, |
| 151 | ERR_NO_DISK = 138, |
| 152 | ERR_NOT_PROTO_C = 139, |
| 153 | ERR_NOMEM_BITMAP = 140, |
| 154 | ERR_INTEGRITY_ALG = 141, /* DRBD 8.2 only */ |
| 155 | ERR_INTEGRITY_ALG_ND = 142, /* DRBD 8.2 only */ |
| 156 | ERR_CPU_MASK_PARSE = 143, /* DRBD 8.2 only */ |
| 157 | ERR_CSUMS_ALG = 144, /* DRBD 8.2 only */ |
| 158 | ERR_CSUMS_ALG_ND = 145, /* DRBD 8.2 only */ |
| 159 | ERR_VERIFY_ALG = 146, /* DRBD 8.2 only */ |
| 160 | ERR_VERIFY_ALG_ND = 147, /* DRBD 8.2 only */ |
| 161 | ERR_CSUMS_RESYNC_RUNNING= 148, /* DRBD 8.2 only */ |
| 162 | ERR_VERIFY_RUNNING = 149, /* DRBD 8.2 only */ |
| 163 | ERR_DATA_NOT_CURRENT = 150, |
| 164 | ERR_CONNECTED = 151, /* DRBD 8.3 only */ |
Philipp Reisner | 9f5180e | 2009-10-06 09:30:14 +0200 | [diff] [blame] | 165 | ERR_PERM = 152, |
Philipp Reisner | 6495d2c | 2010-03-24 16:07:04 +0100 | [diff] [blame] | 166 | ERR_NEED_APV_93 = 153, |
Philipp Reisner | 47ff2d0 | 2010-06-18 13:56:57 +0200 | [diff] [blame] | 167 | ERR_STONITH_AND_PROT_A = 154, |
Philipp Reisner | 422028b | 2010-10-27 11:12:07 +0200 | [diff] [blame] | 168 | ERR_CONG_NOT_PROTO_A = 155, |
Philipp Reisner | cd88d03 | 2011-01-20 11:46:41 +0100 | [diff] [blame] | 169 | ERR_PIC_AFTER_DEP = 156, |
| 170 | ERR_PIC_PEER_DEP = 157, |
Andreas Gruenbacher | 789c1b6 | 2011-06-06 16:16:44 +0200 | [diff] [blame] | 171 | ERR_RES_NOT_KNOWN = 158, |
| 172 | ERR_RES_IN_USE = 159, |
Philipp Reisner | 774b305 | 2011-02-22 02:07:03 -0500 | [diff] [blame] | 173 | ERR_MINOR_CONFIGURED = 160, |
Andreas Gruenbacher | 179e20b8 | 2014-11-10 17:21:09 +0100 | [diff] [blame] | 174 | ERR_MINOR_OR_VOLUME_EXISTS = 161, |
Lars Ellenberg | 3b98c0c | 2011-03-07 12:49:34 +0100 | [diff] [blame] | 175 | ERR_INVALID_REQUEST = 162, |
Philipp Reisner | b032b6f | 2011-04-13 18:16:10 -0700 | [diff] [blame] | 176 | ERR_NEED_APV_100 = 163, |
Philipp Reisner | dcb20d1 | 2011-05-16 14:30:24 +0200 | [diff] [blame] | 177 | ERR_NEED_ALLOW_TWO_PRI = 164, |
Lars Ellenberg | d5d7ebd | 2011-07-05 20:59:26 +0200 | [diff] [blame] | 178 | ERR_MD_UNCLEAN = 165, |
Philipp Reisner | d752b26 | 2013-06-25 16:50:08 +0200 | [diff] [blame] | 179 | ERR_MD_LAYOUT_CONNECTED = 166, |
| 180 | ERR_MD_LAYOUT_TOO_BIG = 167, |
| 181 | ERR_MD_LAYOUT_TOO_SMALL = 168, |
| 182 | ERR_MD_LAYOUT_NO_FIT = 169, |
| 183 | ERR_IMPLICIT_SHRINK = 170, |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 184 | /* insert new ones above this line */ |
| 185 | AFTER_LAST_ERR_CODE |
| 186 | }; |
| 187 | |
| 188 | #define DRBD_PROT_A 1 |
| 189 | #define DRBD_PROT_B 2 |
| 190 | #define DRBD_PROT_C 3 |
| 191 | |
| 192 | enum drbd_role { |
| 193 | R_UNKNOWN = 0, |
| 194 | R_PRIMARY = 1, /* role */ |
| 195 | R_SECONDARY = 2, /* role */ |
| 196 | R_MASK = 3, |
| 197 | }; |
| 198 | |
| 199 | /* The order of these constants is important. |
| 200 | * The lower ones (<C_WF_REPORT_PARAMS) indicate |
| 201 | * that there is no socket! |
| 202 | * >=C_WF_REPORT_PARAMS ==> There is a socket |
| 203 | */ |
| 204 | enum drbd_conns { |
| 205 | C_STANDALONE, |
| 206 | C_DISCONNECTING, /* Temporal state on the way to StandAlone. */ |
| 207 | C_UNCONNECTED, /* >= C_UNCONNECTED -> inc_net() succeeds */ |
| 208 | |
| 209 | /* These temporal states are all used on the way |
| 210 | * from >= C_CONNECTED to Unconnected. |
| 211 | * The 'disconnect reason' states |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 212 | * I do not allow to change between them. */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 213 | C_TIMEOUT, |
| 214 | C_BROKEN_PIPE, |
| 215 | C_NETWORK_FAILURE, |
| 216 | C_PROTOCOL_ERROR, |
| 217 | C_TEAR_DOWN, |
| 218 | |
| 219 | C_WF_CONNECTION, |
| 220 | C_WF_REPORT_PARAMS, /* we have a socket */ |
| 221 | C_CONNECTED, /* we have introduced each other */ |
| 222 | C_STARTING_SYNC_S, /* starting full sync by admin request. */ |
Bart Van Assche | 24c4830 | 2011-05-21 18:32:29 +0200 | [diff] [blame] | 223 | C_STARTING_SYNC_T, /* starting full sync by admin request. */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 224 | C_WF_BITMAP_S, |
| 225 | C_WF_BITMAP_T, |
| 226 | C_WF_SYNC_UUID, |
| 227 | |
| 228 | /* All SyncStates are tested with this comparison |
| 229 | * xx >= C_SYNC_SOURCE && xx <= C_PAUSED_SYNC_T */ |
| 230 | C_SYNC_SOURCE, |
| 231 | C_SYNC_TARGET, |
| 232 | C_VERIFY_S, |
| 233 | C_VERIFY_T, |
| 234 | C_PAUSED_SYNC_S, |
| 235 | C_PAUSED_SYNC_T, |
Philipp Reisner | 6753171 | 2010-10-27 12:21:30 +0200 | [diff] [blame] | 236 | |
| 237 | C_AHEAD, |
| 238 | C_BEHIND, |
| 239 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 240 | C_MASK = 31 |
| 241 | }; |
| 242 | |
| 243 | enum drbd_disk_state { |
| 244 | D_DISKLESS, |
| 245 | D_ATTACHING, /* In the process of reading the meta-data */ |
| 246 | D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */ |
Philipp Reisner | 8fe39aa | 2013-11-22 13:22:13 +0100 | [diff] [blame] | 247 | /* when >= D_FAILED it is legal to access mdev->ldev */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 248 | D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */ |
| 249 | D_INCONSISTENT, |
| 250 | D_OUTDATED, |
| 251 | D_UNKNOWN, /* Only used for the peer, never for myself */ |
| 252 | D_CONSISTENT, /* Might be D_OUTDATED, might be D_UP_TO_DATE ... */ |
| 253 | D_UP_TO_DATE, /* Only this disk state allows applications' IO ! */ |
| 254 | D_MASK = 15 |
| 255 | }; |
| 256 | |
| 257 | union drbd_state { |
| 258 | /* According to gcc's docs is the ... |
| 259 | * The order of allocation of bit-fields within a unit (C90 6.5.2.1, C99 6.7.2.1). |
| 260 | * Determined by ABI. |
| 261 | * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com> |
| 262 | * even though we transmit as "cpu_to_be32(state)", |
| 263 | * the offsets of the bitfields still need to be swapped |
Bart Van Assche | 24c4830 | 2011-05-21 18:32:29 +0200 | [diff] [blame] | 264 | * on different endianness. |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 265 | */ |
| 266 | struct { |
| 267 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 268 | unsigned role:2 ; /* 3/4 primary/secondary/unknown */ |
| 269 | unsigned peer:2 ; /* 3/4 primary/secondary/unknown */ |
| 270 | unsigned conn:5 ; /* 17/32 cstates */ |
| 271 | unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ |
| 272 | unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ |
Philipp Reisner | fb22c40 | 2010-09-08 23:20:21 +0200 | [diff] [blame] | 273 | unsigned susp:1 ; /* 2/2 IO suspended no/yes (by user) */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 274 | unsigned aftr_isp:1 ; /* isp .. imposed sync pause */ |
| 275 | unsigned peer_isp:1 ; |
| 276 | unsigned user_isp:1 ; |
Philipp Reisner | fb22c40 | 2010-09-08 23:20:21 +0200 | [diff] [blame] | 277 | unsigned susp_nod:1 ; /* IO suspended because no data */ |
| 278 | unsigned susp_fen:1 ; /* IO suspended because fence peer handler runs*/ |
| 279 | unsigned _pad:9; /* 0 unused */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 280 | #elif defined(__BIG_ENDIAN_BITFIELD) |
Philipp Reisner | fb22c40 | 2010-09-08 23:20:21 +0200 | [diff] [blame] | 281 | unsigned _pad:9; |
| 282 | unsigned susp_fen:1 ; |
| 283 | unsigned susp_nod:1 ; |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 284 | unsigned user_isp:1 ; |
| 285 | unsigned peer_isp:1 ; |
| 286 | unsigned aftr_isp:1 ; /* isp .. imposed sync pause */ |
| 287 | unsigned susp:1 ; /* 2/2 IO suspended no/yes */ |
| 288 | unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ |
| 289 | unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */ |
| 290 | unsigned conn:5 ; /* 17/32 cstates */ |
| 291 | unsigned peer:2 ; /* 3/4 primary/secondary/unknown */ |
| 292 | unsigned role:2 ; /* 3/4 primary/secondary/unknown */ |
| 293 | #else |
Bart Van Assche | 24c4830 | 2011-05-21 18:32:29 +0200 | [diff] [blame] | 294 | # error "this endianness is not supported" |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 295 | #endif |
| 296 | }; |
| 297 | unsigned int i; |
| 298 | }; |
| 299 | |
Andreas Gruenbacher | c8b3256 | 2010-12-08 01:06:16 +0100 | [diff] [blame] | 300 | enum drbd_state_rv { |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 301 | SS_CW_NO_NEED = 4, |
| 302 | SS_CW_SUCCESS = 3, |
| 303 | SS_NOTHING_TO_DO = 2, |
| 304 | SS_SUCCESS = 1, |
| 305 | SS_UNKNOWN_ERROR = 0, /* Used to sleep longer in _drbd_request_state */ |
| 306 | SS_TWO_PRIMARIES = -1, |
| 307 | SS_NO_UP_TO_DATE_DISK = -2, |
| 308 | SS_NO_LOCAL_DISK = -4, |
| 309 | SS_NO_REMOTE_DISK = -5, |
| 310 | SS_CONNECTED_OUTDATES = -6, |
| 311 | SS_PRIMARY_NOP = -7, |
| 312 | SS_RESYNC_RUNNING = -8, |
| 313 | SS_ALREADY_STANDALONE = -9, |
| 314 | SS_CW_FAILED_BY_PEER = -10, |
| 315 | SS_IS_DISKLESS = -11, |
| 316 | SS_DEVICE_IN_USE = -12, |
| 317 | SS_NO_NET_CONFIG = -13, |
| 318 | SS_NO_VERIFY_ALG = -14, /* drbd-8.2 only */ |
| 319 | SS_NEED_CONNECTION = -15, /* drbd-8.2 only */ |
| 320 | SS_LOWER_THAN_OUTDATED = -16, |
| 321 | SS_NOT_SUPPORTED = -17, /* drbd-8.2 only */ |
| 322 | SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ |
| 323 | SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ |
Philipp Reisner | 047e95e2 | 2011-03-16 14:43:36 +0100 | [diff] [blame] | 324 | SS_O_VOL_PEER_PRI = -20, |
Philipp Reisner | 2bd5ed5 | 2013-03-27 14:08:40 +0100 | [diff] [blame] | 325 | SS_OUTDATE_WO_CONN = -21, |
| 326 | SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 327 | }; |
| 328 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 329 | #define SHARED_SECRET_MAX 64 |
| 330 | |
| 331 | #define MDF_CONSISTENT (1 << 0) |
| 332 | #define MDF_PRIMARY_IND (1 << 1) |
| 333 | #define MDF_CONNECTED_IND (1 << 2) |
| 334 | #define MDF_FULL_SYNC (1 << 3) |
| 335 | #define MDF_WAS_UP_TO_DATE (1 << 4) |
| 336 | #define MDF_PEER_OUT_DATED (1 << 5) |
Lars Ellenberg | d5d7ebd | 2011-07-05 20:59:26 +0200 | [diff] [blame] | 337 | #define MDF_CRASHED_PRIMARY (1 << 6) |
| 338 | #define MDF_AL_CLEAN (1 << 7) |
Philipp Reisner | 9a51ab1 | 2012-02-20 21:53:28 +0100 | [diff] [blame] | 339 | #define MDF_AL_DISABLED (1 << 8) |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 340 | |
Andreas Gruenbacher | a297284 | 2014-07-31 17:41:33 +0200 | [diff] [blame] | 341 | #define MAX_PEERS 32 |
| 342 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 343 | enum drbd_uuid_index { |
| 344 | UI_CURRENT, |
| 345 | UI_BITMAP, |
| 346 | UI_HISTORY_START, |
| 347 | UI_HISTORY_END, |
| 348 | UI_SIZE, /* nl-packet: number of dirty bits */ |
| 349 | UI_FLAGS, /* nl-packet: flags */ |
| 350 | UI_EXTENDED_SIZE /* Everything. */ |
| 351 | }; |
| 352 | |
Andreas Gruenbacher | a297284 | 2014-07-31 17:41:33 +0200 | [diff] [blame] | 353 | #define HISTORY_UUIDS MAX_PEERS |
| 354 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 355 | enum drbd_timeout_flag { |
| 356 | UT_DEFAULT = 0, |
| 357 | UT_DEGRADED = 1, |
| 358 | UT_PEER_OUTDATED = 2, |
| 359 | }; |
| 360 | |
Andreas Gruenbacher | a297284 | 2014-07-31 17:41:33 +0200 | [diff] [blame] | 361 | enum drbd_notification_type { |
| 362 | NOTIFY_EXISTS, |
| 363 | NOTIFY_CREATE, |
| 364 | NOTIFY_CHANGE, |
| 365 | NOTIFY_DESTROY, |
| 366 | NOTIFY_CALL, |
| 367 | NOTIFY_RESPONSE, |
| 368 | |
| 369 | NOTIFY_CONTINUES = 0x8000, |
| 370 | NOTIFY_FLAGS = NOTIFY_CONTINUES, |
| 371 | }; |
| 372 | |
Fabian Frederick | 7e5fec3 | 2016-06-14 00:26:35 +0200 | [diff] [blame] | 373 | enum drbd_peer_state { |
| 374 | P_INCONSISTENT = 3, |
| 375 | P_OUTDATED = 4, |
| 376 | P_DOWN = 5, |
| 377 | P_PRIMARY = 6, |
| 378 | P_FENCING = 7, |
| 379 | }; |
| 380 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 381 | #define UUID_JUST_CREATED ((__u64)4) |
| 382 | |
Andreas Gruenbacher | f6ba863 | 2014-08-13 18:33:55 +0200 | [diff] [blame] | 383 | enum write_ordering_e { |
| 384 | WO_NONE, |
| 385 | WO_DRAIN_IO, |
| 386 | WO_BDEV_FLUSH, |
| 387 | WO_BIO_BARRIER |
| 388 | }; |
| 389 | |
Lars Ellenberg | d5d7ebd | 2011-07-05 20:59:26 +0200 | [diff] [blame] | 390 | /* magic numbers used in meta data and network packets */ |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 391 | #define DRBD_MAGIC 0x83740267 |
Philipp Reisner | 0b70a13 | 2010-08-20 13:36:10 +0200 | [diff] [blame] | 392 | #define DRBD_MAGIC_BIG 0x835a |
Andreas Gruenbacher | 0c8e36d | 2011-03-30 16:00:17 +0200 | [diff] [blame] | 393 | #define DRBD_MAGIC_100 0x8620ec20 |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 394 | |
Lars Ellenberg | d5d7ebd | 2011-07-05 20:59:26 +0200 | [diff] [blame] | 395 | #define DRBD_MD_MAGIC_07 (DRBD_MAGIC+3) |
| 396 | #define DRBD_MD_MAGIC_08 (DRBD_MAGIC+4) |
| 397 | #define DRBD_MD_MAGIC_84_UNCLEAN (DRBD_MAGIC+5) |
| 398 | |
| 399 | |
Lars Ellenberg | 7ad651b | 2011-02-21 13:21:03 +0100 | [diff] [blame] | 400 | /* how I came up with this magic? |
| 401 | * base64 decode "actlog==" ;) */ |
| 402 | #define DRBD_AL_MAGIC 0x69cb65a2 |
| 403 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 404 | /* these are of type "int" */ |
| 405 | #define DRBD_MD_INDEX_INTERNAL -1 |
| 406 | #define DRBD_MD_INDEX_FLEX_EXT -2 |
| 407 | #define DRBD_MD_INDEX_FLEX_INT -3 |
| 408 | |
Andreas Gruenbacher | f44d043 | 2011-07-22 13:53:19 +0200 | [diff] [blame] | 409 | #define DRBD_CPU_MASK_SIZE 32 |
| 410 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 411 | #endif |