diff options
Diffstat (limited to 'include/linux/raid/md_k.h')
-rw-r--r-- | include/linux/raid/md_k.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index ebce949b1443..46629a275ba9 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -105,6 +105,8 @@ struct mdk_rdev_s | |||
105 | int sb_size; /* bytes in the superblock */ | 105 | int sb_size; /* bytes in the superblock */ |
106 | int preferred_minor; /* autorun support */ | 106 | int preferred_minor; /* autorun support */ |
107 | 107 | ||
108 | struct kobject kobj; | ||
109 | |||
108 | /* A device can be in one of three states based on two flags: | 110 | /* A device can be in one of three states based on two flags: |
109 | * Not working: faulty==1 in_sync==0 | 111 | * Not working: faulty==1 in_sync==0 |
110 | * Fully working: faulty==0 in_sync==1 | 112 | * Fully working: faulty==0 in_sync==1 |
@@ -115,11 +117,12 @@ struct mdk_rdev_s | |||
115 | * It can never have faulty==1, in_sync==1 | 117 | * It can never have faulty==1, in_sync==1 |
116 | * This reduces the burden of testing multiple flags in many cases | 118 | * This reduces the burden of testing multiple flags in many cases |
117 | */ | 119 | */ |
118 | int faulty; /* if faulty do not issue IO requests */ | ||
119 | int in_sync; /* device is a full member of the array */ | ||
120 | 120 | ||
121 | unsigned long flags; /* Should include faulty and in_sync here. */ | 121 | unsigned long flags; |
122 | #define Faulty 1 /* device is known to have a fault */ | ||
123 | #define In_sync 2 /* device is in_sync with rest of array */ | ||
122 | #define WriteMostly 4 /* Avoid reading if at all possible */ | 124 | #define WriteMostly 4 /* Avoid reading if at all possible */ |
125 | #define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */ | ||
123 | 126 | ||
124 | int desc_nr; /* descriptor index in the superblock */ | 127 | int desc_nr; /* descriptor index in the superblock */ |
125 | int raid_disk; /* role of device in array */ | 128 | int raid_disk; /* role of device in array */ |
@@ -132,6 +135,9 @@ struct mdk_rdev_s | |||
132 | * only maintained for arrays that | 135 | * only maintained for arrays that |
133 | * support hot removal | 136 | * support hot removal |
134 | */ | 137 | */ |
138 | atomic_t read_errors; /* number of consecutive read errors that | ||
139 | * we have tried to ignore. | ||
140 | */ | ||
135 | }; | 141 | }; |
136 | 142 | ||
137 | typedef struct mdk_personality_s mdk_personality_t; | 143 | typedef struct mdk_personality_s mdk_personality_t; |
@@ -148,6 +154,8 @@ struct mddev_s | |||
148 | 154 | ||
149 | struct gendisk *gendisk; | 155 | struct gendisk *gendisk; |
150 | 156 | ||
157 | struct kobject kobj; | ||
158 | |||
151 | /* Superblock information */ | 159 | /* Superblock information */ |
152 | int major_version, | 160 | int major_version, |
153 | minor_version, | 161 | minor_version, |
@@ -171,6 +179,10 @@ struct mddev_s | |||
171 | sector_t resync_mark_cnt;/* blocks written at resync_mark */ | 179 | sector_t resync_mark_cnt;/* blocks written at resync_mark */ |
172 | 180 | ||
173 | sector_t resync_max_sectors; /* may be set by personality */ | 181 | sector_t resync_max_sectors; /* may be set by personality */ |
182 | |||
183 | sector_t resync_mismatches; /* count of sectors where | ||
184 | * parity/replica mismatch found | ||
185 | */ | ||
174 | /* recovery/resync flags | 186 | /* recovery/resync flags |
175 | * NEEDED: we might need to start a resync/recover | 187 | * NEEDED: we might need to start a resync/recover |
176 | * RUNNING: a thread is running, or about to be started | 188 | * RUNNING: a thread is running, or about to be started |
@@ -178,6 +190,8 @@ struct mddev_s | |||
178 | * ERR: and IO error was detected - abort the resync/recovery | 190 | * ERR: and IO error was detected - abort the resync/recovery |
179 | * INTR: someone requested a (clean) early abort. | 191 | * INTR: someone requested a (clean) early abort. |
180 | * DONE: thread is done and is waiting to be reaped | 192 | * DONE: thread is done and is waiting to be reaped |
193 | * REQUEST: user-space has requested a sync (used with SYNC) | ||
194 | * CHECK: user-space request for for check-only, no repair | ||
181 | */ | 195 | */ |
182 | #define MD_RECOVERY_RUNNING 0 | 196 | #define MD_RECOVERY_RUNNING 0 |
183 | #define MD_RECOVERY_SYNC 1 | 197 | #define MD_RECOVERY_SYNC 1 |
@@ -185,6 +199,8 @@ struct mddev_s | |||
185 | #define MD_RECOVERY_INTR 3 | 199 | #define MD_RECOVERY_INTR 3 |
186 | #define MD_RECOVERY_DONE 4 | 200 | #define MD_RECOVERY_DONE 4 |
187 | #define MD_RECOVERY_NEEDED 5 | 201 | #define MD_RECOVERY_NEEDED 5 |
202 | #define MD_RECOVERY_REQUESTED 6 | ||
203 | #define MD_RECOVERY_CHECK 7 | ||
188 | unsigned long recovery; | 204 | unsigned long recovery; |
189 | 205 | ||
190 | int in_sync; /* know to not need resync */ | 206 | int in_sync; /* know to not need resync */ |
@@ -195,6 +211,13 @@ struct mddev_s | |||
195 | int degraded; /* whether md should consider | 211 | int degraded; /* whether md should consider |
196 | * adding a spare | 212 | * adding a spare |
197 | */ | 213 | */ |
214 | int barriers_work; /* initialised to true, cleared as soon | ||
215 | * as a barrier request to slave | ||
216 | * fails. Only supported | ||
217 | */ | ||
218 | struct bio *biolist; /* bios that need to be retried | ||
219 | * because BIO_RW_BARRIER is not supported | ||
220 | */ | ||
198 | 221 | ||
199 | atomic_t recovery_active; /* blocks scheduled, but not written */ | 222 | atomic_t recovery_active; /* blocks scheduled, but not written */ |
200 | wait_queue_head_t recovery_wait; | 223 | wait_queue_head_t recovery_wait; |
@@ -232,7 +255,7 @@ struct mddev_s | |||
232 | 255 | ||
233 | static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) | 256 | static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) |
234 | { | 257 | { |
235 | int faulty = rdev->faulty; | 258 | int faulty = test_bit(Faulty, &rdev->flags); |
236 | if (atomic_dec_and_test(&rdev->nr_pending) && faulty) | 259 | if (atomic_dec_and_test(&rdev->nr_pending) && faulty) |
237 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 260 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
238 | } | 261 | } |
@@ -270,6 +293,13 @@ struct mdk_personality_s | |||
270 | }; | 293 | }; |
271 | 294 | ||
272 | 295 | ||
296 | struct md_sysfs_entry { | ||
297 | struct attribute attr; | ||
298 | ssize_t (*show)(mddev_t *, char *); | ||
299 | ssize_t (*store)(mddev_t *, const char *, size_t); | ||
300 | }; | ||
301 | |||
302 | |||
273 | static inline char * mdname (mddev_t * mddev) | 303 | static inline char * mdname (mddev_t * mddev) |
274 | { | 304 | { |
275 | return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; | 305 | return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; |
@@ -304,10 +334,8 @@ typedef struct mdk_thread_s { | |||
304 | mddev_t *mddev; | 334 | mddev_t *mddev; |
305 | wait_queue_head_t wqueue; | 335 | wait_queue_head_t wqueue; |
306 | unsigned long flags; | 336 | unsigned long flags; |
307 | struct completion *event; | ||
308 | struct task_struct *tsk; | 337 | struct task_struct *tsk; |
309 | unsigned long timeout; | 338 | unsigned long timeout; |
310 | const char *name; | ||
311 | } mdk_thread_t; | 339 | } mdk_thread_t; |
312 | 340 | ||
313 | #define THREAD_WAKEUP 0 | 341 | #define THREAD_WAKEUP 0 |