Blame view

drivers/md/md.h 22.9 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
7e8415262   Wang Sheng-Hui   trival: md_k.h sh...
2
     md.h : kernel internal structure of the Linux MD driver
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
            Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
f72ffdd68   NeilBrown   md: remove unwant...
4

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
6
7
8
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2, or (at your option)
     any later version.
f72ffdd68   NeilBrown   md: remove unwant...
9

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
     You should have received a copy of the GNU General Public License
     (for example /usr/src/linux/COPYING); if not, write to the Free
f72ffdd68   NeilBrown   md: remove unwant...
12
     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
  */
63fe08177   Christoph Hellwig   md: tiny md.h cle...
14
15
16
17
  #ifndef _MD_MD_H
  #define _MD_MD_H
  
  #include <linux/blkdev.h>
66114cad6   Tejun Heo   writeback: separa...
18
  #include <linux/backing-dev.h>
fc974ee2b   Vishal Verma   md: convert to us...
19
  #include <linux/badblocks.h>
63fe08177   Christoph Hellwig   md: tiny md.h cle...
20
21
22
23
24
25
26
  #include <linux/kobject.h>
  #include <linux/list.h>
  #include <linux/mm.h>
  #include <linux/mutex.h>
  #include <linux/timer.h>
  #include <linux/wait.h>
  #include <linux/workqueue.h>
edb39c9de   Goldwyn Rodrigues   Introduce md_clus...
27
  #include "md-cluster.h"
9361401eb   David Howells   [PATCH] BLOCK: Ma...
28

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
  #define MaxSector (~(sector_t)0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
33
   * MD's 'extended' device
   */
3cb030020   NeilBrown   md: removing type...
34
  struct md_rdev {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
  	struct list_head same_set;	/* RAID devices within the same set */
dd8ac336c   Andre Noll   md: Represent rai...
36
  	sector_t sectors;		/* Device size (in 512bytes sectors) */
fd01b88c7   NeilBrown   md: remove typede...
37
  	struct mddev *mddev;		/* RAID array if running */
eea1bf384   NeilBrown   md: Fix is_mddev_...
38
  	int last_events;		/* IO event timestamp */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39

a6ff7e089   Jonathan Brassow   md: separate meta...
40
41
42
43
44
45
  	/*
  	 * If meta_bdev is non-NULL, it means that a separate device is
  	 * being used to store the metadata (superblock/bitmap) which
  	 * would otherwise be contained on the same device as the data (bdev).
  	 */
  	struct block_device *meta_bdev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
  	struct block_device *bdev;	/* block device handle */
2699b6722   NeilBrown   md: load/store ba...
47
  	struct page	*sb_page, *bb_page;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
  	int		sb_loaded;
425437691   NeilBrown   [PATCH] md: Don't...
49
  	__u64		sb_events;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
  	sector_t	data_offset;	/* start of data in array */
c6563a8c3   NeilBrown   md: add possibili...
51
  	sector_t	new_data_offset;/* only relevant while reshaping */
f72ffdd68   NeilBrown   md: remove unwant...
52
  	sector_t	sb_start;	/* offset of the super block (in 512byte sectors) */
0002b2718   NeilBrown   [PATCH] md: limit...
53
  	int		sb_size;	/* bytes in the superblock */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
  	int		preferred_minor;	/* autorun support */
86e6ffdd2   NeilBrown   [PATCH] md: exten...
55
  	struct kobject	kobj;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
56
57
58
59
60
61
62
63
64
65
  	/* A device can be in one of three states based on two flags:
  	 * Not working:   faulty==1 in_sync==0
  	 * Fully working: faulty==0 in_sync==1
  	 * Working, but not
  	 * in sync with array
  	 *                faulty==0 in_sync==0
  	 *
  	 * It can never have faulty==1, in_sync==1
  	 * This reduces the burden of testing multiple flags in many cases
  	 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66

2d78f8c45   NeilBrown   md: create extern...
67
  	unsigned long	flags;	/* bit set of 'enum flag_bits' bits. */
6bfe0b499   Dan Williams   md: support block...
68
  	wait_queue_head_t blocked_wait;
8ddf9efe6   NeilBrown   [PATCH] md: suppo...
69

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
71
  	int desc_nr;			/* descriptor index in the superblock */
  	int raid_disk;			/* role of device in array */
e93f68a1f   NeilBrown   md: fix handling ...
72
73
74
  	int new_raid_disk;		/* role that the device will have in
  					 * the array after a level-change completes.
  					 */
41158c7eb   NeilBrown   [PATCH] md: optim...
75
76
77
78
  	int saved_raid_disk;		/* role that device used to have in the
  					 * array and could again if we did a partial
  					 * resync from the bitmap
  					 */
3069aa8de   Shaohua Li   md: override md s...
79
80
  	union {
  		sector_t recovery_offset;/* If this device has been partially
5fd6c1dce   NeilBrown   [PATCH] md: allow...
81
82
83
  					 * recovered, this is where we were
  					 * up to.
  					 */
3069aa8de   Shaohua Li   md: override md s...
84
85
86
87
88
  		sector_t journal_tail;	/* If this device is a journal device,
  					 * this is the journal tail (journal
  					 * recovery start point)
  					 */
  	};
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
89
90
91
92
93
  
  	atomic_t	nr_pending;	/* number of pending requests.
  					 * only maintained for arrays that
  					 * support hot removal
  					 */
ba22dcbf1   NeilBrown   [PATCH] md: impro...
94
95
96
  	atomic_t	read_errors;	/* number of consecutive read errors that
  					 * we have tried to ignore.
  					 */
0e3ef49ed   Arnd Bergmann   md: use seconds g...
97
  	time64_t	last_read_error;	/* monotonic time since our
1e50915fe   Robert Becker   raid: improve MD/...
98
99
  						 * last read error
  						 */
4dbcdc751   NeilBrown   [PATCH] md: count...
100
101
102
103
  	atomic_t	corrected_errors; /* number of corrected read errors,
  					   * for reporting to userspace and storing
  					   * in superblock.
  					   */
5792a2856   NeilBrown   [PATCH] md: avoid...
104
  	struct work_struct del_work;	/* used for delayed sysfs removal */
3c0ee63a6   NeilBrown   md: use sysfs_not...
105

324a56e16   Tejun Heo   kernfs: s/sysfs_d...
106
  	struct kernfs_node *sysfs_state; /* handle for 'state'
3c0ee63a6   NeilBrown   md: use sysfs_not...
107
  					   * sysfs entry */
2230dfe4c   NeilBrown   md: beginnings of...
108

fc974ee2b   Vishal Verma   md: convert to us...
109
  	struct badblocks badblocks;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
110
  };
