]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/md/md.h
md/raid1: avoid reading known bad blocks during resync
[mirror_ubuntu-bionic-kernel.git] / drivers / md / md.h
CommitLineData
1da177e4
LT
1/*
2 md_k.h : kernel internal structure of the Linux MD driver
3 Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 You should have received a copy of the GNU General Public License
11 (for example /usr/src/linux/COPYING); if not, write to the Free
12 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13*/
14
63fe0817
CH
15#ifndef _MD_MD_H
16#define _MD_MD_H
17
18#include <linux/blkdev.h>
19#include <linux/kobject.h>
20#include <linux/list.h>
21#include <linux/mm.h>
22#include <linux/mutex.h>
23#include <linux/timer.h>
24#include <linux/wait.h>
25#include <linux/workqueue.h>
9361401e 26
1da177e4 27#define MaxSector (~(sector_t)0)
1da177e4 28
1da177e4
LT
29typedef struct mddev_s mddev_t;
30typedef struct mdk_rdev_s mdk_rdev_t;
31
2230dfe4
N
32/* Bad block numbers are stored sorted in a single page.
33 * 64bits is used for each block or extent.
34 * 54 bits are sector number, 9 bits are extent size,
35 * 1 bit is an 'acknowledged' flag.
36 */
37#define MD_MAX_BADBLOCKS (PAGE_SIZE/8)
38
1da177e4
LT
39/*
40 * MD's 'extended' device
41 */
42struct mdk_rdev_s
43{
44 struct list_head same_set; /* RAID devices within the same set */
45
dd8ac336 46 sector_t sectors; /* Device size (in 512bytes sectors) */
1da177e4 47 mddev_t *mddev; /* RAID array if running */
eea1bf38 48 int last_events; /* IO event timestamp */
1da177e4 49
a6ff7e08
JB
50 /*
51 * If meta_bdev is non-NULL, it means that a separate device is
52 * being used to store the metadata (superblock/bitmap) which
53 * would otherwise be contained on the same device as the data (bdev).
54 */
55 struct block_device *meta_bdev;
1da177e4
LT
56 struct block_device *bdev; /* block device handle */
57
2699b672 58 struct page *sb_page, *bb_page;
1da177e4 59 int sb_loaded;
42543769 60 __u64 sb_events;
1da177e4 61 sector_t data_offset; /* start of data in array */
0f420358 62 sector_t sb_start; /* offset of the super block (in 512byte sectors) */
0002b271 63 int sb_size; /* bytes in the superblock */
1da177e4
LT
64 int preferred_minor; /* autorun support */
65
86e6ffdd
N
66 struct kobject kobj;
67
1da177e4
LT
68 /* A device can be in one of three states based on two flags:
69 * Not working: faulty==1 in_sync==0
70 * Fully working: faulty==0 in_sync==1
71 * Working, but not
72 * in sync with array
73 * faulty==0 in_sync==0
74 *
75 * It can never have faulty==1, in_sync==1
76 * This reduces the burden of testing multiple flags in many cases
77 */
1da177e4 78
b2d444d7
N
79 unsigned long flags;
80#define Faulty 1 /* device is known to have a fault */
81#define In_sync 2 /* device is in_sync with rest of array */
8ddf9efe 82#define WriteMostly 4 /* Avoid reading if at all possible */
d0fae18f 83#define AutoDetected 7 /* added by auto-detect */
25985edc 84#define Blocked 8 /* An error occurred on an externally
6bfe0b49
DW
85 * managed array, don't allow writes
86 * until it is cleared */
87 wait_queue_head_t blocked_wait;
8ddf9efe 88
1da177e4
LT
89 int desc_nr; /* descriptor index in the superblock */
90 int raid_disk; /* role of device in array */
e93f68a1
N
91 int new_raid_disk; /* role that the device will have in
92 * the array after a level-change completes.
93 */
41158c7e
N
94 int saved_raid_disk; /* role that device used to have in the
95 * array and could again if we did a partial
96 * resync from the bitmap
97 */
5fd6c1dc
N
98 sector_t recovery_offset;/* If this device has been partially
99 * recovered, this is where we were
100 * up to.
101 */
1da177e4
LT
102
103 atomic_t nr_pending; /* number of pending requests.
104 * only maintained for arrays that
105 * support hot removal
106 */
ba22dcbf
N
107 atomic_t read_errors; /* number of consecutive read errors that
108 * we have tried to ignore.
109 */
1e50915f
RB
110 struct timespec last_read_error; /* monotonic time since our
111 * last read error
112 */
4dbcdc75
N
113 atomic_t corrected_errors; /* number of corrected read errors,
114 * for reporting to userspace and storing
115 * in superblock.
116 */
5792a285 117 struct work_struct del_work; /* used for delayed sysfs removal */
3c0ee63a
N
118
119 struct sysfs_dirent *sysfs_state; /* handle for 'state'
120 * sysfs entry */
2230dfe4
N
121
122 struct badblocks {
123 int count; /* count of bad blocks */
124 int shift; /* shift from sectors to block size
125 * a -ve shift means badblocks are
126 * disabled.*/
127 u64 *page; /* badblock list */
128 int changed;
129 seqlock_t lock;
2699b672
N
130
131 sector_t sector;
132 sector_t size; /* in sectors */
2230dfe4 133 } badblocks;
1da177e4
LT
134};
135
2230dfe4
N
136#define BB_LEN_MASK (0x00000000000001FFULL)
137#define BB_OFFSET_MASK (0x7FFFFFFFFFFFFE00ULL)
138#define BB_ACK_MASK (0x8000000000000000ULL)
139#define BB_MAX_LEN 512
140#define BB_OFFSET(x) (((x) & BB_OFFSET_MASK) >> 9)
141#define BB_LEN(x) (((x) & BB_LEN_MASK) + 1)
142#define BB_ACK(x) (!!((x) & BB_ACK_MASK))
143#define BB_MAKE(a, l, ack) (((a)<<9) | ((l)-1) | ((u64)(!!(ack)) << 63))
144
145extern int md_is_badblock(struct badblocks *bb, sector_t s, int sectors,
146 sector_t *first_bad, int *bad_sectors);
147static inline int is_badblock(mdk_rdev_t *rdev, sector_t s, int sectors,
148 sector_t *first_bad, int *bad_sectors)
149{
150 if (unlikely(rdev->badblocks.count)) {
151 int rv = md_is_badblock(&rdev->badblocks, rdev->data_offset + s,
152 sectors,
153 first_bad, bad_sectors);
154 if (rv)
155 *first_bad -= rdev->data_offset;
156 return rv;
157 }
158 return 0;
159}
160extern int rdev_set_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors,
161 int acknowledged);
162extern int rdev_clear_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors);
163extern void md_ack_all_badblocks(struct badblocks *bb);
164
1da177e4
LT
165struct mddev_s
166{
167 void *private;
2604b703 168 struct mdk_personality *pers;
1da177e4
LT
169 dev_t unit;
170 int md_minor;
171 struct list_head disks;
850b2b42
N
172 unsigned long flags;
173#define MD_CHANGE_DEVS 0 /* Some device status has changed */
174#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
070dc6dd 175#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */
9c81075f 176#define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */
850b2b42 177
409c57f3
N
178 int suspended;
179 atomic_t active_io;
1da177e4 180 int ro;
bb4f1e9d
N
181 int sysfs_active; /* set when sysfs deletes
182 * are happening, so run/
183 * takeover/stop are not safe
184 */
0ca69886
N
185 int ready; /* See when safe to pass
186 * IO requests down */
1da177e4
LT
187 struct gendisk *gendisk;
188
eae1701f 189 struct kobject kobj;
d3374825
N
190 int hold_active;
191#define UNTIL_IOCTL 1
efeb53c0 192#define UNTIL_STOP 2
eae1701f 193
1da177e4
LT
194 /* Superblock information */
195 int major_version,
196 minor_version,
197 patch_version;
198 int persistent;
e691063a
N
199 int external; /* metadata is
200 * managed externally */
201 char metadata_type[17]; /* externally set*/
9d8f0363 202 int chunk_sectors;
1da177e4
LT
203 time_t ctime, utime;
204 int level, layout;
d9d166c2 205 char clevel[16];
1da177e4
LT
206 int raid_disks;
207 int max_disks;
58c0fed4
AN
208 sector_t dev_sectors; /* used size of
209 * component devices */
f233ea5c 210 sector_t array_sectors; /* exported array size */
b522adcd
DW
211 int external_size; /* size managed
212 * externally */
1da177e4 213 __u64 events;
a8707c08
N
214 /* If the last 'event' was simply a clean->dirty transition, and
215 * we didn't write it to the spares, then it is safe and simple
216 * to just decrement the event count on a dirty->clean transition.
217 * So we record that possibility here.
218 */
219 int can_decrease_events;
1da177e4
LT
220
221 char uuid[16];
222
f6705578
N
223 /* If the array is being reshaped, we need to record the
224 * new shape and an indication of where we are up to.
225 * This is written to the superblock.
226 * If reshape_position is MaxSector, then no reshape is happening (yet).
227 */
228 sector_t reshape_position;
664e7c41
AN
229 int delta_disks, new_level, new_layout;
230 int new_chunk_sectors;
f6705578 231
97658cdd
N
232 atomic_t plug_cnt; /* If device is expecting
233 * more bios soon.
234 */
1da177e4
LT
235 struct mdk_thread_s *thread; /* management thread */
236 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
ff4e8d9a 237 sector_t curr_resync; /* last block scheduled */
97e4f42d
N
238 /* As resync requests can complete out of order, we cannot easily track
239 * how much resync has been completed. So we occasionally pause until
240 * everything completes, then set curr_resync_completed to curr_resync.
241 * As such it may be well behind the real resync mark, but it is a value
242 * we are certain of.
243 */
244 sector_t curr_resync_completed;
1da177e4
LT
245 unsigned long resync_mark; /* a recent timestamp */
246 sector_t resync_mark_cnt;/* blocks written at resync_mark */
ff4e8d9a 247 sector_t curr_mark_cnt; /* blocks scheduled now */
1da177e4
LT
248
249 sector_t resync_max_sectors; /* may be set by personality */
9d88883e
N
250
251 sector_t resync_mismatches; /* count of sectors where
252 * parity/replica mismatch found
253 */
e464eafd
N
254
255 /* allow user-space to request suspension of IO to regions of the array */
256 sector_t suspend_lo;
257 sector_t suspend_hi;
88202a0c
N
258 /* if zero, use the system-wide default */
259 int sync_speed_min;
260 int sync_speed_max;
261
90b08710
BS
262 /* resync even though the same disks are shared among md-devices */
263 int parallel_resync;
264
6ff8d8ec 265 int ok_start_degraded;
1da177e4
LT
266 /* recovery/resync flags
267 * NEEDED: we might need to start a resync/recover
268 * RUNNING: a thread is running, or about to be started
269 * SYNC: actually doing a resync, not a recovery
72a23c21 270 * RECOVER: doing recovery, or need to try it.
dfc70645 271 * INTR: resync needs to be aborted for some reason
1da177e4 272 * DONE: thread is done and is waiting to be reaped
24dd469d 273 * REQUEST: user-space has requested a sync (used with SYNC)
411c9403 274 * CHECK: user-space request for check-only, no repair
ccfcc3c1
N
275 * RESHAPE: A reshape is happening
276 *
277 * If neither SYNC or RESHAPE are set, then it is a recovery.
1da177e4
LT
278 */
279#define MD_RECOVERY_RUNNING 0
280#define MD_RECOVERY_SYNC 1
72a23c21 281#define MD_RECOVERY_RECOVER 2
1da177e4
LT
282#define MD_RECOVERY_INTR 3
283#define MD_RECOVERY_DONE 4
284#define MD_RECOVERY_NEEDED 5
24dd469d
N
285#define MD_RECOVERY_REQUESTED 6
286#define MD_RECOVERY_CHECK 7
ccfcc3c1 287#define MD_RECOVERY_RESHAPE 8
5fd6c1dc
N
288#define MD_RECOVERY_FROZEN 9
289
1da177e4 290 unsigned long recovery;
5389042f
N
291 /* If a RAID personality determines that recovery (of a particular
292 * device) will fail due to a read error on the source device, it
293 * takes a copy of this number and does not attempt recovery again
294 * until this number changes.
295 */
296 int recovery_disabled;
1da177e4
LT
297
298 int in_sync; /* know to not need resync */
c8c00a69
N
299 /* 'open_mutex' avoids races between 'md_open' and 'do_md_stop', so
300 * that we are never stopping an array while it is open.
301 * 'reconfig_mutex' protects all other reconfiguration.
302 * These locks are separate due to conflicting interactions
303 * with bdev->bd_mutex.
304 * Lock ordering is:
305 * reconfig_mutex -> bd_mutex : e.g. do_md_run -> revalidate_disk
306 * bd_mutex -> open_mutex: e.g. __blkdev_get -> md_open
307 */
308 struct mutex open_mutex;
df5b89b3 309 struct mutex reconfig_mutex;
f2ea68cf
N
310 atomic_t active; /* general refcount */
311 atomic_t openers; /* number of active opens */
1da177e4 312
f0b4f7e2
N
313 int changed; /* True if we might need to
314 * reread partition info */
1da177e4
LT
315 int degraded; /* whether md should consider
316 * adding a spare
317 */
318
319 atomic_t recovery_active; /* blocks scheduled, but not written */
320 wait_queue_head_t recovery_wait;
321 sector_t recovery_cp;
5e96ee65
NB
322 sector_t resync_min; /* user requested sync
323 * starts here */
c6207277
N
324 sector_t resync_max; /* resync should pause
325 * when it gets here */
06d91a5f 326
b62b7590
N
327 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
328 * file in sysfs.
329 */
0c3573f1 330 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
b62b7590 331
d3374825
N
332 struct work_struct del_work; /* used for delayed sysfs removal */
333
06d91a5f 334 spinlock_t write_lock;
3d310eb7 335 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
7bfa19f2 336 atomic_t pending_writes; /* number of active superblock writes */
06d91a5f 337
1da177e4
LT
338 unsigned int safemode; /* if set, update "clean" superblock
339 * when no writes pending.
340 */
341 unsigned int safemode_delay;
342 struct timer_list safemode_timer;
343 atomic_t writes_pending;
165125e1 344 struct request_queue *queue; /* for plugging ... */
1da177e4 345
32a7627c 346 struct bitmap *bitmap; /* the bitmap for the device */
c3d9714e
N
347 struct {
348 struct file *file; /* the bitmap file */
f6af949c 349 loff_t offset; /* offset from superblock of
c3d9714e
N
350 * start of bitmap. May be
351 * negative, but not '0'
f6af949c
N
352 * For external metadata, offset
353 * from start of device.
c3d9714e 354 */
f6af949c 355 loff_t default_offset; /* this is the offset to use when
c3d9714e
N
356 * hot-adding a bitmap. It should
357 * eventually be settable by sysfs.
358 */
359 struct mutex mutex;
42a04b50 360 unsigned long chunksize;
ac2f40be 361 unsigned long daemon_sleep; /* how many jiffies between updates? */
42a04b50 362 unsigned long max_write_behind; /* write-behind mode */
ece5cff0 363 int external;
c3d9714e 364 } bitmap_info;
32a7627c 365
1e50915f 366 atomic_t max_corr_read_errors; /* max read retries */
1da177e4 367 struct list_head all_mddevs;
a2826aa9 368
a64c876f 369 struct attribute_group *to_remove;
252ac522 370
a167f663
N
371 struct bio_set *bio_set;
372
e9c7469b
TH
373 /* Generic flush handling.
374 * The last to finish preflush schedules a worker to submit
375 * the rest of the request (without the REQ_FLUSH flag).
a2826aa9 376 */
e9c7469b 377 struct bio *flush_bio;
a2826aa9 378 atomic_t flush_pending;
e9c7469b 379 struct work_struct flush_work;
768a418d 380 struct work_struct event_work; /* used by dm to report failure event */
076f968b 381 void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev);
1da177e4
LT
382};
383
384
385static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
386{
b2d444d7 387 int faulty = test_bit(Faulty, &rdev->flags);
1da177e4
LT
388 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
389 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
390}
391
392static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
393{
394 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
395}
396
2604b703 397struct mdk_personality
1da177e4
LT
398{
399 char *name;
2604b703
N
400 int level;
401 struct list_head list;
1da177e4 402 struct module *owner;
21a52c6d 403 int (*make_request)(mddev_t *mddev, struct bio *bio);
1da177e4
LT
404 int (*run)(mddev_t *mddev);
405 int (*stop)(mddev_t *mddev);
406 void (*status)(struct seq_file *seq, mddev_t *mddev);
407 /* error_handler must set ->faulty and clear ->in_sync
408 * if appropriate, and should abort recovery if needed
409 */
410 void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev);
411 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
412 int (*hot_remove_disk) (mddev_t *mddev, int number);
413 int (*spare_active) (mddev_t *mddev);
57afd89f 414 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
1da177e4 415 int (*resize) (mddev_t *mddev, sector_t sectors);
80c3a6ce 416 sector_t (*size) (mddev_t *mddev, sector_t sectors, int raid_disks);
63c70c4f
N
417 int (*check_reshape) (mddev_t *mddev);
418 int (*start_reshape) (mddev_t *mddev);
cea9c228 419 void (*finish_reshape) (mddev_t *mddev);
36fa3063
N
420 /* quiesce moves between quiescence states
421 * 0 - fully active
422 * 1 - no new requests allowed
423 * others - reserved
424 */
425 void (*quiesce) (mddev_t *mddev, int state);
245f46c2
N
426 /* takeover is used to transition an array from one
427 * personality to another. The new personality must be able
428 * to handle the data in the current layout.
429 * e.g. 2drive raid1 -> 2drive raid5
430 * ndrive raid5 -> degraded n+1drive raid6 with special layout
431 * If the takeover succeeds, a new 'private' structure is returned.
432 * This needs to be installed and then ->run used to activate the
433 * array.
434 */
435 void *(*takeover) (mddev_t *mddev);
1da177e4
LT
436};
437
438
007583c9
N
439struct md_sysfs_entry {
440 struct attribute attr;
441 ssize_t (*show)(mddev_t *, char *);
442 ssize_t (*store)(mddev_t *, const char *, size_t);
443};
43a70507 444extern struct attribute_group md_bitmap_group;
007583c9 445
00bcb4ac
N
446static inline struct sysfs_dirent *sysfs_get_dirent_safe(struct sysfs_dirent *sd, char *name)
447{
448 if (sd)
449 return sysfs_get_dirent(sd, NULL, name);
450 return sd;
451}
452static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd)
453{
454 if (sd)
455 sysfs_notify_dirent(sd);
456}
457
1da177e4
LT
458static inline char * mdname (mddev_t * mddev)
459{
460 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
461}
462
36fad858
NK
463static inline int sysfs_link_rdev(mddev_t *mddev, mdk_rdev_t *rdev)
464{
465 char nm[20];
466 sprintf(nm, "rd%d", rdev->raid_disk);
467 return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
468}
469
470static inline void sysfs_unlink_rdev(mddev_t *mddev, mdk_rdev_t *rdev)
471{
472 char nm[20];
473 sprintf(nm, "rd%d", rdev->raid_disk);
474 sysfs_remove_link(&mddev->kobj, nm);
475}
476
1da177e4
LT
477/*
478 * iterates through some rdev ringlist. It's safe to remove the
479 * current 'rdev'. Dont touch 'tmp' though.
480 */
159ec1fc
CR
481#define rdev_for_each_list(rdev, tmp, head) \
482 list_for_each_entry_safe(rdev, tmp, head, same_set)
483
1da177e4
LT
484/*
485 * iterates through the 'same array disks' ringlist
486 */
d089c6af 487#define rdev_for_each(rdev, tmp, mddev) \
159ec1fc 488 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
1da177e4 489
4b80991c
N
490#define rdev_for_each_rcu(rdev, mddev) \
491 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
492
1da177e4
LT
493typedef struct mdk_thread_s {
494 void (*run) (mddev_t *mddev);
495 mddev_t *mddev;
496 wait_queue_head_t wqueue;
497 unsigned long flags;
1da177e4 498 struct task_struct *tsk;
32a7627c 499 unsigned long timeout;
1da177e4
LT
500} mdk_thread_t;
501
502#define THREAD_WAKEUP 0
503
504#define __wait_event_lock_irq(wq, condition, lock, cmd) \
505do { \
506 wait_queue_t __wait; \
507 init_waitqueue_entry(&__wait, current); \
508 \
509 add_wait_queue(&wq, &__wait); \
510 for (;;) { \
511 set_current_state(TASK_UNINTERRUPTIBLE); \
512 if (condition) \
513 break; \
514 spin_unlock_irq(&lock); \
515 cmd; \
516 schedule(); \
517 spin_lock_irq(&lock); \
518 } \
519 current->state = TASK_RUNNING; \
520 remove_wait_queue(&wq, &__wait); \
521} while (0)
522
523#define wait_event_lock_irq(wq, condition, lock, cmd) \
524do { \
525 if (condition) \
526 break; \
527 __wait_event_lock_irq(wq, condition, lock, cmd); \
528} while (0)
529
1345b1d8
N
530static inline void safe_put_page(struct page *p)
531{
532 if (p) put_page(p);
533}
534
92022950
N
535extern int register_md_personality(struct mdk_personality *p);
536extern int unregister_md_personality(struct mdk_personality *p);
537extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
538 mddev_t *mddev, const char *name);
539extern void md_unregister_thread(mdk_thread_t *thread);
540extern void md_wakeup_thread(mdk_thread_t *thread);
541extern void md_check_recovery(mddev_t *mddev);
542extern void md_write_start(mddev_t *mddev, struct bio *bi);
543extern void md_write_end(mddev_t *mddev);
544extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
545extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
546
3fa841d7 547extern int mddev_congested(mddev_t *mddev, int bits);
e9c7469b 548extern void md_flush_request(mddev_t *mddev, struct bio *bio);
92022950
N
549extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
550 sector_t sector, int size, struct page *page);
551extern void md_super_wait(mddev_t *mddev);
ccebd4c4
JB
552extern int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size,
553 struct page *page, int rw, bool metadata_op);
92022950
N
554extern void md_do_sync(mddev_t *mddev);
555extern void md_new_event(mddev_t *mddev);
556extern int md_allow_write(mddev_t *mddev);
557extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
1f403624 558extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors);
0894cc30 559extern int md_check_no_bitmap(mddev_t *mddev);
ac5e7113 560extern int md_integrity_register(mddev_t *mddev);
72e02075
N
561extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
562extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
43a70507 563extern void restore_bitmap_write_access(struct file *file);
63fe0817 564
390ee602
N
565extern void mddev_init(mddev_t *mddev);
566extern int md_run(mddev_t *mddev);
567extern void md_stop(mddev_t *mddev);
568extern void md_stop_writes(mddev_t *mddev);
2230dfe4 569extern int md_rdev_init(mdk_rdev_t *rdev);
63fe0817 570
390ee602
N
571extern void mddev_suspend(mddev_t *mddev);
572extern void mddev_resume(mddev_t *mddev);
a167f663
N
573extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask,
574 mddev_t *mddev);
575extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
576 mddev_t *mddev);
97658cdd 577extern int mddev_check_plugged(mddev_t *mddev);
d2eb35ac 578extern void md_trim_bio(struct bio *bio, int offset, int size);
63fe0817 579#endif /* _MD_MD_H */