3 Kernel module for 2.6.x Kernels
5 This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
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>.
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)
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.
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.
28 #include <linux/connector.h>
29 #include <asm/types.h>
32 #include <linux/types.h>
33 #include <asm/byteorder.h>
35 #include <sys/types.h>
39 /* Although the Linux source code makes a difference between
40 generic endianness and the bitfields' endianness, there is no
41 architecture as of Linux-2.6.24-rc4 where the bitfields' endianness
42 does not match the generic endianness. */
44 #if __BYTE_ORDER == __LITTLE_ENDIAN
45 #define __LITTLE_ENDIAN_BITFIELD
46 #elif __BYTE_ORDER == __BIG_ENDIAN
47 #define __BIG_ENDIAN_BITFIELD
49 # error "sorry, weird endianness on this box"
54 extern const char *drbd_buildtag(void);
55 #define REL_VERSION "8.3.11"
56 #define API_VERSION 88
57 #define PRO_VERSION_MIN 86
58 #define PRO_VERSION_MAX 100
61 enum drbd_io_error_p
{
62 EP_PASS_ON
, /* FIXME should the better be named "Ignore"? */
68 FP_NOT_AVAIL
= -1, /* Not a policy */
74 enum drbd_disconnect_p
{
80 enum drbd_after_sb_p
{
82 ASB_DISCARD_YOUNGER_PRI
,
83 ASB_DISCARD_OLDER_PRI
,
85 ASB_DISCARD_LEAST_CHG
,
89 ASB_DISCARD_SECONDARY
,
94 enum drbd_on_no_data
{
99 enum drbd_on_congestion
{
105 /* KEEP the order, do not delete or insert. Only append. */
109 ERR_LOCAL_ADDR
= 102,
112 ERR_OPEN_MD_DISK
= 105,
113 ERR_DISK_NOT_BDEV
= 107,
114 ERR_MD_NOT_BDEV
= 108,
115 ERR_DISK_TOO_SMALL
= 111,
116 ERR_MD_DISK_TOO_SMALL
= 112,
117 ERR_BDCLAIM_DISK
= 114,
118 ERR_BDCLAIM_MD_DISK
= 115,
119 ERR_MD_IDX_INVALID
= 116,
120 ERR_IO_MD_DISK
= 118,
121 ERR_MD_INVALID
= 119,
123 ERR_AUTH_ALG_ND
= 121,
126 ERR_DISK_CONFIGURED
= 124,
127 ERR_NET_CONFIGURED
= 125,
128 ERR_MANDATORY_TAG
= 126,
129 ERR_MINOR_INVALID
= 127,
130 ERR_INTR
= 129, /* EINTR */
131 ERR_RESIZE_RESYNC
= 130,
132 ERR_NO_PRIMARY
= 131,
133 ERR_RESYNC_AFTER
= 132,
134 ERR_RESYNC_AFTER_CYCLE
= 133,
135 ERR_PAUSE_IS_SET
= 134,
136 ERR_PAUSE_IS_CLEAR
= 135,
139 ERR_NOT_PROTO_C
= 139,
140 ERR_NOMEM_BITMAP
= 140,
141 ERR_INTEGRITY_ALG
= 141, /* DRBD 8.2 only */
142 ERR_INTEGRITY_ALG_ND
= 142, /* DRBD 8.2 only */
143 ERR_CPU_MASK_PARSE
= 143, /* DRBD 8.2 only */
144 ERR_CSUMS_ALG
= 144, /* DRBD 8.2 only */
145 ERR_CSUMS_ALG_ND
= 145, /* DRBD 8.2 only */
146 ERR_VERIFY_ALG
= 146, /* DRBD 8.2 only */
147 ERR_VERIFY_ALG_ND
= 147, /* DRBD 8.2 only */
148 ERR_CSUMS_RESYNC_RUNNING
= 148, /* DRBD 8.2 only */
149 ERR_VERIFY_RUNNING
= 149, /* DRBD 8.2 only */
150 ERR_DATA_NOT_CURRENT
= 150,
151 ERR_CONNECTED
= 151, /* DRBD 8.3 only */
153 ERR_NEED_APV_93
= 153,
154 ERR_STONITH_AND_PROT_A
= 154,
155 ERR_CONG_NOT_PROTO_A
= 155,
156 ERR_PIC_AFTER_DEP
= 156,
157 ERR_PIC_PEER_DEP
= 157,
158 ERR_RES_NOT_KNOWN
= 158,
159 ERR_RES_IN_USE
= 159,
160 ERR_MINOR_CONFIGURED
= 160,
161 ERR_MINOR_EXISTS
= 161,
162 ERR_INVALID_REQUEST
= 162,
163 ERR_NEED_APV_100
= 163,
164 ERR_NEED_ALLOW_TWO_PRI
= 164,
165 ERR_MD_UNCLEAN
= 165,
167 /* insert new ones above this line */
171 #define DRBD_PROT_A 1
172 #define DRBD_PROT_B 2
173 #define DRBD_PROT_C 3
177 R_PRIMARY
= 1, /* role */
178 R_SECONDARY
= 2, /* role */
182 /* The order of these constants is important.
183 * The lower ones (<C_WF_REPORT_PARAMS) indicate
184 * that there is no socket!
185 * >=C_WF_REPORT_PARAMS ==> There is a socket
189 C_DISCONNECTING
, /* Temporal state on the way to StandAlone. */
190 C_UNCONNECTED
, /* >= C_UNCONNECTED -> inc_net() succeeds */
192 /* These temporal states are all used on the way
193 * from >= C_CONNECTED to Unconnected.
194 * The 'disconnect reason' states
195 * I do not allow to change between them. */
203 C_WF_REPORT_PARAMS
, /* we have a socket */
204 C_CONNECTED
, /* we have introduced each other */
205 C_STARTING_SYNC_S
, /* starting full sync by admin request. */
206 C_STARTING_SYNC_T
, /* starting full sync by admin request. */
211 /* All SyncStates are tested with this comparison
212 * xx >= C_SYNC_SOURCE && xx <= C_PAUSED_SYNC_T */
226 enum drbd_disk_state
{
228 D_ATTACHING
, /* In the process of reading the meta-data */
229 D_FAILED
, /* Becomes D_DISKLESS as soon as we told it the peer */
230 /* when >= D_FAILED it is legal to access mdev->bc */
231 D_NEGOTIATING
, /* Late attaching state, we need to talk to the peer */
234 D_UNKNOWN
, /* Only used for the peer, never for myself */
235 D_CONSISTENT
, /* Might be D_OUTDATED, might be D_UP_TO_DATE ... */
236 D_UP_TO_DATE
, /* Only this disk state allows applications' IO ! */
241 /* According to gcc's docs is the ...
242 * The order of allocation of bit-fields within a unit (C90 6.5.2.1, C99 6.7.2.1).
244 * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com>
245 * even though we transmit as "cpu_to_be32(state)",
246 * the offsets of the bitfields still need to be swapped
247 * on different endianness.
250 #if defined(__LITTLE_ENDIAN_BITFIELD)
251 unsigned role
:2 ; /* 3/4 primary/secondary/unknown */
252 unsigned peer
:2 ; /* 3/4 primary/secondary/unknown */
253 unsigned conn
:5 ; /* 17/32 cstates */
254 unsigned disk
:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
255 unsigned pdsk
:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
256 unsigned susp
:1 ; /* 2/2 IO suspended no/yes (by user) */
257 unsigned aftr_isp
:1 ; /* isp .. imposed sync pause */
258 unsigned peer_isp
:1 ;
259 unsigned user_isp
:1 ;
260 unsigned susp_nod
:1 ; /* IO suspended because no data */
261 unsigned susp_fen
:1 ; /* IO suspended because fence peer handler runs*/
262 unsigned _pad
:9; /* 0 unused */
263 #elif defined(__BIG_ENDIAN_BITFIELD)
265 unsigned susp_fen
:1 ;
266 unsigned susp_nod
:1 ;
267 unsigned user_isp
:1 ;
268 unsigned peer_isp
:1 ;
269 unsigned aftr_isp
:1 ; /* isp .. imposed sync pause */
270 unsigned susp
:1 ; /* 2/2 IO suspended no/yes */
271 unsigned pdsk
:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
272 unsigned disk
:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
273 unsigned conn
:5 ; /* 17/32 cstates */
274 unsigned peer
:2 ; /* 3/4 primary/secondary/unknown */
275 unsigned role
:2 ; /* 3/4 primary/secondary/unknown */
277 # error "this endianness is not supported"
286 SS_NOTHING_TO_DO
= 2,
288 SS_UNKNOWN_ERROR
= 0, /* Used to sleep longer in _drbd_request_state */
289 SS_TWO_PRIMARIES
= -1,
290 SS_NO_UP_TO_DATE_DISK
= -2,
291 SS_NO_LOCAL_DISK
= -4,
292 SS_NO_REMOTE_DISK
= -5,
293 SS_CONNECTED_OUTDATES
= -6,
295 SS_RESYNC_RUNNING
= -8,
296 SS_ALREADY_STANDALONE
= -9,
297 SS_CW_FAILED_BY_PEER
= -10,
298 SS_IS_DISKLESS
= -11,
299 SS_DEVICE_IN_USE
= -12,
300 SS_NO_NET_CONFIG
= -13,
301 SS_NO_VERIFY_ALG
= -14, /* drbd-8.2 only */
302 SS_NEED_CONNECTION
= -15, /* drbd-8.2 only */
303 SS_LOWER_THAN_OUTDATED
= -16,
304 SS_NOT_SUPPORTED
= -17, /* drbd-8.2 only */
305 SS_IN_TRANSIENT_STATE
= -18, /* Retry after the next state change */
306 SS_CONCURRENT_ST_CHG
= -19, /* Concurrent cluster side state change! */
307 SS_O_VOL_PEER_PRI
= -20,
308 SS_AFTER_LAST_ERROR
= -21, /* Keep this at bottom */
311 /* from drbd_strings.c */
312 extern const char *drbd_conn_str(enum drbd_conns
);
313 extern const char *drbd_role_str(enum drbd_role
);
314 extern const char *drbd_disk_str(enum drbd_disk_state
);
315 extern const char *drbd_set_st_err_str(enum drbd_state_rv
);
317 #define SHARED_SECRET_MAX 64
319 #define MDF_CONSISTENT (1 << 0)
320 #define MDF_PRIMARY_IND (1 << 1)
321 #define MDF_CONNECTED_IND (1 << 2)
322 #define MDF_FULL_SYNC (1 << 3)
323 #define MDF_WAS_UP_TO_DATE (1 << 4)
324 #define MDF_PEER_OUT_DATED (1 << 5)
325 #define MDF_CRASHED_PRIMARY (1 << 6)
326 #define MDF_AL_CLEAN (1 << 7)
328 enum drbd_uuid_index
{
333 UI_SIZE
, /* nl-packet: number of dirty bits */
334 UI_FLAGS
, /* nl-packet: flags */
335 UI_EXTENDED_SIZE
/* Everything. */
338 enum drbd_timeout_flag
{
341 UT_PEER_OUTDATED
= 2,
344 #define UUID_JUST_CREATED ((__u64)4)
346 /* magic numbers used in meta data and network packets */
347 #define DRBD_MAGIC 0x83740267
348 #define DRBD_MAGIC_BIG 0x835a
349 #define DRBD_MAGIC_100 0x8620ec20
351 #define DRBD_MD_MAGIC_07 (DRBD_MAGIC+3)
352 #define DRBD_MD_MAGIC_08 (DRBD_MAGIC+4)
353 #define DRBD_MD_MAGIC_84_UNCLEAN (DRBD_MAGIC+5)
356 /* how I came up with this magic?
357 * base64 decode "actlog==" ;) */
358 #define DRBD_AL_MAGIC 0x69cb65a2
360 /* these are of type "int" */
361 #define DRBD_MD_INDEX_INTERNAL -1
362 #define DRBD_MD_INDEX_FLEX_EXT -2
363 #define DRBD_MD_INDEX_FLEX_INT -3
This page took 0.04669 seconds and 6 git commands to generate.