diff options
Diffstat (limited to 'include/linux/raid')
-rw-r--r-- | include/linux/raid/bitmap.h | 11 | ||||
-rw-r--r-- | include/linux/raid/md.h | 5 | ||||
-rw-r--r-- | include/linux/raid/md_k.h | 40 | ||||
-rw-r--r-- | include/linux/raid/raid1.h | 4 | ||||
-rw-r--r-- | include/linux/raid/raid5.h | 2 |
5 files changed, 52 insertions, 10 deletions
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 9de99198caf1..899437802aea 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
@@ -6,7 +6,13 @@ | |||
6 | #ifndef BITMAP_H | 6 | #ifndef BITMAP_H |
7 | #define BITMAP_H 1 | 7 | #define BITMAP_H 1 |
8 | 8 | ||
9 | #define BITMAP_MAJOR 3 | 9 | #define BITMAP_MAJOR_LO 3 |
10 | /* version 4 insists the bitmap is in little-endian order | ||
11 | * with version 3, it is host-endian which is non-portable | ||
12 | */ | ||
13 | #define BITMAP_MAJOR_HI 4 | ||
14 | #define BITMAP_MAJOR_HOSTENDIAN 3 | ||
15 | |||
10 | #define BITMAP_MINOR 39 | 16 | #define BITMAP_MINOR 39 |
11 | 17 | ||
12 | /* | 18 | /* |
@@ -133,7 +139,8 @@ typedef __u16 bitmap_counter_t; | |||
133 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ | 139 | /* use these for bitmap->flags and bitmap->sb->state bit-fields */ |
134 | enum bitmap_state { | 140 | enum bitmap_state { |
135 | BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ | 141 | BITMAP_ACTIVE = 0x001, /* the bitmap is in use */ |
136 | BITMAP_STALE = 0x002 /* the bitmap file is out of date or had -EIO */ | 142 | BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */ |
143 | BITMAP_HOSTENDIAN = 0x8000, | ||
137 | }; | 144 | }; |
138 | 145 | ||
139 | /* the superblock at the front of the bitmap file -- little endian */ | 146 | /* the superblock at the front of the bitmap file -- little endian */ |
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index ffa316ce4dc8..13e7c4b62367 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
@@ -66,8 +66,10 @@ | |||
66 | * and major_version/minor_version accordingly | 66 | * and major_version/minor_version accordingly |
67 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | 67 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT |
68 | * in the super status byte | 68 | * in the super status byte |
69 | * >=3 means that bitmap superblock version 4 is supported, which uses | ||
70 | * little-ending representation rather than host-endian | ||
69 | */ | 71 | */ |
70 | #define MD_PATCHLEVEL_VERSION 2 | 72 | #define MD_PATCHLEVEL_VERSION 3 |
71 | 73 | ||
72 | extern int register_md_personality (int p_num, mdk_personality_t *p); | 74 | extern int register_md_personality (int p_num, mdk_personality_t *p); |
73 | extern int unregister_md_personality (int p_num); | 75 | extern int unregister_md_personality (int p_num); |
@@ -87,6 +89,7 @@ extern void md_print_devices (void); | |||
87 | 89 | ||
88 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | 90 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, |
89 | sector_t sector, int size, struct page *page); | 91 | sector_t sector, int size, struct page *page); |
92 | extern void md_super_wait(mddev_t *mddev); | ||
90 | extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, | 93 | extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, |
91 | struct page *page, int rw); | 94 | struct page *page, int rw); |
92 | 95 | ||
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 |
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 60e19b667548..292b98f2b408 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
@@ -110,7 +110,9 @@ struct r1bio_s { | |||
110 | #define R1BIO_Uptodate 0 | 110 | #define R1BIO_Uptodate 0 |
111 | #define R1BIO_IsSync 1 | 111 | #define R1BIO_IsSync 1 |
112 | #define R1BIO_Degraded 2 | 112 | #define R1BIO_Degraded 2 |
113 | #define R1BIO_BehindIO 3 | 113 | #define R1BIO_BehindIO 3 |
114 | #define R1BIO_Barrier 4 | ||
115 | #define R1BIO_BarrierRetry 5 | ||
114 | /* For write-behind requests, we call bi_end_io when | 116 | /* For write-behind requests, we call bi_end_io when |
115 | * the last non-write-behind device completes, providing | 117 | * the last non-write-behind device completes, providing |
116 | * any write was successful. Otherwise we call when | 118 | * any write was successful. Otherwise we call when |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index 176fc653c284..f025ba6fb14c 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -154,6 +154,8 @@ struct stripe_head { | |||
154 | #define R5_Wantwrite 5 | 154 | #define R5_Wantwrite 5 |
155 | #define R5_Syncio 6 /* this io need to be accounted as resync io */ | 155 | #define R5_Syncio 6 /* this io need to be accounted as resync io */ |
156 | #define R5_Overlap 7 /* There is a pending overlapping request on this block */ | 156 | #define R5_Overlap 7 /* There is a pending overlapping request on this block */ |
157 | #define R5_ReadError 8 /* seen a read error here recently */ | ||
158 | #define R5_ReWrite 9 /* have tried to over-write the readerror */ | ||
157 | 159 | ||
158 | /* | 160 | /* |
159 | * Write method | 161 | * Write method |