2d78f8c45   NeilBrown   md: create extern...
111
112
113
  enum flag_bits {
  	Faulty,			/* device is known to have a fault */
  	In_sync,		/* device is in_sync with rest of array */
8313b8e57   NeilBrown   md: fix problem w...
114
115
116
  	Bitmap_sync,		/* ..actually, not quite In_sync.  Need a
  				 * bitmap-based recovery to get fully in sync
  				 */
2d78f8c45   NeilBrown   md: create extern...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
  	WriteMostly,		/* Avoid reading if at all possible */
  	AutoDetected,		/* added by auto-detect */
  	Blocked,		/* An error occurred but has not yet
  				 * been acknowledged by the metadata
  				 * handler, so don't allow writes
  				 * until it is cleared */
  	WriteErrorSeen,		/* A write error has been seen on this
  				 * device
  				 */
  	FaultRecorded,		/* Intermediate state for clearing
  				 * Blocked.  The Fault is/will-be
  				 * recorded in the metadata, but that
  				 * metadata hasn't been stored safely
  				 * on disk yet.
  				 */
  	BlockedBadBlocks,	/* A writer is blocked because they
  				 * found an unacknowledged bad-block.
  				 * This can safely be cleared at any
  				 * time, and the writer will re-check.
  				 * It may be set at any time, and at
  				 * worst the writer will timeout and
  				 * re-check.  So setting it as
  				 * accurately as possible is good, but
  				 * not absolutely critical.
  				 */
  	WantReplacement,	/* This device is a candidate to be
  				 * hot-replaced, either because it has
  				 * reported some faults, or because
  				 * of explicit request.
  				 */
  	Replacement,		/* This device is a replacement for
  				 * a want_replacement device with same
  				 * raid_disk number.
  				 */
1aee41f63   Goldwyn Rodrigues   Add new disk to c...
151
152
153
154
  	Candidate,		/* For clustered environments only:
  				 * This device is seen locally but not
  				 * by the whole cluster
  				 */
bac624f3f   Song Liu   MD: add a new dis...
155
156
157
158
159
  	Journal,		/* This device is used as journal for
  				 * raid-5/6.
  				 * Usually, this device should be faster
  				 * than other devices in the array
  				 */
659b254fa   Guoqing Jiang   md-cluster: remov...
160
  	ClusterRemove,
d787be409   NeilBrown   md: reduce the nu...
161
162
163
164
165
  	RemoveSynchronized,	/* synchronize_rcu() was called after
  				 * this device was known to be faulty,
  				 * so it is safe to remove without
  				 * another synchronize_rcu() call.
  				 */
2d78f8c45   NeilBrown   md: create extern...
166
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167

3cb030020   NeilBrown   md: removing type...
168
  static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
2230dfe4c   NeilBrown   md: beginnings of...
169
170
171
  			      sector_t *first_bad, int *bad_sectors)
  {
  	if (unlikely(rdev->badblocks.count)) {
fc974ee2b   Vishal Verma   md: convert to us...
172
  		int rv = badblocks_check(&rdev->badblocks, rdev->data_offset + s,
2230dfe4c   NeilBrown   md: beginnings of...
173
174
175
176
177
178
179
180
  					sectors,
  					first_bad, bad_sectors);
  		if (rv)
  			*first_bad -= rdev->data_offset;
  		return rv;
  	}
  	return 0;
  }
3cb030020   NeilBrown   md: removing type...
181
  extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
c6563a8c3   NeilBrown   md: add possibili...
182
183
184
  			      int is_new);
  extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
  				int is_new);
c4ce867fd   Goldwyn Rodrigues   Introduce md_clus...
185
  struct md_cluster_info;
