diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 15:59:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 15:59:59 -0500 |
commit | ccf18968b1bbc2fb117190a1984ac2a826dac228 (patch) | |
tree | 7bc8fbf5722aecf1e84fa50c31c657864cba1daa /include/linux/raid/md_k.h | |
parent | e91c021c487110386a07facd0396e6c3b7cf9c1f (diff) | |
parent | d99cf9d679a520d67f81d805b7cb91c68e1847f0 (diff) |
Merge ../torvalds-2.6/
Diffstat (limited to 'include/linux/raid/md_k.h')
-rw-r--r-- | include/linux/raid/md_k.h | 80 |
1 files changed, 25 insertions, 55 deletions
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 46629a275ba9..617b9506c760 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -18,62 +18,19 @@ | |||
18 | /* and dm-bio-list.h is not under include/linux because.... ??? */ | 18 | /* and dm-bio-list.h is not under include/linux because.... ??? */ |
19 | #include "../../../drivers/md/dm-bio-list.h" | 19 | #include "../../../drivers/md/dm-bio-list.h" |
20 | 20 | ||
21 | #define MD_RESERVED 0UL | ||
22 | #define LINEAR 1UL | ||
23 | #define RAID0 2UL | ||
24 | #define RAID1 3UL | ||
25 | #define RAID5 4UL | ||
26 | #define TRANSLUCENT 5UL | ||
27 | #define HSM 6UL | ||
28 | #define MULTIPATH 7UL | ||
29 | #define RAID6 8UL | ||
30 | #define RAID10 9UL | ||
31 | #define FAULTY 10UL | ||
32 | #define MAX_PERSONALITY 11UL | ||
33 | |||
34 | #define LEVEL_MULTIPATH (-4) | 21 | #define LEVEL_MULTIPATH (-4) |
35 | #define LEVEL_LINEAR (-1) | 22 | #define LEVEL_LINEAR (-1) |
36 | #define LEVEL_FAULTY (-5) | 23 | #define LEVEL_FAULTY (-5) |
37 | 24 | ||
25 | /* we need a value for 'no level specified' and 0 | ||
26 | * means 'raid0', so we need something else. This is | ||
27 | * for internal use only | ||
28 | */ | ||
29 | #define LEVEL_NONE (-1000000) | ||
30 | |||
38 | #define MaxSector (~(sector_t)0) | 31 | #define MaxSector (~(sector_t)0) |
39 | #define MD_THREAD_NAME_MAX 14 | 32 | #define MD_THREAD_NAME_MAX 14 |
40 | 33 | ||
41 | static inline int pers_to_level (int pers) | ||
42 | { | ||
43 | switch (pers) { | ||
44 | case FAULTY: return LEVEL_FAULTY; | ||
45 | case MULTIPATH: return LEVEL_MULTIPATH; | ||
46 | case HSM: return -3; | ||
47 | case TRANSLUCENT: return -2; | ||
48 | case LINEAR: return LEVEL_LINEAR; | ||
49 | case RAID0: return 0; | ||
50 | case RAID1: return 1; | ||
51 | case RAID5: return 5; | ||
52 | case RAID6: return 6; | ||
53 | case RAID10: return 10; | ||
54 | } | ||
55 | BUG(); | ||
56 | return MD_RESERVED; | ||
57 | } | ||
58 | |||
59 | static inline int level_to_pers (int level) | ||
60 | { | ||
61 | switch (level) { | ||
62 | case LEVEL_FAULTY: return FAULTY; | ||
63 | case LEVEL_MULTIPATH: return MULTIPATH; | ||
64 | case -3: return HSM; | ||
65 | case -2: return TRANSLUCENT; | ||
66 | case LEVEL_LINEAR: return LINEAR; | ||
67 | case 0: return RAID0; | ||
68 | case 1: return RAID1; | ||
69 | case 4: | ||
70 | case 5: return RAID5; | ||
71 | case 6: return RAID6; | ||
72 | case 10: return RAID10; | ||
73 | } | ||
74 | return MD_RESERVED; | ||
75 | } | ||
76 | |||
77 | typedef struct mddev_s mddev_t; | 34 | typedef struct mddev_s mddev_t; |
78 | typedef struct mdk_rdev_s mdk_rdev_t; | 35 | typedef struct mdk_rdev_s mdk_rdev_t; |
79 | 36 | ||
@@ -138,14 +95,16 @@ struct mdk_rdev_s | |||
138 | atomic_t read_errors; /* number of consecutive read errors that | 95 | atomic_t read_errors; /* number of consecutive read errors that |
139 | * we have tried to ignore. | 96 | * we have tried to ignore. |
140 | */ | 97 | */ |
98 | atomic_t corrected_errors; /* number of corrected read errors, | ||
99 | * for reporting to userspace and storing | ||
100 | * in superblock. | ||
101 | */ | ||
141 | }; | 102 | }; |
142 | 103 | ||
143 | typedef struct mdk_personality_s mdk_personality_t; | ||
144 | |||
145 | struct mddev_s | 104 | struct mddev_s |
146 | { | 105 | { |
147 | void *private; | 106 | void *private; |
148 | mdk_personality_t *pers; | 107 | struct mdk_personality *pers; |
149 | dev_t unit; | 108 | dev_t unit; |
150 | int md_minor; | 109 | int md_minor; |
151 | struct list_head disks; | 110 | struct list_head disks; |
@@ -164,6 +123,7 @@ struct mddev_s | |||
164 | int chunk_size; | 123 | int chunk_size; |
165 | time_t ctime, utime; | 124 | time_t ctime, utime; |
166 | int level, layout; | 125 | int level, layout; |
126 | char clevel[16]; | ||
167 | int raid_disks; | 127 | int raid_disks; |
168 | int max_disks; | 128 | int max_disks; |
169 | sector_t size; /* used size of component devices */ | 129 | sector_t size; /* used size of component devices */ |
@@ -183,6 +143,11 @@ struct mddev_s | |||
183 | sector_t resync_mismatches; /* count of sectors where | 143 | sector_t resync_mismatches; /* count of sectors where |
184 | * parity/replica mismatch found | 144 | * parity/replica mismatch found |
185 | */ | 145 | */ |
146 | /* if zero, use the system-wide default */ | ||
147 | int sync_speed_min; | ||
148 | int sync_speed_max; | ||
149 | |||
150 | int ok_start_degraded; | ||
186 | /* recovery/resync flags | 151 | /* recovery/resync flags |
187 | * NEEDED: we might need to start a resync/recover | 152 | * NEEDED: we might need to start a resync/recover |
188 | * RUNNING: a thread is running, or about to be started | 153 | * RUNNING: a thread is running, or about to be started |
@@ -265,9 +230,11 @@ static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sect | |||
265 | atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); | 230 | atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); |
266 | } | 231 | } |
267 | 232 | ||
268 | struct mdk_personality_s | 233 | struct mdk_personality |
269 | { | 234 | { |
270 | char *name; | 235 | char *name; |
236 | int level; | ||
237 | struct list_head list; | ||
271 | struct module *owner; | 238 | struct module *owner; |
272 | int (*make_request)(request_queue_t *q, struct bio *bio); | 239 | int (*make_request)(request_queue_t *q, struct bio *bio); |
273 | int (*run)(mddev_t *mddev); | 240 | int (*run)(mddev_t *mddev); |
@@ -305,8 +272,6 @@ static inline char * mdname (mddev_t * mddev) | |||
305 | return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; | 272 | return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; |
306 | } | 273 | } |
307 | 274 | ||
308 | extern mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr); | ||
309 | |||
310 | /* | 275 | /* |
311 | * iterates through some rdev ringlist. It's safe to remove the | 276 | * iterates through some rdev ringlist. It's safe to remove the |
312 | * current 'rdev'. Dont touch 'tmp' though. | 277 | * current 'rdev'. Dont touch 'tmp' though. |
@@ -366,5 +331,10 @@ do { \ | |||
366 | __wait_event_lock_irq(wq, condition, lock, cmd); \ | 331 | __wait_event_lock_irq(wq, condition, lock, cmd); \ |
367 | } while (0) | 332 | } while (0) |
368 | 333 | ||
334 | static inline void safe_put_page(struct page *p) | ||
335 | { | ||
336 | if (p) put_page(p); | ||
337 | } | ||
338 | |||
369 | #endif | 339 | #endif |
370 | 340 | ||