Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 437 lines (374 sloc) 14.247 kb
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
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
15 #ifndef _MD_K_H
16 #define _MD_K_H
17
9361401 [PATCH] BLOCK: Make it possible to disable the block layer [try #6]
David Howells authored
18 #ifdef CONFIG_BLOCK
19
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
20 #define MaxSector (~(sector_t)0)
21
22 typedef struct mddev_s mddev_t;
23 typedef struct mdk_rdev_s mdk_rdev_t;
24
25 /*
26 * options passed in raidrun:
27 */
28
e8703fe @neilbrown [PATCH] md: remove MAX_MD_DEVS which is an arbitrary limit
neilbrown authored
29 /* Currently this must fit in an 'int' */
8932c2e @neilbrown [PATCH] md: remove arbitrary limit on chunk size
neilbrown authored
30 #define MAX_CHUNK_SIZE (1<<30)
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
31
32 /*
33 * MD's 'extended' device
34 */
35 struct mdk_rdev_s
36 {
37 struct list_head same_set; /* RAID devices within the same set */
38
dd8ac33 md: Represent raid device size in sectors.
Andre Noll authored
39 sector_t sectors; /* Device size (in 512bytes sectors) */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
40 mddev_t *mddev; /* RAID array if running */
eea1bf3 @neilbrown md: Fix is_mddev_idle test (again).
neilbrown authored
41 int last_events; /* IO event timestamp */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
42
43 struct block_device *bdev; /* block device handle */
44
45 struct page *sb_page;
46 int sb_loaded;
4254376 @neilbrown [PATCH] md: Don't write dirty/clean update to spares - leave them alone
neilbrown authored
47 __u64 sb_events;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
48 sector_t data_offset; /* start of data in array */
0f42035 md: Turn rdev->sb_offset into a sector-based quantity.
Andre Noll authored
49 sector_t sb_start; /* offset of the super block (in 512byte sectors) */
0002b27 [PATCH] md: limit size of sb read/written to appropriate amount
NeilBrown authored
50 int sb_size; /* bytes in the superblock */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
51 int preferred_minor; /* autorun support */
52
86e6ffd @neilbrown [PATCH] md: extend md sysfs support to component devices.
neilbrown authored
53 struct kobject kobj;
54
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
55 /* A device can be in one of three states based on two flags:
56 * Not working: faulty==1 in_sync==0
57 * Fully working: faulty==0 in_sync==1
58 * Working, but not
59 * in sync with array
60 * faulty==0 in_sync==0
61 *
62 * It can never have faulty==1, in_sync==1
63 * This reduces the burden of testing multiple flags in many cases
64 */
65
b2d444d @neilbrown [PATCH] md: convert 'faulty' and 'in_sync' fields to bits in 'flags' …
neilbrown authored
66 unsigned long flags;
67 #define Faulty 1 /* device is known to have a fault */
68 #define In_sync 2 /* device is in_sync with rest of array */
8ddf9ef [PATCH] md: support write-mostly device in raid1
NeilBrown authored
69 #define WriteMostly 4 /* Avoid reading if at all possible */
a9701a3 @neilbrown [PATCH] md: support BIO_RW_BARRIER for md/raid1
neilbrown authored
70 #define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */
c5d79ad @neilbrown md: allow devices to be shared between md arrays
neilbrown authored
71 #define AllReserved 6 /* If whole device is reserved for
72 * one array */
d0fae18 @neilbrown md: clean up irregularity with raid autodetect
neilbrown authored
73 #define AutoDetected 7 /* added by auto-detect */
6bfe0b4 @djbw md: support blocking writes to an array on device failure
djbw authored
74 #define Blocked 8 /* An error occured on an externally
75 * managed array, don't allow writes
76 * until it is cleared */
5266473 Make sure all changes to md/dev-XX/state are notified
Neil Brown authored
77 #define StateChanged 9 /* Faulty or Blocked has changed during
78 * interrupt, so it needs to be
79 * notified by the thread */
6bfe0b4 @djbw md: support blocking writes to an array on device failure
djbw authored
80 wait_queue_head_t blocked_wait;
8ddf9ef [PATCH] md: support write-mostly device in raid1
NeilBrown authored
81
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
82 int desc_nr; /* descriptor index in the superblock */
83 int raid_disk; /* role of device in array */
41158c7 [PATCH] md: optimise reconstruction when re-adding a recently failed …
NeilBrown authored
84 int saved_raid_disk; /* role that device used to have in the
85 * array and could again if we did a partial
86 * resync from the bitmap
87 */
5fd6c1d @neilbrown [PATCH] md: allow checkpoint of recovery with version-1 superblock
neilbrown authored
88 sector_t recovery_offset;/* If this device has been partially
89 * recovered, this is where we were
90 * up to.
91 */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
92
93 atomic_t nr_pending; /* number of pending requests.
94 * only maintained for arrays that
95 * support hot removal
96 */
ba22dcb @neilbrown [PATCH] md: improvements to raid5 handling of read errors
neilbrown authored
97 atomic_t read_errors; /* number of consecutive read errors that
98 * we have tried to ignore.
99 */
4dbcdc7 @neilbrown [PATCH] md: count corrected read errors per drive
neilbrown authored
100 atomic_t corrected_errors; /* number of corrected read errors,
101 * for reporting to userspace and storing
102 * in superblock.
103 */
5792a28 @neilbrown [PATCH] md: avoid a deadlock when removing a device from an md array …
neilbrown authored
104 struct work_struct del_work; /* used for delayed sysfs removal */
3c0ee63 @neilbrown md: use sysfs_notify_dirent to notify changes to md/dev-xxx/state
neilbrown authored
105
106 struct sysfs_dirent *sysfs_state; /* handle for 'state'
107 * sysfs entry */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
108 };
109
110 struct mddev_s
111 {
112 void *private;
2604b70 @neilbrown [PATCH] md: remove personality numbering from md
neilbrown authored
113 struct mdk_personality *pers;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
114 dev_t unit;
115 int md_minor;
116 struct list_head disks;
850b2b4 @neilbrown [PATCH] md: replace magic numbers in sb_dirty with well defined bit f…
neilbrown authored
117 unsigned long flags;
118 #define MD_CHANGE_DEVS 0 /* Some device status has changed */
119 #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
120 #define MD_CHANGE_PENDING 2 /* superblock update in progress */
121
409c57f @neilbrown md: enable suspend/resume of md devices.
neilbrown authored
122 int suspended;
123 atomic_t active_io;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
124 int ro;
125
126 struct gendisk *gendisk;
127
eae1701 @neilbrown [PATCH] md: initial sysfs support for md
neilbrown authored
128 struct kobject kobj;
d337482 @neilbrown md: make devices disappear when they are no longer needed.
neilbrown authored
129 int hold_active;
130 #define UNTIL_IOCTL 1
efeb53c @neilbrown md: Allow md devices to be created by name.
neilbrown authored
131 #define UNTIL_STOP 2
eae1701 @neilbrown [PATCH] md: initial sysfs support for md
neilbrown authored
132
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
133 /* Superblock information */
134 int major_version,
135 minor_version,
136 patch_version;
137 int persistent;
e691063 @neilbrown md: support 'external' metadata for md arrays
neilbrown authored
138 int external; /* metadata is
139 * managed externally */
140 char metadata_type[17]; /* externally set*/
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
141 int chunk_size;
142 time_t ctime, utime;
143 int level, layout;
d9d166c @neilbrown [PATCH] md: allow array level to be set textually via sysfs
neilbrown authored
144 char clevel[16];
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
145 int raid_disks;
146 int max_disks;
58c0fed md: Make mddev->size sector-based.
Andre Noll authored
147 sector_t dev_sectors; /* used size of
148 * component devices */
f233ea5 md: Make mddev->array_size sector-based.
Andre Noll authored
149 sector_t array_sectors; /* exported array size */
b522adc @djbw md: 'array_size' sysfs attribute
djbw authored
150 int external_size; /* size managed
151 * externally */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
152 __u64 events;
153
154 char uuid[16];
155
f670557 @neilbrown [PATCH] md: Checkpoint and allow restart of raid5 reshape
neilbrown authored
156 /* If the array is being reshaped, we need to record the
157 * new shape and an indication of where we are up to.
158 * This is written to the superblock.
159 * If reshape_position is MaxSector, then no reshape is happening (yet).
160 */
161 sector_t reshape_position;
162 int delta_disks, new_level, new_layout, new_chunk;
163
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
164 struct mdk_thread_s *thread; /* management thread */
165 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
ff4e8d9 @neilbrown [PATCH] md: fix resync speed calculation for restarted resyncs
neilbrown authored
166 sector_t curr_resync; /* last block scheduled */
97e4f42 @neilbrown md: occasionally checkpoint drive recovery to reduce duplicate effort…
neilbrown authored
167 /* As resync requests can complete out of order, we cannot easily track
168 * how much resync has been completed. So we occasionally pause until
169 * everything completes, then set curr_resync_completed to curr_resync.
170 * As such it may be well behind the real resync mark, but it is a value
171 * we are certain of.
172 */
173 sector_t curr_resync_completed;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
174 unsigned long resync_mark; /* a recent timestamp */
175 sector_t resync_mark_cnt;/* blocks written at resync_mark */
ff4e8d9 @neilbrown [PATCH] md: fix resync speed calculation for restarted resyncs
neilbrown authored
176 sector_t curr_mark_cnt; /* blocks scheduled now */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
177
178 sector_t resync_max_sectors; /* may be set by personality */
9d88883 @neilbrown [PATCH] md: teach raid5 the difference between 'check' and 'repair'.
neilbrown authored
179
180 sector_t resync_mismatches; /* count of sectors where
181 * parity/replica mismatch found
182 */
e464eaf @neilbrown [PATCH] md: Support suspending of IO to regions of an md array
neilbrown authored
183
184 /* allow user-space to request suspension of IO to regions of the array */
185 sector_t suspend_lo;
186 sector_t suspend_hi;
88202a0 @neilbrown [PATCH] md: allow sync-speed to be controlled per-device
neilbrown authored
187 /* if zero, use the system-wide default */
188 int sync_speed_min;
189 int sync_speed_max;
190
90b0871 md: allow parallel resync of md-devices.
Bernd Schubert authored
191 /* resync even though the same disks are shared among md-devices */
192 int parallel_resync;
193
6ff8d8e @neilbrown [PATCH] md: allow dirty raid[456] arrays to be started at boot
neilbrown authored
194 int ok_start_degraded;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
195 /* recovery/resync flags
196 * NEEDED: we might need to start a resync/recover
197 * RUNNING: a thread is running, or about to be started
198 * SYNC: actually doing a resync, not a recovery
72a23c2 Make sure all changes to md/sync_action are notified.
Neil Brown authored
199 * RECOVER: doing recovery, or need to try it.
dfc7064 @neilbrown md: restart recovery cleanly after device failure.
neilbrown authored
200 * INTR: resync needs to be aborted for some reason
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
201 * DONE: thread is done and is waiting to be reaped
24dd469 @neilbrown [PATCH] md: allow a manual resync with md
neilbrown authored
202 * REQUEST: user-space has requested a sync (used with SYNC)
203 * CHECK: user-space request for for check-only, no repair
ccfcc3c @neilbrown [PATCH] md: Core of raid5 resize process
neilbrown authored
204 * RESHAPE: A reshape is happening
205 *
206 * If neither SYNC or RESHAPE are set, then it is a recovery.
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
207 */
208 #define MD_RECOVERY_RUNNING 0
209 #define MD_RECOVERY_SYNC 1
72a23c2 Make sure all changes to md/sync_action are notified.
Neil Brown authored
210 #define MD_RECOVERY_RECOVER 2
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
211 #define MD_RECOVERY_INTR 3
212 #define MD_RECOVERY_DONE 4
213 #define MD_RECOVERY_NEEDED 5
24dd469 @neilbrown [PATCH] md: allow a manual resync with md
neilbrown authored
214 #define MD_RECOVERY_REQUESTED 6
215 #define MD_RECOVERY_CHECK 7
ccfcc3c @neilbrown [PATCH] md: Core of raid5 resize process
neilbrown authored
216 #define MD_RECOVERY_RESHAPE 8
5fd6c1d @neilbrown [PATCH] md: allow checkpoint of recovery with version-1 superblock
neilbrown authored
217 #define MD_RECOVERY_FROZEN 9
218
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
219 unsigned long recovery;
4044ba5 @neilbrown md: don't retry recovery of raid1 that fails due to error on source d…
neilbrown authored
220 int recovery_disabled; /* if we detect that recovery
221 * will always fail, set this
222 * so we don't loop trying */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
223
224 int in_sync; /* know to not need resync */
df5b89b @neilbrown [PATCH] md: Convert reconfig_sem to reconfig_mutex
neilbrown authored
225 struct mutex reconfig_mutex;
f2ea68c @neilbrown md: only count actual openers as access which prevent a 'stop'
neilbrown authored
226 atomic_t active; /* general refcount */
227 atomic_t openers; /* number of active opens */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
228
44ce629 Revert "md: improve partition detection in md array"
Linus Torvalds authored
229 int changed; /* true if we might need to reread partition info */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
230 int degraded; /* whether md should consider
231 * adding a spare
232 */
a9701a3 @neilbrown [PATCH] md: support BIO_RW_BARRIER for md/raid1
neilbrown authored
233 int barriers_work; /* initialised to true, cleared as soon
234 * as a barrier request to slave
235 * fails. Only supported
236 */
237 struct bio *biolist; /* bios that need to be retried
238 * because BIO_RW_BARRIER is not supported
239 */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
240
241 atomic_t recovery_active; /* blocks scheduled, but not written */
242 wait_queue_head_t recovery_wait;
243 sector_t recovery_cp;
5e96ee6 Allow setting start point for requested check/repair
Neil Brown authored
244 sector_t resync_min; /* user requested sync
245 * starts here */
c620727 @neilbrown md: allow a maximum extent to be set for resyncing
neilbrown authored
246 sector_t resync_max; /* resync should pause
247 * when it gets here */
06d91a5 [PATCH] md: improve locking on 'safemode' and move superblock writes
NeilBrown authored
248
b62b759 @neilbrown md: use sysfs_notify_dirent to notify changes to md/array_state
neilbrown authored
249 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
250 * file in sysfs.
251 */
0c3573f @neilbrown md: use sysfs_notify_dirent to notify changes to md/sync_action.
neilbrown authored
252 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
b62b759 @neilbrown md: use sysfs_notify_dirent to notify changes to md/array_state
neilbrown authored
253
d337482 @neilbrown md: make devices disappear when they are no longer needed.
neilbrown authored
254 struct work_struct del_work; /* used for delayed sysfs removal */
255
06d91a5 [PATCH] md: improve locking on 'safemode' and move superblock writes
NeilBrown authored
256 spinlock_t write_lock;
3d310eb [PATCH] md: fix deadlock due to md thread processing delayed requests.
NeilBrown authored
257 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
7bfa19f [PATCH] md: allow md to update multiple superblocks in parallel.
NeilBrown authored
258 atomic_t pending_writes; /* number of active superblock writes */
06d91a5 [PATCH] md: improve locking on 'safemode' and move superblock writes
NeilBrown authored
259
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
260 unsigned int safemode; /* if set, update "clean" superblock
261 * when no writes pending.
262 */
263 unsigned int safemode_delay;
264 struct timer_list safemode_timer;
265 atomic_t writes_pending;
165125e [BLOCK] Get rid of request_queue_t typedef
Jens Axboe authored
266 struct request_queue *queue; /* for plugging ... */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
267
4b6d287 [PATCH] md: add write-behind support for md/raid1
NeilBrown authored
268 atomic_t write_behind; /* outstanding async IO */
269 unsigned int max_write_behind; /* 0 = sync */
270
32a7627 [PATCH] md: optimised resync using Bitmap based intent logging
NeilBrown authored
271 struct bitmap *bitmap; /* the bitmap for the device */
272 struct file *bitmap_file; /* the bitmap file */
a654b9d [PATCH] md: allow md intent bitmap to be stored near the superblock.
NeilBrown authored
273 long bitmap_offset; /* offset from superblock of
274 * start of bitmap. May be
275 * negative, but not '0'
276 */
36fa306 [PATCH] md: all hot-add and hot-remove of md intent logging bitmaps
NeilBrown authored
277 long default_bitmap_offset; /* this is the offset to use when
278 * hot-adding a bitmap. It should
279 * eventually be settable by sysfs.
280 */
32a7627 [PATCH] md: optimised resync using Bitmap based intent logging
NeilBrown authored
281
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
282 struct list_head all_mddevs;
283 };
284
285
286 static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
287 {
b2d444d @neilbrown [PATCH] md: convert 'faulty' and 'in_sync' fields to bits in 'flags' …
neilbrown authored
288 int faulty = test_bit(Faulty, &rdev->flags);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
289 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
290 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
291 }
292
293 static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
294 {
295 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
296 }
297
2604b70 @neilbrown [PATCH] md: remove personality numbering from md
neilbrown authored
298 struct mdk_personality
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
299 {
300 char *name;
2604b70 @neilbrown [PATCH] md: remove personality numbering from md
neilbrown authored
301 int level;
302 struct list_head list;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
303 struct module *owner;
165125e [BLOCK] Get rid of request_queue_t typedef
Jens Axboe authored
304 int (*make_request)(struct request_queue *q, struct bio *bio);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
305 int (*run)(mddev_t *mddev);
306 int (*stop)(mddev_t *mddev);
307 void (*status)(struct seq_file *seq, mddev_t *mddev);
308 /* error_handler must set ->faulty and clear ->in_sync
309 * if appropriate, and should abort recovery if needed
310 */
311 void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev);
312 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
313 int (*hot_remove_disk) (mddev_t *mddev, int number);
314 int (*spare_active) (mddev_t *mddev);
57afd89 [PATCH] md: improve the interface to sync_request
NeilBrown authored
315 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
316 int (*resize) (mddev_t *mddev, sector_t sectors);
80c3a6c @djbw md: add 'size' as a personality method
djbw authored
317 sector_t (*size) (mddev_t *mddev, sector_t sectors, int raid_disks);
63c70c4 @neilbrown [PATCH] md: Split reshape handler in check_reshape and start_reshape
neilbrown authored
318 int (*check_reshape) (mddev_t *mddev);
319 int (*start_reshape) (mddev_t *mddev);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
320 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
36fa306 [PATCH] md: all hot-add and hot-remove of md intent logging bitmaps
NeilBrown authored
321 /* quiesce moves between quiescence states
322 * 0 - fully active
323 * 1 - no new requests allowed
324 * others - reserved
325 */
326 void (*quiesce) (mddev_t *mddev, int state);
245f46c @neilbrown md: add ->takeover method to support changing the personality managin…
neilbrown authored
327 /* takeover is used to transition an array from one
328 * personality to another. The new personality must be able
329 * to handle the data in the current layout.
330 * e.g. 2drive raid1 -> 2drive raid5
331 * ndrive raid5 -> degraded n+1drive raid6 with special layout
332 * If the takeover succeeds, a new 'private' structure is returned.
333 * This needs to be installed and then ->run used to activate the
334 * array.
335 */
336 void *(*takeover) (mddev_t *mddev);
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
337 };
338
339
007583c @neilbrown [PATCH] md: change raid5 sysfs attribute to not create a new directory
neilbrown authored
340 struct md_sysfs_entry {
341 struct attribute attr;
342 ssize_t (*show)(mddev_t *, char *);
343 ssize_t (*store)(mddev_t *, const char *, size_t);
344 };
345
346
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
347 static inline char * mdname (mddev_t * mddev)
348 {
349 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
350 }
351
352 /*
353 * iterates through some rdev ringlist. It's safe to remove the
354 * current 'rdev'. Dont touch 'tmp' though.
355 */
159ec1f @crquan md: use list_for_each_entry macro directly
crquan authored
356 #define rdev_for_each_list(rdev, tmp, head) \
357 list_for_each_entry_safe(rdev, tmp, head, same_set)
358
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
359 /*
360 * iterates through the 'same array disks' ringlist
361 */
d089c6a @neilbrown md: change ITERATE_RDEV to rdev_for_each
neilbrown authored
362 #define rdev_for_each(rdev, tmp, mddev) \
159ec1f @crquan md: use list_for_each_entry macro directly
crquan authored
363 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
364
4b80991 @neilbrown md: Protect access to mddev->disks list using RCU
neilbrown authored
365 #define rdev_for_each_rcu(rdev, mddev) \
366 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
367
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
368 typedef struct mdk_thread_s {
369 void (*run) (mddev_t *mddev);
370 mddev_t *mddev;
371 wait_queue_head_t wqueue;
372 unsigned long flags;
373 struct task_struct *tsk;
32a7627 [PATCH] md: optimised resync using Bitmap based intent logging
NeilBrown authored
374 unsigned long timeout;
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
375 } mdk_thread_t;
376
377 #define THREAD_WAKEUP 0
378
379 #define __wait_event_lock_irq(wq, condition, lock, cmd) \
380 do { \
381 wait_queue_t __wait; \
382 init_waitqueue_entry(&__wait, current); \
383 \
384 add_wait_queue(&wq, &__wait); \
385 for (;;) { \
386 set_current_state(TASK_UNINTERRUPTIBLE); \
387 if (condition) \
388 break; \
389 spin_unlock_irq(&lock); \
390 cmd; \
391 schedule(); \
392 spin_lock_irq(&lock); \
393 } \
394 current->state = TASK_RUNNING; \
395 remove_wait_queue(&wq, &__wait); \
396 } while (0)
397
398 #define wait_event_lock_irq(wq, condition, lock, cmd) \
399 do { \
400 if (condition) \
401 break; \
402 __wait_event_lock_irq(wq, condition, lock, cmd); \
403 } while (0)
404
1345b1d @neilbrown [PATCH] md: define and use safe_put_page for md
neilbrown authored
405 static inline void safe_put_page(struct page *p)
406 {
407 if (p) put_page(p);
408 }
409
9361401 [PATCH] BLOCK: Make it possible to disable the block layer [try #6]
David Howells authored
410 #endif /* CONFIG_BLOCK */
1da177e Linux-2.6.12-rc2
Linus Torvalds authored
411 #endif
412
9202295 @neilbrown md: move most content from md.h to md_k.h
neilbrown authored
413
414 extern int register_md_personality(struct mdk_personality *p);
415 extern int unregister_md_personality(struct mdk_personality *p);
416 extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
417 mddev_t *mddev, const char *name);
418 extern void md_unregister_thread(mdk_thread_t *thread);
419 extern void md_wakeup_thread(mdk_thread_t *thread);
420 extern void md_check_recovery(mddev_t *mddev);
421 extern void md_write_start(mddev_t *mddev, struct bio *bi);
422 extern void md_write_end(mddev_t *mddev);
423 extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
424 extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
425
426 extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
427 sector_t sector, int size, struct page *page);
428 extern void md_super_wait(mddev_t *mddev);
429 extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
430 struct page *page, int rw);
431 extern void md_do_sync(mddev_t *mddev);
432 extern void md_new_event(mddev_t *mddev);
433 extern int md_allow_write(mddev_t *mddev);
434 extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
1f40362 @djbw md: centralize ->array_sectors modifications
djbw authored
435 extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors);
b522adc @djbw md: 'array_size' sysfs attribute
djbw authored
436 extern void md_set_array_sectors_lock(mddev_t *mddev, sector_t array_sectors);
Something went wrong with that request. Please try again.