fd01b88c7   NeilBrown   md: remove typede...
186
  struct mddev {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
187
  	void				*private;
84fc4b56d   NeilBrown   md: rename "mdk_p...
188
  	struct md_personality		*pers;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
189
190
  	dev_t				unit;
  	int				md_minor;
7a0a5355c   NeilBrown   md: Don't test al...
191
  	struct list_head		disks;
850b2b420   NeilBrown   [PATCH] md: repla...
192
193
194
  	unsigned long			flags;
  #define MD_CHANGE_DEVS	0	/* Some device status has changed */
  #define MD_CHANGE_CLEAN 1	/* transition to or from 'clean' */
070dc6dd7   NeilBrown   md: resolve confu...
195
  #define MD_CHANGE_PENDING 2	/* switch from 'clean' to 'active' in progress */
7a0a5355c   NeilBrown   md: Don't test al...
196
  #define MD_UPDATE_SB_FLAGS (1 | 2 | 4)	/* If these are set, md_update_sb needed */
9c81075f4   Jonathan Brassow   MD: support initi...
197
  #define MD_ARRAY_FIRST_USE 3    /* First use of array, needs initialization */
af8d8e6f0   Guoqing Jiang   md: changes for M...
198
199
  #define MD_CLOSING	4	/* If set, we are closing the array, do not open
  				 * it then */
bd18f6462   Shaohua Li   md: skip resync f...
200
  #define MD_JOURNAL_CLEAN 5	/* A raid with journal is already clean */
a97b78964   Song Liu   MD: add new bit t...
201
  #define MD_HAS_JOURNAL	6	/* The raid array has journal feature set */
15858fa5b   Guoqing Jiang   md-cluster: Defer...
202
203
204
  #define MD_RELOAD_SB	7	/* Reload the superblock because another node
  				 * updated it.
  				 */
bb8bf15bd   Guoqing Jiang   md-cluster: fix d...
205
206
207
  #define MD_CLUSTER_RESYNC_LOCKED 8 /* cluster raid only, which means node
  				    * already took resync lock, need to
  				    * release the lock */
850b2b420   NeilBrown   [PATCH] md: repla...
208

409c57f38   NeilBrown   md: enable suspen...
209
210
  	int				suspended;
  	atomic_t			active_io;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
211
  	int				ro;
bb4f1e9d0   NeilBrown   md: fix another d...
212
213
214
215
  	int				sysfs_active; /* set when sysfs deletes
  						       * are happening, so run/
  						       * takeover/stop are not safe
  						       */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
216
  	struct gendisk			*gendisk;
eae1701fb   NeilBrown   [PATCH] md: initi...
217
  	struct kobject			kobj;
d3374825c   NeilBrown   md: make devices ...
218
219
  	int				hold_active;
  #define	UNTIL_IOCTL	1
efeb53c0e   NeilBrown   md: Allow md devi...
220
  #define	UNTIL_STOP	2
eae1701fb   NeilBrown   [PATCH] md: initi...
221

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
222
223
224
225
226
  	/* Superblock information */
  	int				major_version,
  					minor_version,
  					patch_version;
  	int				persistent;
f72ffdd68   NeilBrown   md: remove unwant...
227
  	int				external;	/* metadata is
e691063a6   NeilBrown   md: support 'exte...
228
229
  							 * managed externally */
  	char				metadata_type[17]; /* externally set*/
9d8f03636   Andre Noll   md: Make mddev->c...
230
  	int				chunk_sectors;
9ebc6ef18   Deepa Dinamani   drivers: md: use ...
231
  	time64_t			ctime, utime;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
232
  	int				level, layout;
d9d166c2a   NeilBrown   [PATCH] md: allow...
233
  	char				clevel[16];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
234
235
  	int				raid_disks;
  	int				max_disks;
f72ffdd68   NeilBrown   md: remove unwant...
236
  	sector_t			dev_sectors;	/* used size of
58c0fed40   Andre Noll   md: Make mddev->s...
237
  							 * component devices */
f233ea5c9   Andre Noll   md: Make mddev->a...
238
  	sector_t			array_sectors; /* exported array size */
b522adcde   Dan Williams   md: 'array_size' ...
239
240
  	int				external_size; /* size managed
  							* externally */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
241
  	__u64				events;
a8707c08f   NeilBrown   md: simplify upda...
242
243
244
245
246
247
  	/* If the last 'event' was simply a clean->dirty transition, and
  	 * we didn't write it to the spares, then it is safe and simple
  	 * to just decrement the event count on a dirty->clean transition.
  	 * So we record that possibility here.
  	 */
  	int				can_decrease_events;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
248
249
  
  	char				uuid[16];
f67055780   NeilBrown   [PATCH] md: Check...
250
251
252
253
254
255
  	/* If the array is being reshaped, we need to record the
  	 * new shape and an indication of where we are up to.
  	 * This is written to the superblock.
  	 * If reshape_position is MaxSector, then no reshape is happening (yet).
  	 */
  	sector_t			reshape_position;
664e7c413   Andre Noll   md: Convert mddev...
256
257
  	int				delta_disks, new_level, new_layout;
  	int				new_chunk_sectors;
2c810cddc   NeilBrown   md: allow a resha...
258
  	int				reshape_backwards;
f67055780   NeilBrown   [PATCH] md: Check...
259

2b8bf3451   NeilBrown   md: remove typede...
260
261
  	struct md_thread		*thread;	/* management thread */
  	struct md_thread		*sync_thread;	/* doing resync or reconstruct */
c4a395514   Jonathan Brassow   MD: Remember the ...
262
263
264
265
266
267
268
269
  
  	/* 'last_sync_action' is initialized to "none".  It is set when a
  	 * sync operation (i.e "data-check", "requested-resync", "resync",
  	 * "recovery", or "reshape") is started.  It holds this value even
  	 * when the sync thread is "frozen" (interrupted) or "idle" (stopped
  	 * or finished).  It is overwritten when a new sync operation is begun.
  	 */
  	char				*last_sync_action;
ff4e8d9a9   NeilBrown   [PATCH] md: fix r...
270
  	sector_t			curr_resync;	/* last block scheduled */
97e4f42d6   NeilBrown   md: occasionally ...
271
272
273
274
275
276
277
  	/* As resync requests can complete out of order, we cannot easily track
  	 * how much resync has been completed.  So we occasionally pause until
  	 * everything completes, then set curr_resync_completed to curr_resync.
  	 * As such it may be well behind the real resync mark, but it is a value
  	 * we are certain of.
  	 */
  	sector_t			curr_resync_completed;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
278
279
  	unsigned long			resync_mark;	/* a recent timestamp */
  	sector_t			resync_mark_cnt;/* blocks written at resync_mark */
ff4e8d9a9   NeilBrown   [PATCH] md: fix r...
280
  	sector_t			curr_mark_cnt; /* blocks scheduled now */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
281
282
  
  	sector_t			resync_max_sectors; /* may be set by personality */
9d88883e6   NeilBrown   [PATCH] md: teach...
283

7f7583d42   Jianpeng Ma   Subject: [PATCH] ...
284
  	atomic64_t			resync_mismatches; /* count of sectors where
9d88883e6   NeilBrown   [PATCH] md: teach...
285
286
  							    * parity/replica mismatch found
  							    */
e464eafdb   NeilBrown   [PATCH] md: Suppo...
287
288
289
290
  
  	/* allow user-space to request suspension of IO to regions of the array */
  	sector_t			suspend_lo;
  	sector_t			suspend_hi;
88202a0c8   NeilBrown   [PATCH] md: allow...
291
292
293
  	/* if zero, use the system-wide default */
  	int				sync_speed_min;
  	int				sync_speed_max;
90b08710e   Bernd Schubert   md: allow paralle...
294
295
  	/* resync even though the same disks are shared among md-devices */
  	int				parallel_resync;
6ff8d8ec0   NeilBrown   [PATCH] md: allow...
296
  	int				ok_start_degraded;
f72ffdd68   NeilBrown   md: remove unwant...
297
  	/* recovery/resync flags
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
298
299
300
  	 * NEEDED:   we might need to start a resync/recover
  	 * RUNNING:  a thread is running, or about to be started
  	 * SYNC:     actually doing a resync, not a recovery
72a23c211   Neil Brown   Make sure all cha...
301
  	 * RECOVER:  doing recovery, or need to try it.
dfc706450   NeilBrown   md: restart recov...
302
  	 * INTR:     resync needs to be aborted for some reason
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
303
  	 * DONE:     thread is done and is waiting to be reaped
24dd469d7   NeilBrown   [PATCH] md: allow...
304
  	 * REQUEST:  user-space has requested a sync (used with SYNC)
411c94038   Anand Gadiyar   trivial: fix typo...
305
  	 * CHECK:    user-space request for check-only, no repair
ccfcc3c10   NeilBrown   [PATCH] md: Core ...
306
  	 * RESHAPE:  A reshape is happening
0a19caabf   majianpeng   md: Use ->curr_re...
307
  	 * ERROR:    sync-action interrupted because io-error
ccfcc3c10   NeilBrown   [PATCH] md: Core ...
308
309
  	 *
  	 * If neither SYNC or RESHAPE are set, then it is a recovery.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
310
311
312
  	 */
  #define	MD_RECOVERY_RUNNING	0
  #define	MD_RECOVERY_SYNC	1
72a23c211   Neil Brown   Make sure all cha...
313
  #define	MD_RECOVERY_RECOVER	2
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
314
315
316
  #define	MD_RECOVERY_INTR	3
  #define	MD_RECOVERY_DONE	4
  #define	MD_RECOVERY_NEEDED	5
24dd469d7   NeilBrown   [PATCH] md: allow...
317
318
  #define	MD_RECOVERY_REQUESTED	6
  #define	MD_RECOVERY_CHECK	7
ccfcc3c10   NeilBrown   [PATCH] md: Core ...
319
  #define MD_RECOVERY_RESHAPE	8
5fd6c1dce   NeilBrown   [PATCH] md: allow...
320
  #define	MD_RECOVERY_FROZEN	9
0a19caabf   majianpeng   md: Use ->curr_re...
321
  #define	MD_RECOVERY_ERROR	10
5fd6c1dce   NeilBrown   [PATCH] md: allow...
322

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
323
  	unsigned long			recovery;
5389042ff   NeilBrown   md: change manage...
324
325
326
327
328
329
  	/* If a RAID personality determines that recovery (of a particular
  	 * device) will fail due to a read error on the source device, it
  	 * takes a copy of this number and does not attempt recovery again
  	 * until this number changes.
  	 */
  	int				recovery_disabled;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
330
331
  
  	int				in_sync;	/* know to not need resync */
c8c00a691   NeilBrown   Remove deadlock p...
332
333
334
335
336
337
338
339
340
341
  	/* 'open_mutex' avoids races between 'md_open' and 'do_md_stop', so
  	 * that we are never stopping an array while it is open.
  	 * 'reconfig_mutex' protects all other reconfiguration.
  	 * These locks are separate due to conflicting interactions
  	 * with bdev->bd_mutex.
  	 * Lock ordering is:
  	 *  reconfig_mutex -> bd_mutex : e.g. do_md_run -> revalidate_disk
  	 *  bd_mutex -> open_mutex:  e.g. __blkdev_get -> md_open
  	 */
  	struct mutex			open_mutex;
df5b89b32   NeilBrown   [PATCH] md: Conve...
342
  	struct mutex			reconfig_mutex;
f2ea68cf4   NeilBrown   md: only count ac...
343
344
  	atomic_t			active;		/* general refcount */
  	atomic_t			openers;	/* number of active opens */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
345

f0b4f7e2f   NeilBrown   md: Fix - again -...
346
347
  	int				changed;	/* True if we might need to
  							 * reread partition info */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
348
349
350
351
352
353
354
  	int				degraded;	/* whether md should consider
  							 * adding a spare
  							 */
  
  	atomic_t			recovery_active; /* blocks scheduled, but not written */
  	wait_queue_head_t		recovery_wait;
  	sector_t			recovery_cp;
5e96ee65c   Neil Brown   Allow setting sta...
355
356
  	sector_t			resync_min;	/* user requested sync
  							 * starts here */
c62072777   NeilBrown   md: allow a maxim...
357
358
  	sector_t			resync_max;	/* resync should pause
  							 * when it gets here */
06d91a5fe   NeilBrown   [PATCH] md: impro...
359

324a56e16   Tejun Heo   kernfs: s/sysfs_d...
360
  	struct kernfs_node		*sysfs_state;	/* handle for 'array_state'
b62b75905   NeilBrown   md: use sysfs_not...
361
362
  							 * file in sysfs.
  							 */
324a56e16   Tejun Heo   kernfs: s/sysfs_d...
363
  	struct kernfs_node		*sysfs_action;  /* handle for 'sync_action' */
b62b75905   NeilBrown   md: use sysfs_not...
364

d3374825c   NeilBrown   md: make devices ...
365
  	struct work_struct del_work;	/* used for delayed sysfs removal */
85572d7c7   NeilBrown   md: rename mddev-...
366
367
368
369
370
  	/* "lock" protects:
  	 *   flush_bio transition from NULL to !NULL
  	 *   rdev superblocks, events
  	 *   clearing MD_CHANGE_*
  	 *   in_sync - and related safemode and MD_CHANGE changes
36d091f47   NeilBrown   md: protect ->per...
371
  	 *   pers (also protected by reconfig_mutex and pending IO).
978a7a47c   NeilBrown   md/bitmap: protec...
372
  	 *   clearing ->bitmap
4af1a0417   NeilBrown   md: move GET_BITM...
373
  	 *   clearing ->bitmap_info.file
23da422b1   NeilBrown   md: use mddev->lo...
374
375
  	 *   changing ->resync_{min,max}
  	 *   setting MD_RECOVERY_RUNNING (which interacts with resync_{min,max})
85572d7c7   NeilBrown   md: rename mddev-...
376
377
  	 */
  	spinlock_t			lock;
3d310eb7b   NeilBrown   [PATCH] md: fix d...
378
  	wait_queue_head_t		sb_wait;	/* for waiting on superblock updates */
7bfa19f27   NeilBrown   [PATCH] md: allow...
379
  	atomic_t			pending_writes;	/* number of active superblock writes */
06d91a5fe   NeilBrown   [PATCH] md: impro...
380

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
381
382
  	unsigned int			safemode;	/* if set, update "clean" superblock
  							 * when no writes pending.
f72ffdd68   NeilBrown   md: remove unwant...
383
  							 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
384
385
  	unsigned int			safemode_delay;
  	struct timer_list		safemode_timer;
f72ffdd68   NeilBrown   md: remove unwant...
386
  	atomic_t			writes_pending;
165125e1e   Jens Axboe   [BLOCK] Get rid o...
387
  	struct request_queue		*queue;	/* for plugging ... */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
388

f72ffdd68   NeilBrown   md: remove unwant...
389
  	struct bitmap			*bitmap; /* the bitmap for the device */
c3d9714e8   NeilBrown   md: collect bitma...
390
391
  	struct {
  		struct file		*file; /* the bitmap file */
f6af949c5   NeilBrown   md: support bitma...
392
  		loff_t			offset; /* offset from superblock of
c3d9714e8   NeilBrown   md: collect bitma...
393
394
  						 * start of bitmap. May be
  						 * negative, but not '0'
f6af949c5   NeilBrown   md: support bitma...
395
  						 * For external metadata, offset
f72ffdd68   NeilBrown   md: remove unwant...
396
  						 * from start of device.
c3d9714e8   NeilBrown   md: collect bitma...
397
  						 */
6409bb05a   NeilBrown   md/bitmap: add ne...
398
  		unsigned long		space; /* space available at this offset */
f6af949c5   NeilBrown   md: support bitma...
399
  		loff_t			default_offset; /* this is the offset to use when
c3d9714e8   NeilBrown   md: collect bitma...
400
401
402
  							 * hot-adding a bitmap.  It should
  							 * eventually be settable by sysfs.
  							 */
6409bb05a   NeilBrown   md/bitmap: add ne...
403
404
  		unsigned long		default_space; /* space available at
  							* default offset */
c3d9714e8   NeilBrown   md: collect bitma...
405
  		struct mutex		mutex;
42a04b507   NeilBrown   md: move offset, ...
406
  		unsigned long		chunksize;
ac2f40be4   NeilBrown   md/bitmap: white ...
407
  		unsigned long		daemon_sleep; /* how many jiffies between updates? */
42a04b507   NeilBrown   md: move offset, ...
408
  		unsigned long		max_write_behind; /* write-behind mode */
ece5cff0d   NeilBrown   md: Support write...
409
  		int			external;
c4ce867fd   Goldwyn Rodrigues   Introduce md_clus...
410
  		int			nodes; /* Maximum number of nodes in the cluster */
cf921cc19   Goldwyn Rodrigues   Add node recovery...
411
  		char                    cluster_name[64]; /* Name of the cluster */
c3d9714e8   NeilBrown   md: collect bitma...
412
  	} bitmap_info;
32a7627cf   NeilBrown   [PATCH] md: optim...
413

f72ffdd68   NeilBrown   md: remove unwant...
414
  	atomic_t			max_corr_read_errors; /* max read retries */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
415
  	struct list_head		all_mddevs;
a2826aa92   NeilBrown   md: support barri...
416

a64c876fd   NeilBrown   md: manage redund...
417
  	struct attribute_group		*to_remove;
252ac5221   NeilBrown   md/plug: optional...
418

a167f6632   NeilBrown   md: use separate ...
419
  	struct bio_set			*bio_set;
e9c7469bb   Tejun Heo   md: implment REQ_...
420
421
  	/* Generic flush handling.
  	 * The last to finish preflush schedules a worker to submit
28a8f0d31   Mike Christie   block, drivers, f...
422
  	 * the rest of the request (without the REQ_PREFLUSH flag).
a2826aa92   NeilBrown   md: support barri...
423
  	 */
e9c7469bb   Tejun Heo   md: implment REQ_...
424
  	struct bio *flush_bio;
a2826aa92   NeilBrown   md: support barri...
425
  	atomic_t flush_pending;
e9c7469bb   Tejun Heo   md: implment REQ_...
426
  	struct work_struct flush_work;
768a418db   NeilBrown   md: add support f...
427
  	struct work_struct event_work;	/* used by dm to report failure event */
fd01b88c7   NeilBrown   md: remove typede...
428
  	void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev);
