Blame view
drivers/md/md.h
21.2 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 */ |
c6563a8c3 md: add possibili... |
54 |
sector_t new_data_offset;/* only relevant while reshaping */ |
0f420358e md: Turn rdev->sb... |
55 |
sector_t sb_start; /* offset of the super block (in 512byte sectors) */ |
0002b2718 [PATCH] md: limit... |
56 |
int sb_size; /* bytes in the superblock */ |
1da177e4c Linux-2.6.12-rc2 |
57 |
int preferred_minor; /* autorun support */ |
86e6ffdd2 [PATCH] md: exten... |
58 |
struct kobject kobj; |
1da177e4c Linux-2.6.12-rc2 |
59 60 61 62 63 64 65 66 67 68 |
/* 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 |
69 |
|
2d78f8c45 md: create extern... |
70 |
unsigned long flags; /* bit set of 'enum flag_bits' bits. */ |
6bfe0b499 md: support block... |
71 |
wait_queue_head_t blocked_wait; |
8ddf9efe6 [PATCH] md: suppo... |
72 |
|
1da177e4c Linux-2.6.12-rc2 |
73 74 |
int desc_nr; /* descriptor index in the superblock */ int raid_disk; /* role of device in array */ |
e93f68a1f md: fix handling ... |
75 76 77 |
int new_raid_disk; /* role that the device will have in * the array after a level-change completes. */ |
41158c7eb [PATCH] md: optim... |
78 79 80 81 |
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... |
82 83 84 85 |
sector_t recovery_offset;/* If this device has been partially * recovered, this is where we were * up to. */ |
1da177e4c Linux-2.6.12-rc2 |
86 87 88 89 90 |
atomic_t nr_pending; /* number of pending requests. * only maintained for arrays that * support hot removal */ |
ba22dcbf1 [PATCH] md: impro... |
91 92 93 |
atomic_t read_errors; /* number of consecutive read errors that * we have tried to ignore. */ |
1e50915fe raid: improve MD/... |
94 95 96 |
struct timespec last_read_error; /* monotonic time since our * last read error */ |
4dbcdc751 [PATCH] md: count... |
97 98 99 100 |
atomic_t corrected_errors; /* number of corrected read errors, * for reporting to userspace and storing * in superblock. */ |
5792a2856 [PATCH] md: avoid... |
101 |
struct work_struct del_work; /* used for delayed sysfs removal */ |
3c0ee63a6 md: use sysfs_not... |
102 |
|
324a56e16 kernfs: s/sysfs_d... |
103 |
struct kernfs_node *sysfs_state; /* handle for 'state' |
3c0ee63a6 md: use sysfs_not... |
104 |
* sysfs entry */ |
2230dfe4c md: beginnings of... |
105 106 107 |
struct badblocks { int count; /* count of bad blocks */ |
de393cdea md: make it easie... |
108 109 110 111 |
int unacked_exist; /* there probably are unacknowledged * bad blocks. This is only cleared * when a read discovers none */ |
2230dfe4c md: beginnings of... |
112 113 114 115 116 117 |
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... |
118 119 120 |
sector_t sector; sector_t size; /* in sectors */ |
2230dfe4c md: beginnings of... |
121 |
} badblocks; |
1da177e4c Linux-2.6.12-rc2 |
122 |
}; |
2d78f8c45 md: create extern... |
123 124 125 |
enum flag_bits { Faulty, /* device is known to have a fault */ In_sync, /* device is in_sync with rest of array */ |
8313b8e57 md: fix problem w... |
126 127 128 |
Bitmap_sync, /* ..actually, not quite In_sync. Need a * bitmap-based recovery to get fully in sync */ |
050b66152 md/raid10: handle... |
129 130 131 132 |
Unmerged, /* device is being added to array and should * be considerred for bvec_merge_fn but not * yet for actual IO */ |
2d78f8c45 md: create extern... |
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 160 161 162 163 164 165 166 167 |
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 |
168 |
|
2230dfe4c md: beginnings of... |
169 170 171 172 173 174 175 176 177 178 179 |
#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... |
180 |
static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors, |
2230dfe4c md: beginnings of... |
181 182 183 184 185 186 187 188 189 190 191 192 |
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... |
193 |
extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, |
c6563a8c3 md: add possibili... |
194 195 196 |
int is_new); extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors, int is_new); |
2230dfe4c md: beginnings of... |
197 |
extern void md_ack_all_badblocks(struct badblocks *bb); |
fd01b88c7 md: remove typede... |
198 |
struct mddev { |
1da177e4c Linux-2.6.12-rc2 |
199 |
void *private; |
84fc4b56d md: rename "mdk_p... |
200 |
struct md_personality *pers; |
1da177e4c Linux-2.6.12-rc2 |
201 202 |
dev_t unit; int md_minor; |
7a0a5355c md: Don't test al... |
203 |
struct list_head disks; |
850b2b420 [PATCH] md: repla... |
204 205 206 |
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... |
207 |
#define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ |
7a0a5355c md: Don't test al... |
208 |
#define MD_UPDATE_SB_FLAGS (1 | 2 | 4) /* If these are set, md_update_sb needed */ |
9c81075f4 MD: support initi... |
209 |
#define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */ |
260fa034e md: avoid deadloc... |
210 211 212 |
#define MD_STILL_CLOSED 4 /* If set, then array has not been opened since * md_ioctl checked on it. */ |
850b2b420 [PATCH] md: repla... |
213 |
|
409c57f38 md: enable suspen... |
214 215 |
int suspended; atomic_t active_io; |
1da177e4c Linux-2.6.12-rc2 |
216 |
int ro; |
bb4f1e9d0 md: fix another d... |
217 218 219 220 |
int sysfs_active; /* set when sysfs deletes * are happening, so run/ * takeover/stop are not safe */ |
7a0a5355c md: Don't test al... |
221 |
int ready; /* See when safe to pass |
0ca69886a md: Ensure no IO ... |
222 |
* IO requests down */ |
1da177e4c Linux-2.6.12-rc2 |
223 |
struct gendisk *gendisk; |
eae1701fb [PATCH] md: initi... |
224 |
struct kobject kobj; |
d3374825c md: make devices ... |
225 226 |
int hold_active; #define UNTIL_IOCTL 1 |
efeb53c0e md: Allow md devi... |
227 |
#define UNTIL_STOP 2 |
eae1701fb [PATCH] md: initi... |
228 |
|
1da177e4c Linux-2.6.12-rc2 |
229 230 231 232 233 |
/* Superblock information */ int major_version, minor_version, patch_version; int persistent; |
e691063a6 md: support 'exte... |
234 235 236 |
int external; /* metadata is * managed externally */ char metadata_type[17]; /* externally set*/ |
9d8f03636 md: Make mddev->c... |
237 |
int chunk_sectors; |
1da177e4c Linux-2.6.12-rc2 |
238 239 |
time_t ctime, utime; int level, layout; |
d9d166c2a [PATCH] md: allow... |
240 |
char clevel[16]; |
1da177e4c Linux-2.6.12-rc2 |
241 242 |
int raid_disks; int max_disks; |
58c0fed40 md: Make mddev->s... |
243 244 |
sector_t dev_sectors; /* used size of * component devices */ |
f233ea5c9 md: Make mddev->a... |
245 |
sector_t array_sectors; /* exported array size */ |
b522adcde md: 'array_size' ... |
246 247 |
int external_size; /* size managed * externally */ |
1da177e4c Linux-2.6.12-rc2 |
248 |
__u64 events; |
a8707c08f md: simplify upda... |
249 250 251 252 253 254 |
/* 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 |
255 256 |
char uuid[16]; |
f67055780 [PATCH] md: Check... |
257 258 259 260 261 262 |
/* 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... |
263 264 |
int delta_disks, new_level, new_layout; int new_chunk_sectors; |
2c810cddc md: allow a resha... |
265 |
int reshape_backwards; |
f67055780 [PATCH] md: Check... |
266 |
|
2b8bf3451 md: remove typede... |
267 268 |
struct md_thread *thread; /* management thread */ struct md_thread *sync_thread; /* doing resync or reconstruct */ |
c4a395514 MD: Remember the ... |
269 270 271 272 273 274 275 276 |
/* '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 [PATCH] md: fix r... |
277 |
sector_t curr_resync; /* last block scheduled */ |
97e4f42d6 md: occasionally ... |
278 279 280 281 282 283 284 |
/* 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 |
285 286 |
unsigned long resync_mark; /* a recent timestamp */ sector_t resync_mark_cnt;/* blocks written at resync_mark */ |
ff4e8d9a9 [PATCH] md: fix r... |
287 |
sector_t curr_mark_cnt; /* blocks scheduled now */ |
1da177e4c Linux-2.6.12-rc2 |
288 289 |
sector_t resync_max_sectors; /* may be set by personality */ |
9d88883e6 [PATCH] md: teach... |
290 |
|
7f7583d42 Subject: [PATCH] ... |
291 |
atomic64_t resync_mismatches; /* count of sectors where |
9d88883e6 [PATCH] md: teach... |
292 293 |
* parity/replica mismatch found */ |
e464eafdb [PATCH] md: Suppo... |
294 295 296 297 |
/* 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... |
298 299 300 |
/* if zero, use the system-wide default */ int sync_speed_min; int sync_speed_max; |
90b08710e md: allow paralle... |
301 302 |
/* resync even though the same disks are shared among md-devices */ int parallel_resync; |
6ff8d8ec0 [PATCH] md: allow... |
303 |
int ok_start_degraded; |
1da177e4c Linux-2.6.12-rc2 |
304 305 306 307 |
/* 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... |
308 |
* RECOVER: doing recovery, or need to try it. |
dfc706450 md: restart recov... |
309 |
* INTR: resync needs to be aborted for some reason |
1da177e4c Linux-2.6.12-rc2 |
310 |
* DONE: thread is done and is waiting to be reaped |
24dd469d7 [PATCH] md: allow... |
311 |
* REQUEST: user-space has requested a sync (used with SYNC) |
411c94038 trivial: fix typo... |
312 |
* CHECK: user-space request for check-only, no repair |
ccfcc3c10 [PATCH] md: Core ... |
313 |
* RESHAPE: A reshape is happening |
0a19caabf md: Use ->curr_re... |
314 |
* ERROR: sync-action interrupted because io-error |
ccfcc3c10 [PATCH] md: Core ... |
315 316 |
* * If neither SYNC or RESHAPE are set, then it is a recovery. |
1da177e4c Linux-2.6.12-rc2 |
317 318 319 |
*/ #define MD_RECOVERY_RUNNING 0 #define MD_RECOVERY_SYNC 1 |
72a23c211 Make sure all cha... |
320 |
#define MD_RECOVERY_RECOVER 2 |
1da177e4c Linux-2.6.12-rc2 |
321 322 323 |
#define MD_RECOVERY_INTR 3 #define MD_RECOVERY_DONE 4 #define MD_RECOVERY_NEEDED 5 |
24dd469d7 [PATCH] md: allow... |
324 325 |
#define MD_RECOVERY_REQUESTED 6 #define MD_RECOVERY_CHECK 7 |
ccfcc3c10 [PATCH] md: Core ... |
326 |
#define MD_RECOVERY_RESHAPE 8 |
5fd6c1dce [PATCH] md: allow... |
327 |
#define MD_RECOVERY_FROZEN 9 |
0a19caabf md: Use ->curr_re... |
328 |
#define MD_RECOVERY_ERROR 10 |
5fd6c1dce [PATCH] md: allow... |
329 |
|
1da177e4c Linux-2.6.12-rc2 |
330 |
unsigned long recovery; |
5389042ff md: change manage... |
331 332 333 334 335 336 |
/* 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 |
337 338 |
int in_sync; /* know to not need resync */ |
c8c00a691 Remove deadlock p... |
339 340 341 342 343 344 345 346 347 348 |
/* '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... |
349 |
struct mutex reconfig_mutex; |
f2ea68cf4 md: only count ac... |
350 351 |
atomic_t active; /* general refcount */ atomic_t openers; /* number of active opens */ |
1da177e4c Linux-2.6.12-rc2 |
352 |
|
f0b4f7e2f md: Fix - again -... |
353 354 |
int changed; /* True if we might need to * reread partition info */ |
1da177e4c Linux-2.6.12-rc2 |
355 356 357 |
int degraded; /* whether md should consider * adding a spare */ |
050b66152 md/raid10: handle... |
358 359 360 361 |
int merge_check_needed; /* at least one * member device * has a * merge_bvec_fn */ |
1da177e4c Linux-2.6.12-rc2 |
362 363 364 365 |
atomic_t recovery_active; /* blocks scheduled, but not written */ wait_queue_head_t recovery_wait; sector_t recovery_cp; |
5e96ee65c Allow setting sta... |
366 367 |
sector_t resync_min; /* user requested sync * starts here */ |
c62072777 md: allow a maxim... |
368 369 |
sector_t resync_max; /* resync should pause * when it gets here */ |
06d91a5fe [PATCH] md: impro... |
370 |
|
324a56e16 kernfs: s/sysfs_d... |
371 |
struct kernfs_node *sysfs_state; /* handle for 'array_state' |
b62b75905 md: use sysfs_not... |
372 373 |
* file in sysfs. */ |
324a56e16 kernfs: s/sysfs_d... |
374 |
struct kernfs_node *sysfs_action; /* handle for 'sync_action' */ |
b62b75905 md: use sysfs_not... |
375 |
|
d3374825c md: make devices ... |
376 |
struct work_struct del_work; /* used for delayed sysfs removal */ |
06d91a5fe [PATCH] md: impro... |
377 |
spinlock_t write_lock; |
3d310eb7b [PATCH] md: fix d... |
378 |
wait_queue_head_t sb_wait; /* for waiting on superblock updates */ |
7bfa19f27 [PATCH] md: allow... |
379 |
atomic_t pending_writes; /* number of active superblock writes */ |
06d91a5fe [PATCH] md: impro... |
380 |
|
1da177e4c Linux-2.6.12-rc2 |
381 382 383 384 385 386 |
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... |
387 |
struct request_queue *queue; /* for plugging ... */ |
1da177e4c Linux-2.6.12-rc2 |
388 |
|
32a7627cf [PATCH] md: optim... |
389 |
struct bitmap *bitmap; /* the bitmap for the device */ |
c3d9714e8 md: collect bitma... |
390 391 |
struct { struct file *file; /* the bitmap file */ |
f6af949c5 md: support bitma... |
392 |
loff_t offset; /* offset from superblock of |
c3d9714e8 md: collect bitma... |
393 394 |
* start of bitmap. May be * negative, but not '0' |
f6af949c5 md: support bitma... |
395 396 |
* For external metadata, offset * from start of device. |
c3d9714e8 md: collect bitma... |
397 |
*/ |
6409bb05a md/bitmap: add ne... |
398 |
unsigned long space; /* space available at this offset */ |
f6af949c5 md: support bitma... |
399 |
loff_t default_offset; /* this is the offset to use when |
c3d9714e8 md: collect bitma... |
400 401 402 |
* hot-adding a bitmap. It should * eventually be settable by sysfs. */ |
6409bb05a md/bitmap: add ne... |
403 404 |
unsigned long default_space; /* space available at * default offset */ |
c3d9714e8 md: collect bitma... |
405 |
struct mutex mutex; |
42a04b507 md: move offset, ... |
406 |
unsigned long chunksize; |
ac2f40be4 md/bitmap: white ... |
407 |
unsigned long daemon_sleep; /* how many jiffies between updates? */ |
42a04b507 md: move offset, ... |
408 |
unsigned long max_write_behind; /* write-behind mode */ |
ece5cff0d md: Support write... |
409 |
int external; |
c3d9714e8 md: collect bitma... |
410 |
} bitmap_info; |
32a7627cf [PATCH] md: optim... |
411 |
|
1e50915fe raid: improve MD/... |
412 |
atomic_t max_corr_read_errors; /* max read retries */ |
1da177e4c Linux-2.6.12-rc2 |
413 |
struct list_head all_mddevs; |
a2826aa92 md: support barri... |
414 |
|
a64c876fd md: manage redund... |
415 |
struct attribute_group *to_remove; |
252ac5221 md/plug: optional... |
416 |
|
a167f6632 md: use separate ... |
417 |
struct bio_set *bio_set; |
e9c7469bb md: implment REQ_... |
418 419 420 |
/* 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... |
421 |
*/ |
e9c7469bb md: implment REQ_... |
422 |
struct bio *flush_bio; |
a2826aa92 md: support barri... |
423 |
atomic_t flush_pending; |
e9c7469bb md: implment REQ_... |
424 |
struct work_struct flush_work; |
768a418db md: add support f... |
425 |
struct work_struct event_work; /* used by dm to report failure event */ |
fd01b88c7 md: remove typede... |
426 |
void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev); |
1da177e4c Linux-2.6.12-rc2 |
427 |
}; |
fd01b88c7 md: remove typede... |
428 |
static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev) |
1da177e4c Linux-2.6.12-rc2 |
429 |
{ |
b2d444d7a [PATCH] md: conve... |
430 |
int faulty = test_bit(Faulty, &rdev->flags); |
1da177e4c Linux-2.6.12-rc2 |
431 432 433 434 435 436 437 438 |
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... |
439 |
struct md_personality |
1da177e4c Linux-2.6.12-rc2 |
440 441 |
{ char *name; |
2604b703b [PATCH] md: remov... |
442 443 |
int level; struct list_head list; |
1da177e4c Linux-2.6.12-rc2 |
444 |
struct module *owner; |
b4fdcb02f Merge branch 'for... |
445 |
void (*make_request)(struct mddev *mddev, struct bio *bio); |
fd01b88c7 md: remove typede... |
446 447 448 |
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 |
449 450 451 |
/* error_handler must set ->faulty and clear ->in_sync * if appropriate, and should abort recovery if needed */ |
fd01b88c7 md: remove typede... |
452 453 |
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... |
454 |
int (*hot_remove_disk) (struct mddev *mddev, struct md_rdev *rdev); |
fd01b88c7 md: remove typede... |
455 456 457 458 459 460 461 |
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... |
462 463 464 465 466 |
/* quiesce moves between quiescence states * 0 - fully active * 1 - no new requests allowed * others - reserved */ |
fd01b88c7 md: remove typede... |
467 |
void (*quiesce) (struct mddev *mddev, int state); |
245f46c2c md: add ->takeove... |
468 469 470 471 472 473 474 475 476 |
/* 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... |
477 |
void *(*takeover) (struct mddev *mddev); |
1da177e4c Linux-2.6.12-rc2 |
478 |
}; |
007583c92 [PATCH] md: chang... |
479 480 |
struct md_sysfs_entry { struct attribute attr; |
fd01b88c7 md: remove typede... |
481 482 |
ssize_t (*show)(struct mddev *, char *); ssize_t (*store)(struct mddev *, const char *, size_t); |
007583c92 [PATCH] md: chang... |
483 |
}; |
43a705076 md: support updat... |
484 |
extern struct attribute_group md_bitmap_group; |
007583c92 [PATCH] md: chang... |
485 |
|
324a56e16 kernfs: s/sysfs_d... |
486 |
static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name) |
00bcb4ac7 md: reduce depend... |
487 488 |
{ if (sd) |
388975ccc sysfs: clean up s... |
489 |
return sysfs_get_dirent(sd, name); |
00bcb4ac7 md: reduce depend... |
490 491 |
return sd; } |
324a56e16 kernfs: s/sysfs_d... |
492 |
static inline void sysfs_notify_dirent_safe(struct kernfs_node *sd) |
00bcb4ac7 md: reduce depend... |
493 494 495 496 |
{ if (sd) sysfs_notify_dirent(sd); } |
fd01b88c7 md: remove typede... |
497 |
static inline char * mdname (struct mddev * mddev) |
1da177e4c Linux-2.6.12-rc2 |
498 499 500 |
{ return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; } |
fd01b88c7 md: remove typede... |
501 |
static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) |
36fad858a md: introduce lin... |
502 503 |
{ char nm[20]; |
90584fc93 MD: Prevent sysfs... |
504 |
if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
2d78f8c45 md: create extern... |
505 506 507 508 |
sprintf(nm, "rd%d", rdev->raid_disk); return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); } else return 0; |
36fad858a md: introduce lin... |
509 |
} |
fd01b88c7 md: remove typede... |
510 |
static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) |
36fad858a md: introduce lin... |
511 512 |
{ char nm[20]; |
90584fc93 MD: Prevent sysfs... |
513 |
if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
2d78f8c45 md: create extern... |
514 515 516 |
sprintf(nm, "rd%d", rdev->raid_disk); sysfs_remove_link(&mddev->kobj, nm); } |
36fad858a md: introduce lin... |
517 |
} |
1da177e4c Linux-2.6.12-rc2 |
518 519 520 521 |
/* * iterates through some rdev ringlist. It's safe to remove the * current 'rdev'. Dont touch 'tmp' though. */ |
159ec1fc0 md: use list_for_... |
522 523 |
#define rdev_for_each_list(rdev, tmp, head) \ list_for_each_entry_safe(rdev, tmp, head, same_set) |
1da177e4c Linux-2.6.12-rc2 |
524 525 526 |
/* * iterates through the 'same array disks' ringlist */ |
dafb20fa3 md: tidy up rdev_... |
527 528 529 530 |
#define rdev_for_each(rdev, mddev) \ list_for_each_entry(rdev, &((mddev)->disks), same_set) #define rdev_for_each_safe(rdev, tmp, mddev) \ |
159ec1fc0 md: use list_for_... |
531 |
list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set) |
1da177e4c Linux-2.6.12-rc2 |
532 |
|
4b80991c6 md: Protect acces... |
533 534 |
#define rdev_for_each_rcu(rdev, mddev) \ list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) |
2b8bf3451 md: remove typede... |
535 |
struct md_thread { |
4ed8731d8 MD: change the pa... |
536 |
void (*run) (struct md_thread *thread); |
fd01b88c7 md: remove typede... |
537 |
struct mddev *mddev; |
1da177e4c Linux-2.6.12-rc2 |
538 539 |
wait_queue_head_t wqueue; unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
540 |
struct task_struct *tsk; |
32a7627cf [PATCH] md: optim... |
541 |
unsigned long timeout; |
4ed8731d8 MD: change the pa... |
542 |
void *private; |
2b8bf3451 md: remove typede... |
543 |
}; |
1da177e4c Linux-2.6.12-rc2 |
544 545 |
#define THREAD_WAKEUP 0 |
1345b1d8a [PATCH] md: defin... |
546 547 548 549 |
static inline void safe_put_page(struct page *p) { if (p) put_page(p); } |
84fc4b56d md: rename "mdk_p... |
550 551 |
extern int register_md_personality(struct md_personality *p); extern int unregister_md_personality(struct md_personality *p); |
2b8bf3451 md: remove typede... |
552 |
extern struct md_thread *md_register_thread( |
4ed8731d8 MD: change the pa... |
553 |
void (*run)(struct md_thread *thread), |
2b8bf3451 md: remove typede... |
554 555 556 557 |
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... |
558 |
extern void md_check_recovery(struct mddev *mddev); |
a91d5ac04 MD: Export 'md_re... |
559 |
extern void md_reap_sync_thread(struct mddev *mddev); |
fd01b88c7 md: remove typede... |
560 561 562 563 |
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 md: add possibili... |
564 |
extern void md_finish_reshape(struct mddev *mddev); |
fd01b88c7 md: remove typede... |
565 566 567 568 |
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... |
569 |
sector_t sector, int size, struct page *page); |
fd01b88c7 md: remove typede... |
570 |
extern void md_super_wait(struct mddev *mddev); |
3cb030020 md: removing type... |
571 |
extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, |
ccebd4c41 md-new-param-to_s... |
572 |
struct page *page, int rw, bool metadata_op); |
4ed8731d8 MD: change the pa... |
573 |
extern void md_do_sync(struct md_thread *thread); |
fd01b88c7 md: remove typede... |
574 575 576 577 578 579 580 |
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... |
581 |
extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); |
63fe08177 md: tiny md.h cle... |
582 |
|
fd01b88c7 md: remove typede... |
583 584 585 586 |
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... |
587 |
extern int md_rdev_init(struct md_rdev *rdev); |
545c87957 md: dm-raid shoul... |
588 |
extern void md_rdev_clear(struct md_rdev *rdev); |
63fe08177 md: tiny md.h cle... |
589 |
|
fd01b88c7 md: remove typede... |
590 591 |
extern void mddev_suspend(struct mddev *mddev); extern void mddev_resume(struct mddev *mddev); |
a167f6632 md: use separate ... |
592 |
extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, |
fd01b88c7 md: remove typede... |
593 |
struct mddev *mddev); |
a167f6632 md: use separate ... |
594 |
extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
fd01b88c7 md: remove typede... |
595 |
struct mddev *mddev); |
9cbb17508 blk: centralize n... |
596 |
|
74018dc30 blk: pass from_sc... |
597 |
extern void md_unplug(struct blk_plug_cb *cb, bool from_schedule); |
9cbb17508 blk: centralize n... |
598 599 600 601 602 |
static inline int mddev_check_plugged(struct mddev *mddev) { return !!blk_check_plugged(md_unplug, mddev, sizeof(struct blk_plug_cb)); } |
63fe08177 md: tiny md.h cle... |
603 |
#endif /* _MD_MD_H */ |