Blame view
drivers/md/md.h
20.3 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
7e8415262 trival: md_k.h sh... |
2 |
md.h : kernel internal structure of the Linux MD driver |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 6 7 8 9 10 11 12 13 |
Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman 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. You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
63fe08177 md: tiny md.h cle... |
14 15 16 17 18 19 20 21 22 23 24 |
#ifndef _MD_MD_H #define _MD_MD_H #include <linux/blkdev.h> #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> |
9361401eb [PATCH] BLOCK: Ma... |
25 |
|
1da177e4c Linux-2.6.12-rc2 |
26 |
#define MaxSector (~(sector_t)0) |
1da177e4c Linux-2.6.12-rc2 |
27 |
|
2230dfe4c md: beginnings of... |
28 29 30 31 32 33 |
/* Bad block numbers are stored sorted in a single page. * 64bits is used for each block or extent. * 54 bits are sector number, 9 bits are extent size, * 1 bit is an 'acknowledged' flag. */ #define MD_MAX_BADBLOCKS (PAGE_SIZE/8) |
1da177e4c Linux-2.6.12-rc2 |
34 |
/* |
1da177e4c Linux-2.6.12-rc2 |
35 36 |
* MD's 'extended' device */ |
3cb030020 md: removing type... |
37 |
struct md_rdev { |
1da177e4c Linux-2.6.12-rc2 |
38 |
struct list_head same_set; /* RAID devices within the same set */ |
dd8ac336c md: Represent rai... |
39 |
sector_t sectors; /* Device size (in 512bytes sectors) */ |
fd01b88c7 md: remove typede... |
40 |
struct mddev *mddev; /* RAID array if running */ |
eea1bf384 md: Fix is_mddev_... |
41 |
int last_events; /* IO event timestamp */ |
1da177e4c Linux-2.6.12-rc2 |
42 |
|
a6ff7e089 md: separate meta... |
43 44 45 46 47 48 |
/* * 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 Linux-2.6.12-rc2 |
49 |
struct block_device *bdev; /* block device handle */ |
2699b6722 md: load/store ba... |
50 |
struct page *sb_page, *bb_page; |
1da177e4c Linux-2.6.12-rc2 |
51 |
int sb_loaded; |
425437691 [PATCH] md: Don't... |
52 |
__u64 sb_events; |
1da177e4c Linux-2.6.12-rc2 |
53 |
sector_t data_offset; /* start of data in array */ |
0f420358e md: Turn rdev->sb... |
54 |
sector_t sb_start; /* offset of the super block (in 512byte sectors) */ |
0002b2718 [PATCH] md: limit... |
55 |
int sb_size; /* bytes in the superblock */ |
1da177e4c Linux-2.6.12-rc2 |
56 |
int preferred_minor; /* autorun support */ |
86e6ffdd2 [PATCH] md: exten... |
57 |
struct kobject kobj; |
1da177e4c Linux-2.6.12-rc2 |
58 59 60 61 62 63 64 65 66 67 |
/* 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 Linux-2.6.12-rc2 |
68 |
|
2d78f8c45 md: create extern... |
69 |
unsigned long flags; /* bit set of 'enum flag_bits' bits. */ |
6bfe0b499 md: support block... |
70 |
wait_queue_head_t blocked_wait; |
8ddf9efe6 [PATCH] md: suppo... |
71 |
|
1da177e4c Linux-2.6.12-rc2 |
72 73 |
int desc_nr; /* descriptor index in the superblock */ int raid_disk; /* role of device in array */ |
e93f68a1f md: fix handling ... |
74 75 76 |
int new_raid_disk; /* role that the device will have in * the array after a level-change completes. */ |
41158c7eb [PATCH] md: optim... |
77 78 79 80 |
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 */ |
5fd6c1dce [PATCH] md: allow... |
81 82 83 84 |
sector_t recovery_offset;/* If this device has been partially * recovered, this is where we were * up to. */ |
1da177e4c Linux-2.6.12-rc2 |
85 86 87 88 89 |
atomic_t nr_pending; /* number of pending requests. * only maintained for arrays that * support hot removal */ |
ba22dcbf1 [PATCH] md: impro... |
90 91 92 |
atomic_t read_errors; /* number of consecutive read errors that * we have tried to ignore. */ |
1e50915fe raid: improve MD/... |
93 94 95 |
struct timespec last_read_error; /* monotonic time since our * last read error */ |
4dbcdc751 [PATCH] md: count... |
96 97 98 99 |
atomic_t corrected_errors; /* number of corrected read errors, * for reporting to userspace and storing * in superblock. */ |
5792a2856 [PATCH] md: avoid... |
100 |
struct work_struct del_work; /* used for delayed sysfs removal */ |
3c0ee63a6 md: use sysfs_not... |
101 102 103 |
struct sysfs_dirent *sysfs_state; /* handle for 'state' * sysfs entry */ |
2230dfe4c md: beginnings of... |
104 105 106 |
struct badblocks { int count; /* count of bad blocks */ |
de393cdea md: make it easie... |
107 108 109 110 |
int unacked_exist; /* there probably are unacknowledged * bad blocks. This is only cleared * when a read discovers none */ |
2230dfe4c md: beginnings of... |
111 112 113 114 115 116 |
int shift; /* shift from sectors to block size * a -ve shift means badblocks are * disabled.*/ u64 *page; /* badblock list */ int changed; seqlock_t lock; |
2699b6722 md: load/store ba... |
117 118 119 |
sector_t sector; sector_t size; /* in sectors */ |
2230dfe4c md: beginnings of... |
120 |
} badblocks; |
1da177e4c Linux-2.6.12-rc2 |
121 |
}; |
2d78f8c45 md: create extern... |
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 151 152 153 154 155 156 157 158 159 |
enum flag_bits { Faulty, /* device is known to have a fault */ In_sync, /* device is in_sync with rest of array */ 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. */ }; |
1da177e4c Linux-2.6.12-rc2 |
160 |
|
2230dfe4c md: beginnings of... |
161 162 163 164 165 166 167 168 169 170 171 |
#define BB_LEN_MASK (0x00000000000001FFULL) #define BB_OFFSET_MASK (0x7FFFFFFFFFFFFE00ULL) #define BB_ACK_MASK (0x8000000000000000ULL) #define BB_MAX_LEN 512 #define BB_OFFSET(x) (((x) & BB_OFFSET_MASK) >> 9) #define BB_LEN(x) (((x) & BB_LEN_MASK) + 1) #define BB_ACK(x) (!!((x) & BB_ACK_MASK)) #define BB_MAKE(a, l, ack) (((a)<<9) | ((l)-1) | ((u64)(!!(ack)) << 63)) extern int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors); |
3cb030020 md: removing type... |
172 |
static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors, |
2230dfe4c md: beginnings of... |
173 174 175 176 177 178 179 180 181 182 183 184 |
sector_t *first_bad, int *bad_sectors) { if (unlikely(rdev->badblocks.count)) { int rv = md_is_badblock(&rdev->badblocks, rdev->data_offset + s, sectors, first_bad, bad_sectors); if (rv) *first_bad -= rdev->data_offset; return rv; } return 0; } |
3cb030020 md: removing type... |
185 |
extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, |
2230dfe4c md: beginnings of... |
186 |
int acknowledged); |
3cb030020 md: removing type... |
187 |
extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors); |
2230dfe4c md: beginnings of... |
188 |
extern void md_ack_all_badblocks(struct badblocks *bb); |
fd01b88c7 md: remove typede... |
189 |
struct mddev { |
1da177e4c Linux-2.6.12-rc2 |
190 |
void *private; |
84fc4b56d md: rename "mdk_p... |
191 |
struct md_personality *pers; |
1da177e4c Linux-2.6.12-rc2 |
192 193 194 |
dev_t unit; int md_minor; struct list_head disks; |
850b2b420 [PATCH] md: repla... |
195 196 197 |
unsigned long flags; #define MD_CHANGE_DEVS 0 /* Some device status has changed */ #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ |
070dc6dd7 md: resolve confu... |
198 |
#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ |
9c81075f4 MD: support initi... |
199 |
#define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */ |
850b2b420 [PATCH] md: repla... |
200 |
|
409c57f38 md: enable suspen... |
201 202 |
int suspended; atomic_t active_io; |
1da177e4c Linux-2.6.12-rc2 |
203 |
int ro; |
bb4f1e9d0 md: fix another d... |
204 205 206 207 |
int sysfs_active; /* set when sysfs deletes * are happening, so run/ * takeover/stop are not safe */ |
0ca69886a md: Ensure no IO ... |
208 209 |
int ready; /* See when safe to pass * IO requests down */ |
1da177e4c Linux-2.6.12-rc2 |
210 |
struct gendisk *gendisk; |
eae1701fb [PATCH] md: initi... |
211 |
struct kobject kobj; |
d3374825c md: make devices ... |
212 213 |
int hold_active; #define UNTIL_IOCTL 1 |
efeb53c0e md: Allow md devi... |
214 |
#define UNTIL_STOP 2 |
eae1701fb [PATCH] md: initi... |
215 |
|
1da177e4c Linux-2.6.12-rc2 |
216 217 218 219 220 |
/* Superblock information */ int major_version, minor_version, patch_version; int persistent; |
e691063a6 md: support 'exte... |
221 222 223 |
int external; /* metadata is * managed externally */ char metadata_type[17]; /* externally set*/ |
9d8f03636 md: Make mddev->c... |
224 |
int chunk_sectors; |
1da177e4c Linux-2.6.12-rc2 |
225 226 |
time_t ctime, utime; int level, layout; |
d9d166c2a [PATCH] md: allow... |
227 |
char clevel[16]; |
1da177e4c Linux-2.6.12-rc2 |
228 229 |
int raid_disks; int max_disks; |
58c0fed40 md: Make mddev->s... |
230 231 |
sector_t dev_sectors; /* used size of * component devices */ |
f233ea5c9 md: Make mddev->a... |
232 |
sector_t array_sectors; /* exported array size */ |
b522adcde md: 'array_size' ... |
233 234 |
int external_size; /* size managed * externally */ |
1da177e4c Linux-2.6.12-rc2 |
235 |
__u64 events; |
a8707c08f md: simplify upda... |
236 237 238 239 240 241 |
/* 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 Linux-2.6.12-rc2 |
242 243 |
char uuid[16]; |
f67055780 [PATCH] md: Check... |
244 245 246 247 248 249 |
/* 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 md: Convert mddev... |
250 251 |
int delta_disks, new_level, new_layout; int new_chunk_sectors; |
f67055780 [PATCH] md: Check... |
252 |
|
97658cdd3 md: provide gener... |
253 254 255 |
atomic_t plug_cnt; /* If device is expecting * more bios soon. */ |
2b8bf3451 md: remove typede... |
256 257 |
struct md_thread *thread; /* management thread */ struct md_thread *sync_thread; /* doing resync or reconstruct */ |
ff4e8d9a9 [PATCH] md: fix r... |
258 |
sector_t curr_resync; /* last block scheduled */ |
97e4f42d6 md: occasionally ... |
259 260 261 262 263 264 265 |
/* 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 Linux-2.6.12-rc2 |
266 267 |
unsigned long resync_mark; /* a recent timestamp */ sector_t resync_mark_cnt;/* blocks written at resync_mark */ |
ff4e8d9a9 [PATCH] md: fix r... |
268 |
sector_t curr_mark_cnt; /* blocks scheduled now */ |
1da177e4c Linux-2.6.12-rc2 |
269 270 |
sector_t resync_max_sectors; /* may be set by personality */ |
9d88883e6 [PATCH] md: teach... |
271 272 273 274 |
sector_t resync_mismatches; /* count of sectors where * parity/replica mismatch found */ |
e464eafdb [PATCH] md: Suppo... |
275 276 277 278 |
/* allow user-space to request suspension of IO to regions of the array */ sector_t suspend_lo; sector_t suspend_hi; |
88202a0c8 [PATCH] md: allow... |
279 280 281 |
/* if zero, use the system-wide default */ int sync_speed_min; int sync_speed_max; |
90b08710e md: allow paralle... |
282 283 |
/* resync even though the same disks are shared among md-devices */ int parallel_resync; |
6ff8d8ec0 [PATCH] md: allow... |
284 |
int ok_start_degraded; |
1da177e4c Linux-2.6.12-rc2 |
285 286 287 288 |
/* recovery/resync flags * 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 Make sure all cha... |
289 |
* RECOVER: doing recovery, or need to try it. |
dfc706450 md: restart recov... |
290 |
* INTR: resync needs to be aborted for some reason |
1da177e4c Linux-2.6.12-rc2 |
291 |
* DONE: thread is done and is waiting to be reaped |
24dd469d7 [PATCH] md: allow... |
292 |
* REQUEST: user-space has requested a sync (used with SYNC) |
411c94038 trivial: fix typo... |
293 |
* CHECK: user-space request for check-only, no repair |
ccfcc3c10 [PATCH] md: Core ... |
294 295 296 |
* RESHAPE: A reshape is happening * * If neither SYNC or RESHAPE are set, then it is a recovery. |
1da177e4c Linux-2.6.12-rc2 |
297 298 299 |
*/ #define MD_RECOVERY_RUNNING 0 #define MD_RECOVERY_SYNC 1 |
72a23c211 Make sure all cha... |
300 |
#define MD_RECOVERY_RECOVER 2 |
1da177e4c Linux-2.6.12-rc2 |
301 302 303 |
#define MD_RECOVERY_INTR 3 #define MD_RECOVERY_DONE 4 #define MD_RECOVERY_NEEDED 5 |
24dd469d7 [PATCH] md: allow... |
304 305 |
#define MD_RECOVERY_REQUESTED 6 #define MD_RECOVERY_CHECK 7 |
ccfcc3c10 [PATCH] md: Core ... |
306 |
#define MD_RECOVERY_RESHAPE 8 |
5fd6c1dce [PATCH] md: allow... |
307 |
#define MD_RECOVERY_FROZEN 9 |
1da177e4c Linux-2.6.12-rc2 |
308 |
unsigned long recovery; |
5389042ff md: change manage... |
309 310 311 312 313 314 |
/* 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 Linux-2.6.12-rc2 |
315 316 |
int in_sync; /* know to not need resync */ |
c8c00a691 Remove deadlock p... |
317 318 319 320 321 322 323 324 325 326 |
/* '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 [PATCH] md: Conve... |
327 |
struct mutex reconfig_mutex; |
f2ea68cf4 md: only count ac... |
328 329 |
atomic_t active; /* general refcount */ atomic_t openers; /* number of active opens */ |
1da177e4c Linux-2.6.12-rc2 |
330 |
|
f0b4f7e2f md: Fix - again -... |
331 332 |
int changed; /* True if we might need to * reread partition info */ |
1da177e4c Linux-2.6.12-rc2 |
333 334 335 336 337 338 339 |
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 Allow setting sta... |
340 341 |
sector_t resync_min; /* user requested sync * starts here */ |
c62072777 md: allow a maxim... |
342 343 |
sector_t resync_max; /* resync should pause * when it gets here */ |
06d91a5fe [PATCH] md: impro... |
344 |
|
b62b75905 md: use sysfs_not... |
345 346 347 |
struct sysfs_dirent *sysfs_state; /* handle for 'array_state' * file in sysfs. */ |
0c3573f19 md: use sysfs_not... |
348 |
struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */ |
b62b75905 md: use sysfs_not... |
349 |
|
d3374825c md: make devices ... |
350 |
struct work_struct del_work; /* used for delayed sysfs removal */ |
06d91a5fe [PATCH] md: impro... |
351 |
spinlock_t write_lock; |
3d310eb7b [PATCH] md: fix d... |
352 |
wait_queue_head_t sb_wait; /* for waiting on superblock updates */ |
7bfa19f27 [PATCH] md: allow... |
353 |
atomic_t pending_writes; /* number of active superblock writes */ |
06d91a5fe [PATCH] md: impro... |
354 |
|
1da177e4c Linux-2.6.12-rc2 |
355 356 357 358 359 360 |
unsigned int safemode; /* if set, update "clean" superblock * when no writes pending. */ unsigned int safemode_delay; struct timer_list safemode_timer; atomic_t writes_pending; |
165125e1e [BLOCK] Get rid o... |
361 |
struct request_queue *queue; /* for plugging ... */ |
1da177e4c Linux-2.6.12-rc2 |
362 |
|
32a7627cf [PATCH] md: optim... |
363 |
struct bitmap *bitmap; /* the bitmap for the device */ |
c3d9714e8 md: collect bitma... |
364 365 |
struct { struct file *file; /* the bitmap file */ |
f6af949c5 md: support bitma... |
366 |
loff_t offset; /* offset from superblock of |
c3d9714e8 md: collect bitma... |
367 368 |
* start of bitmap. May be * negative, but not '0' |
f6af949c5 md: support bitma... |
369 370 |
* For external metadata, offset * from start of device. |
c3d9714e8 md: collect bitma... |
371 |
*/ |
f6af949c5 md: support bitma... |
372 |
loff_t default_offset; /* this is the offset to use when |
c3d9714e8 md: collect bitma... |
373 374 375 376 |
* hot-adding a bitmap. It should * eventually be settable by sysfs. */ struct mutex mutex; |
42a04b507 md: move offset, ... |
377 |
unsigned long chunksize; |
ac2f40be4 md/bitmap: white ... |
378 |
unsigned long daemon_sleep; /* how many jiffies between updates? */ |
42a04b507 md: move offset, ... |
379 |
unsigned long max_write_behind; /* write-behind mode */ |
ece5cff0d md: Support write... |
380 |
int external; |
c3d9714e8 md: collect bitma... |
381 |
} bitmap_info; |
32a7627cf [PATCH] md: optim... |
382 |
|
1e50915fe raid: improve MD/... |
383 |
atomic_t max_corr_read_errors; /* max read retries */ |
1da177e4c Linux-2.6.12-rc2 |
384 |
struct list_head all_mddevs; |
a2826aa92 md: support barri... |
385 |
|
a64c876fd md: manage redund... |
386 |
struct attribute_group *to_remove; |
252ac5221 md/plug: optional... |
387 |
|
a167f6632 md: use separate ... |
388 |
struct bio_set *bio_set; |
e9c7469bb md: implment REQ_... |
389 390 391 |
/* Generic flush handling. * The last to finish preflush schedules a worker to submit * the rest of the request (without the REQ_FLUSH flag). |
a2826aa92 md: support barri... |
392 |
*/ |
e9c7469bb md: implment REQ_... |
393 |
struct bio *flush_bio; |
a2826aa92 md: support barri... |
394 |
atomic_t flush_pending; |
e9c7469bb md: implment REQ_... |
395 |
struct work_struct flush_work; |
768a418db md: add support f... |
396 |
struct work_struct event_work; /* used by dm to report failure event */ |
fd01b88c7 md: remove typede... |
397 |
void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev); |
1da177e4c Linux-2.6.12-rc2 |
398 |
}; |
fd01b88c7 md: remove typede... |
399 |
static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev) |
1da177e4c Linux-2.6.12-rc2 |
400 |
{ |
b2d444d7a [PATCH] md: conve... |
401 |
int faulty = test_bit(Faulty, &rdev->flags); |
1da177e4c Linux-2.6.12-rc2 |
402 403 404 405 406 407 408 409 |
if (atomic_dec_and_test(&rdev->nr_pending) && faulty) set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); } static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors) { atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); } |
84fc4b56d md: rename "mdk_p... |
410 |
struct md_personality |
1da177e4c Linux-2.6.12-rc2 |
411 412 |
{ char *name; |
2604b703b [PATCH] md: remov... |
413 414 |
int level; struct list_head list; |
1da177e4c Linux-2.6.12-rc2 |
415 |
struct module *owner; |
b4fdcb02f Merge branch 'for... |
416 |
void (*make_request)(struct mddev *mddev, struct bio *bio); |
fd01b88c7 md: remove typede... |
417 418 419 |
int (*run)(struct mddev *mddev); int (*stop)(struct mddev *mddev); void (*status)(struct seq_file *seq, struct mddev *mddev); |
1da177e4c Linux-2.6.12-rc2 |
420 421 422 |
/* error_handler must set ->faulty and clear ->in_sync * if appropriate, and should abort recovery if needed */ |
fd01b88c7 md: remove typede... |
423 424 |
void (*error_handler)(struct mddev *mddev, struct md_rdev *rdev); int (*hot_add_disk) (struct mddev *mddev, struct md_rdev *rdev); |
b8321b68d md: change hot_re... |
425 |
int (*hot_remove_disk) (struct mddev *mddev, struct md_rdev *rdev); |
fd01b88c7 md: remove typede... |
426 427 428 429 430 431 432 |
int (*spare_active) (struct mddev *mddev); sector_t (*sync_request)(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster); 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 [PATCH] md: all h... |
433 434 435 436 437 |
/* quiesce moves between quiescence states * 0 - fully active * 1 - no new requests allowed * others - reserved */ |
fd01b88c7 md: remove typede... |
438 |
void (*quiesce) (struct mddev *mddev, int state); |
245f46c2c md: add ->takeove... |
439 440 441 442 443 444 445 446 447 |
/* 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 md: remove typede... |
448 |
void *(*takeover) (struct mddev *mddev); |
1da177e4c Linux-2.6.12-rc2 |
449 |
}; |
007583c92 [PATCH] md: chang... |
450 451 |
struct md_sysfs_entry { struct attribute attr; |
fd01b88c7 md: remove typede... |
452 453 |
ssize_t (*show)(struct mddev *, char *); ssize_t (*store)(struct mddev *, const char *, size_t); |
007583c92 [PATCH] md: chang... |
454 |
}; |
43a705076 md: support updat... |
455 |
extern struct attribute_group md_bitmap_group; |
007583c92 [PATCH] md: chang... |
456 |
|
00bcb4ac7 md: reduce depend... |
457 458 459 460 461 462 463 464 465 466 467 |
static inline struct sysfs_dirent *sysfs_get_dirent_safe(struct sysfs_dirent *sd, char *name) { if (sd) return sysfs_get_dirent(sd, NULL, name); return sd; } static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd) { if (sd) sysfs_notify_dirent(sd); } |
fd01b88c7 md: remove typede... |
468 |
static inline char * mdname (struct mddev * mddev) |
1da177e4c Linux-2.6.12-rc2 |
469 470 471 |
{ return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; } |
fd01b88c7 md: remove typede... |
472 |
static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) |
36fad858a md: introduce lin... |
473 474 |
{ char nm[20]; |
2d78f8c45 md: create extern... |
475 476 477 478 479 |
if (!test_bit(Replacement, &rdev->flags)) { sprintf(nm, "rd%d", rdev->raid_disk); return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); } else return 0; |
36fad858a md: introduce lin... |
480 |
} |
fd01b88c7 md: remove typede... |
481 |
static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) |
36fad858a md: introduce lin... |
482 483 |
{ char nm[20]; |
2d78f8c45 md: create extern... |
484 485 486 487 |
if (!test_bit(Replacement, &rdev->flags)) { sprintf(nm, "rd%d", rdev->raid_disk); sysfs_remove_link(&mddev->kobj, nm); } |
36fad858a md: introduce lin... |
488 |
} |
1da177e4c Linux-2.6.12-rc2 |
489 490 491 492 |
/* * iterates through some rdev ringlist. It's safe to remove the * current 'rdev'. Dont touch 'tmp' though. */ |
159ec1fc0 md: use list_for_... |
493 494 |
#define rdev_for_each_list(rdev, tmp, head) \ list_for_each_entry_safe(rdev, tmp, head, same_set) |
1da177e4c Linux-2.6.12-rc2 |
495 496 497 |
/* * iterates through the 'same array disks' ringlist */ |
d089c6af1 md: change ITERAT... |
498 |
#define rdev_for_each(rdev, tmp, mddev) \ |
159ec1fc0 md: use list_for_... |
499 |
list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set) |
1da177e4c Linux-2.6.12-rc2 |
500 |
|
4b80991c6 md: Protect acces... |
501 502 |
#define rdev_for_each_rcu(rdev, mddev) \ list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) |
2b8bf3451 md: remove typede... |
503 |
struct md_thread { |
fd01b88c7 md: remove typede... |
504 505 |
void (*run) (struct mddev *mddev); struct mddev *mddev; |
1da177e4c Linux-2.6.12-rc2 |
506 507 |
wait_queue_head_t wqueue; unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
508 |
struct task_struct *tsk; |
32a7627cf [PATCH] md: optim... |
509 |
unsigned long timeout; |
2b8bf3451 md: remove typede... |
510 |
}; |
1da177e4c Linux-2.6.12-rc2 |
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
#define THREAD_WAKEUP 0 #define __wait_event_lock_irq(wq, condition, lock, cmd) \ do { \ wait_queue_t __wait; \ init_waitqueue_entry(&__wait, current); \ \ add_wait_queue(&wq, &__wait); \ for (;;) { \ set_current_state(TASK_UNINTERRUPTIBLE); \ if (condition) \ break; \ spin_unlock_irq(&lock); \ cmd; \ schedule(); \ spin_lock_irq(&lock); \ } \ current->state = TASK_RUNNING; \ remove_wait_queue(&wq, &__wait); \ } while (0) #define wait_event_lock_irq(wq, condition, lock, cmd) \ do { \ if (condition) \ break; \ __wait_event_lock_irq(wq, condition, lock, cmd); \ } while (0) |
1345b1d8a [PATCH] md: defin... |
539 540 541 542 |
static inline void safe_put_page(struct page *p) { if (p) put_page(p); } |
84fc4b56d md: rename "mdk_p... |
543 544 |
extern int register_md_personality(struct md_personality *p); extern int unregister_md_personality(struct md_personality *p); |
2b8bf3451 md: remove typede... |
545 546 547 548 549 550 |
extern struct md_thread *md_register_thread( void (*run)(struct mddev *mddev), 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 md: remove typede... |
551 552 553 554 555 556 557 558 559 |
extern void md_check_recovery(struct mddev *mddev); 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); 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 md: move most con... |
560 |
sector_t sector, int size, struct page *page); |
fd01b88c7 md: remove typede... |
561 |
extern void md_super_wait(struct mddev *mddev); |
3cb030020 md: removing type... |
562 |
extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, |
ccebd4c41 md-new-param-to_s... |
563 |
struct page *page, int rw, bool metadata_op); |
fd01b88c7 md: remove typede... |
564 565 566 567 568 569 570 571 |
extern void md_do_sync(struct mddev *mddev); 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); extern void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev); |
72e02075a md: factor out pa... |
572 |
extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); |
43a705076 md: support updat... |
573 |
extern void restore_bitmap_write_access(struct file *file); |
63fe08177 md: tiny md.h cle... |
574 |
|
fd01b88c7 md: remove typede... |
575 576 577 578 |
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 md: removing type... |
579 |
extern int md_rdev_init(struct md_rdev *rdev); |
63fe08177 md: tiny md.h cle... |
580 |
|
fd01b88c7 md: remove typede... |
581 582 |
extern void mddev_suspend(struct mddev *mddev); extern void mddev_resume(struct mddev *mddev); |
a167f6632 md: use separate ... |
583 |
extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, |
fd01b88c7 md: remove typede... |
584 |
struct mddev *mddev); |
a167f6632 md: use separate ... |
585 |
extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
fd01b88c7 md: remove typede... |
586 587 |
struct mddev *mddev); extern int mddev_check_plugged(struct mddev *mddev); |
d2eb35acf md/raid1: avoid r... |
588 |
extern void md_trim_bio(struct bio *bio, int offset, int size); |
63fe08177 md: tiny md.h cle... |
589 |
#endif /* _MD_MD_H */ |