c4ce867fd   Goldwyn Rodrigues   Introduce md_clus...
429
  	struct md_cluster_info		*cluster_info;
15858fa5b   Guoqing Jiang   md-cluster: Defer...
430
  	unsigned int			good_device_nr;	/* good device num within cluster raid */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
431
  };
5c47daf6e   NeilBrown   md: move mddev_lo...
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
  static inline int __must_check mddev_lock(struct mddev *mddev)
  {
  	return mutex_lock_interruptible(&mddev->reconfig_mutex);
  }
  
  /* Sometimes we need to take the lock in a situation where
   * failure due to interrupts is not acceptable.
   */
  static inline void mddev_lock_nointr(struct mddev *mddev)
  {
  	mutex_lock(&mddev->reconfig_mutex);
  }
  
  static inline int mddev_is_locked(struct mddev *mddev)
  {
  	return mutex_is_locked(&mddev->reconfig_mutex);
  }
  
  static inline int mddev_trylock(struct mddev *mddev)
  {
  	return mutex_trylock(&mddev->reconfig_mutex);
  }
  extern void mddev_unlock(struct mddev *mddev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
455
456
  static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
  {
f72ffdd68   NeilBrown   md: remove unwant...
457
  	atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
458
  }
84fc4b56d   NeilBrown   md: rename "mdk_p...
459
  struct md_personality
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
460
461
  {
  	char *name;
2604b703b   NeilBrown   [PATCH] md: remov...
462
463
  	int level;
  	struct list_head list;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
464
  	struct module *owner;
b4fdcb02f   Linus Torvalds   Merge branch 'for...
465
  	void (*make_request)(struct mddev *mddev, struct bio *bio);
fd01b88c7   NeilBrown   md: remove typede...
466
  	int (*run)(struct mddev *mddev);
afa0f557c   NeilBrown   md: rename ->stop...
467
  	void (*free)(struct mddev *mddev, void *priv);
fd01b88c7   NeilBrown   md: remove typede...
468
  	void (*status)(struct seq_file *seq, struct mddev *mddev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
469
  	/* error_handler must set ->faulty and clear ->in_sync
f72ffdd68   NeilBrown   md: remove unwant...
470
  	 * if appropriate, and should abort recovery if needed
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
471
  	 */
fd01b88c7   NeilBrown   md: remove typede...
472
473
  	void (*error_handler)(struct mddev *mddev, struct md_rdev *rdev);
  	int (*hot_add_disk) (struct mddev *mddev, struct md_rdev *rdev);
b8321b68d   NeilBrown   md: change hot_re...
474
  	int (*hot_remove_disk) (struct mddev *mddev, struct md_rdev *rdev);
fd01b88c7   NeilBrown   md: remove typede...
475
  	int (*spare_active) (struct mddev *mddev);
09314799e   NeilBrown   md: remove 'go_fa...
476
  	sector_t (*sync_request)(struct mddev *mddev, sector_t sector_nr, int *skipped);
fd01b88c7   NeilBrown   md: remove typede...
477
478
479
480
481
  	int (*resize) (struct mddev *mddev, sector_t sectors);
  	sector_t (*size) (struct mddev *mddev, sector_t sectors, int raid_disks);
  	int (*check_reshape) (struct mddev *mddev);
  	int (*start_reshape) (struct mddev *mddev);
  	void (*finish_reshape) (struct mddev *mddev);
36fa30636   NeilBrown   [PATCH] md: all h...
482
483
484
485
486
  	/* quiesce moves between quiescence states
  	 * 0 - fully active
  	 * 1 - no new requests allowed
  	 * others - reserved
  	 */
fd01b88c7   NeilBrown   md: remove typede...
487
  	void (*quiesce) (struct mddev *mddev, int state);
245f46c2c   NeilBrown   md: add ->takeove...
488
489
490
491
492
493
494
495
496
  	/* takeover is used to transition an array from one
  	 * personality to another.  The new personality must be able
  	 * to handle the data in the current layout.
  	 * e.g. 2drive raid1 -> 2drive raid5
  	 *      ndrive raid5 -> degraded n+1drive raid6 with special layout
  	 * If the takeover succeeds, a new 'private' structure is returned.
  	 * This needs to be installed and then ->run used to activate the
  	 * array.
  	 */
fd01b88c7   NeilBrown   md: remove typede...
497
  	void *(*takeover) (struct mddev *mddev);
5c675f83c   NeilBrown   md: make ->conges...
498
499
500
  	/* congested implements bdi.congested_fn().
  	 * Will not be called while array is 'suspended' */
  	int (*congested)(struct mddev *mddev, int bits);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
501
  };
007583c92   NeilBrown   [PATCH] md: chang...
502
503
  struct md_sysfs_entry {
  	struct attribute attr;
fd01b88c7   NeilBrown   md: remove typede...
504
505
  	ssize_t (*show)(struct mddev *, char *);
  	ssize_t (*store)(struct mddev *, const char *, size_t);
007583c92   NeilBrown   [PATCH] md: chang...
506
  };
43a705076   NeilBrown   md: support updat...
507
  extern struct attribute_group md_bitmap_group;
007583c92   NeilBrown   [PATCH] md: chang...
508

324a56e16   Tejun Heo   kernfs: s/sysfs_d...
509
  static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name)
00bcb4ac7   NeilBrown   md: reduce depend...
510
511
  {
  	if (sd)
388975ccc   Tejun Heo   sysfs: clean up s...
512
  		return sysfs_get_dirent(sd, name);
00bcb4ac7   NeilBrown   md: reduce depend...
513
514
  	return sd;
  }
324a56e16   Tejun Heo   kernfs: s/sysfs_d...
515
  static inline void sysfs_notify_dirent_safe(struct kernfs_node *sd)
00bcb4ac7   NeilBrown   md: reduce depend...
516
517
518
519
  {
  	if (sd)
  		sysfs_notify_dirent(sd);
  }
fd01b88c7   NeilBrown   md: remove typede...
520
  static inline char * mdname (struct mddev * mddev)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
521
522
523
  {
  	return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
  }
fd01b88c7   NeilBrown   md: remove typede...
524
  static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev)
36fad858a   Namhyung Kim   md: introduce lin...
525
526
  {
  	char nm[20];
9b15603db   Shaohua Li   MD: change journa...
527
528
529
  	if (!test_bit(Replacement, &rdev->flags) &&
  	    !test_bit(Journal, &rdev->flags) &&
  	    mddev->kobj.sd) {
2d78f8c45   NeilBrown   md: create extern...
530
531
532
533
  		sprintf(nm, "rd%d", rdev->raid_disk);
  		return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
  	} else
  		return 0;
36fad858a   Namhyung Kim   md: introduce lin...
534
  }
fd01b88c7   NeilBrown   md: remove typede...
535
  static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev)
36fad858a   Namhyung Kim   md: introduce lin...
536
537
  {
  	char nm[20];
9b15603db   Shaohua Li   MD: change journa...
538
539
540
  	if (!test_bit(Replacement, &rdev->flags) &&
  	    !test_bit(Journal, &rdev->flags) &&
  	    mddev->kobj.sd) {
2d78f8c45   NeilBrown   md: create extern...
541
542
543
  		sprintf(nm, "rd%d", rdev->raid_disk);
  		sysfs_remove_link(&mddev->kobj, nm);
  	}
36fad858a   Namhyung Kim   md: introduce lin...
544
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
545
546
547
548
  /*
   * iterates through some rdev ringlist. It's safe to remove the
   * current 'rdev'. Dont touch 'tmp' though.
   */
159ec1fc0   Cheng Renquan   md: use list_for_...
549
550
  #define rdev_for_each_list(rdev, tmp, head)				\
  	list_for_each_entry_safe(rdev, tmp, head, same_set)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
551
552
553
  /*
   * iterates through the 'same array disks' ringlist
   */
dafb20fa3   NeilBrown   md: tidy up rdev_...
554
555
556
557
  #define rdev_for_each(rdev, mddev)				\
  	list_for_each_entry(rdev, &((mddev)->disks), same_set)
  
  #define rdev_for_each_safe(rdev, tmp, mddev)				\
159ec1fc0   Cheng Renquan   md: use list_for_...
558
  	list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
559

4b80991c6   NeilBrown   md: Protect acces...
560
561
  #define rdev_for_each_rcu(rdev, mddev)				\
  	list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
2b8bf3451   NeilBrown   md: remove typede...
562
  struct md_thread {
4ed8731d8   Shaohua Li   MD: change the pa...
563
  	void			(*run) (struct md_thread *thread);
fd01b88c7   NeilBrown   md: remove typede...
564
  	struct mddev		*mddev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
565
  	wait_queue_head_t	wqueue;
f72ffdd68   NeilBrown   md: remove unwant...
566
  	unsigned long		flags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
567
  	struct task_struct	*tsk;
32a7627cf   NeilBrown   [PATCH] md: optim...
568
  	unsigned long		timeout;
4ed8731d8   Shaohua Li   MD: change the pa...
569
  	void			*private;
2b8bf3451   NeilBrown   md: remove typede...
570
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
571
572
  
  #define THREAD_WAKEUP  0
1345b1d8a   NeilBrown   [PATCH] md: defin...
573
574
575
576
  static inline void safe_put_page(struct page *p)
  {
  	if (p) put_page(p);
  }
84fc4b56d   NeilBrown   md: rename "mdk_p...
577
578
  extern int register_md_personality(struct md_personality *p);
  extern int unregister_md_personality(struct md_personality *p);
edb39c9de   Goldwyn Rodrigues   Introduce md_clus...
579
580
581
582
583
  extern int register_md_cluster_operations(struct md_cluster_operations *ops,
  		struct module *module);
  extern int unregister_md_cluster_operations(void);
  extern int md_setup_cluster(struct mddev *mddev, int nodes);
  extern void md_cluster_stop(struct mddev *mddev);
2b8bf3451   NeilBrown   md: remove typede...
584
  extern struct md_thread *md_register_thread(
4ed8731d8   Shaohua Li   MD: change the pa...
585
  	void (*run)(struct md_thread *thread),
2b8bf3451   NeilBrown   md: remove typede...
586
587
588
589
  	struct mddev *mddev,
  	const char *name);
  extern void md_unregister_thread(struct md_thread **threadp);
  extern void md_wakeup_thread(struct md_thread *thread);
fd01b88c7   NeilBrown   md: remove typede...
590
  extern void md_check_recovery(struct mddev *mddev);
a91d5ac04   Jonathan Brassow   MD: Export 'md_re...
591
  extern void md_reap_sync_thread(struct mddev *mddev);
fd01b88c7   NeilBrown   md: remove typede...
592
593
594
595
  extern void md_write_start(struct mddev *mddev, struct bio *bi);
  extern void md_write_end(struct mddev *mddev);
  extern void md_done_sync(struct mddev *mddev, int blocks, int ok);
  extern void md_error(struct mddev *mddev, struct md_rdev *rdev);
c6563a8c3   NeilBrown   md: add possibili...
596
  extern void md_finish_reshape(struct mddev *mddev);
fd01b88c7   NeilBrown   md: remove typede...
597
598
599
600
  
  extern int mddev_congested(struct mddev *mddev, int bits);
  extern void md_flush_request(struct mddev *mddev, struct bio *bio);
  extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
92022950c   NeilBrown   md: move most con...
601
  			   sector_t sector, int size, struct page *page);
fd01b88c7   NeilBrown   md: remove typede...
602
  extern void md_super_wait(struct mddev *mddev);
f72ffdd68   NeilBrown   md: remove unwant...
603
  extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
796a5cf08   Mike Christie   md: use bio op ac...
604
605
  			struct page *page, int op, int op_flags,
  			bool metadata_op);
4ed8731d8   Shaohua Li   MD: change the pa...
606
  extern void md_do_sync(struct md_thread *thread);
fd01b88c7   NeilBrown   md: remove typede...
607
608
609
610
611
612
  extern void md_new_event(struct mddev *mddev);
  extern int md_allow_write(struct mddev *mddev);
  extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev);
  extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors);
  extern int md_check_no_bitmap(struct mddev *mddev);
  extern int md_integrity_register(struct mddev *mddev);
1501efadc   Dan Williams   md/raid: only per...
613
  extern int md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev);
72e02075a   NeilBrown   md: factor out pa...
614
  extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
63fe08177   Christoph Hellwig   md: tiny md.h cle...
615

fd01b88c7   NeilBrown   md: remove typede...
616
617
618
619
  extern void mddev_init(struct mddev *mddev);
  extern int md_run(struct mddev *mddev);
  extern void md_stop(struct mddev *mddev);
  extern void md_stop_writes(struct mddev *mddev);
3cb030020   NeilBrown   md: removing type...
620
  extern int md_rdev_init(struct md_rdev *rdev);
545c87957   NeilBrown   md: dm-raid shoul...
621
  extern void md_rdev_clear(struct md_rdev *rdev);
63fe08177   Christoph Hellwig   md: tiny md.h cle...
622

fd01b88c7   NeilBrown   md: remove typede...
623
624
  extern void mddev_suspend(struct mddev *mddev);
  extern void mddev_resume(struct mddev *mddev);
a167f6632   NeilBrown   md: use separate ...
625
  extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask,
fd01b88c7   NeilBrown   md: remove typede...
626
  				   struct mddev *mddev);
a167f6632   NeilBrown   md: use separate ...
627
  extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
fd01b88c7   NeilBrown   md: remove typede...
628
  				   struct mddev *mddev);
9cbb17508   NeilBrown   blk: centralize n...
629

74018dc30   NeilBrown   blk: pass from_sc...
630
  extern void md_unplug(struct blk_plug_cb *cb, bool from_schedule);
70bcecdb1   Goldwyn Rodrigues   md-cluster: Impro...
631
  extern void md_reload_sb(struct mddev *mddev, int raid_disk);
1aee41f63   Goldwyn Rodrigues   Add new disk to c...
632
  extern void md_update_sb(struct mddev *mddev, int force);
fb56dfef4   Goldwyn Rodrigues   md: Export and re...
633
  extern void md_kick_rdev_from_array(struct md_rdev * rdev);
57d051dcc   Goldwyn Rodrigues   md: Export and re...
634
  struct md_rdev *md_find_rdev_nr_rcu(struct mddev *mddev, int nr);
9cbb17508   NeilBrown   blk: centralize n...
635
636
637
638
639
  static inline int mddev_check_plugged(struct mddev *mddev)
  {
  	return !!blk_check_plugged(md_unplug, mddev,
  				   sizeof(struct blk_plug_cb));
  }
dfe15ac1c   Hannes Reinecke   md: wakeup thread...
640
641
642
643
644
645
646
647
648
  
  static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
  {
  	int faulty = test_bit(Faulty, &rdev->flags);
  	if (atomic_dec_and_test(&rdev->nr_pending) && faulty) {
  		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
  		md_wakeup_thread(mddev->thread);
  	}
  }
edb39c9de   Goldwyn Rodrigues   Introduce md_clus...
649
  extern struct md_cluster_operations *md_cluster_ops;
c4ce867fd   Goldwyn Rodrigues   Introduce md_clus...
650
651
652
653
  static inline int mddev_is_clustered(struct mddev *mddev)
  {
  	return mddev->cluster_info && mddev->bitmap_info.nodes > 1;
  }
63fe08177   Christoph Hellwig   md: tiny md.h cle...
654
  #endif /* _MD_MD_H */