diff options
Diffstat (limited to 'include/linux/raid')
-rw-r--r-- | include/linux/raid/md.h | 3 | ||||
-rw-r--r-- | include/linux/raid/md_k.h | 21 | ||||
-rw-r--r-- | include/linux/raid/md_p.h | 32 | ||||
-rw-r--r-- | include/linux/raid/raid1.h | 2 | ||||
-rw-r--r-- | include/linux/raid/raid5.h | 25 |
5 files changed, 73 insertions, 10 deletions
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index b6e0bcad84e1..66b44e5e0d6e 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
@@ -92,7 +92,10 @@ extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | |||
92 | extern void md_super_wait(mddev_t *mddev); | 92 | extern void md_super_wait(mddev_t *mddev); |
93 | 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, |
94 | struct page *page, int rw); | 94 | struct page *page, int rw); |
95 | extern void md_do_sync(mddev_t *mddev); | ||
96 | extern void md_new_event(mddev_t *mddev); | ||
95 | 97 | ||
98 | extern void md_update_sb(mddev_t * mddev); | ||
96 | 99 | ||
97 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } | 100 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } |
98 | 101 | ||
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 617b9506c760..e2df61f5b09a 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -132,6 +132,14 @@ struct mddev_s | |||
132 | 132 | ||
133 | char uuid[16]; | 133 | char uuid[16]; |
134 | 134 | ||
135 | /* If the array is being reshaped, we need to record the | ||
136 | * new shape and an indication of where we are up to. | ||
137 | * This is written to the superblock. | ||
138 | * If reshape_position is MaxSector, then no reshape is happening (yet). | ||
139 | */ | ||
140 | sector_t reshape_position; | ||
141 | int delta_disks, new_level, new_layout, new_chunk; | ||
142 | |||
135 | struct mdk_thread_s *thread; /* management thread */ | 143 | struct mdk_thread_s *thread; /* management thread */ |
136 | struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ | 144 | struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ |
137 | sector_t curr_resync; /* blocks scheduled */ | 145 | sector_t curr_resync; /* blocks scheduled */ |
@@ -143,6 +151,10 @@ struct mddev_s | |||
143 | sector_t resync_mismatches; /* count of sectors where | 151 | sector_t resync_mismatches; /* count of sectors where |
144 | * parity/replica mismatch found | 152 | * parity/replica mismatch found |
145 | */ | 153 | */ |
154 | |||
155 | /* allow user-space to request suspension of IO to regions of the array */ | ||
156 | sector_t suspend_lo; | ||
157 | sector_t suspend_hi; | ||
146 | /* if zero, use the system-wide default */ | 158 | /* if zero, use the system-wide default */ |
147 | int sync_speed_min; | 159 | int sync_speed_min; |
148 | int sync_speed_max; | 160 | int sync_speed_max; |
@@ -157,6 +169,9 @@ struct mddev_s | |||
157 | * DONE: thread is done and is waiting to be reaped | 169 | * DONE: thread is done and is waiting to be reaped |
158 | * REQUEST: user-space has requested a sync (used with SYNC) | 170 | * REQUEST: user-space has requested a sync (used with SYNC) |
159 | * CHECK: user-space request for for check-only, no repair | 171 | * CHECK: user-space request for for check-only, no repair |
172 | * RESHAPE: A reshape is happening | ||
173 | * | ||
174 | * If neither SYNC or RESHAPE are set, then it is a recovery. | ||
160 | */ | 175 | */ |
161 | #define MD_RECOVERY_RUNNING 0 | 176 | #define MD_RECOVERY_RUNNING 0 |
162 | #define MD_RECOVERY_SYNC 1 | 177 | #define MD_RECOVERY_SYNC 1 |
@@ -166,10 +181,11 @@ struct mddev_s | |||
166 | #define MD_RECOVERY_NEEDED 5 | 181 | #define MD_RECOVERY_NEEDED 5 |
167 | #define MD_RECOVERY_REQUESTED 6 | 182 | #define MD_RECOVERY_REQUESTED 6 |
168 | #define MD_RECOVERY_CHECK 7 | 183 | #define MD_RECOVERY_CHECK 7 |
184 | #define MD_RECOVERY_RESHAPE 8 | ||
169 | unsigned long recovery; | 185 | unsigned long recovery; |
170 | 186 | ||
171 | int in_sync; /* know to not need resync */ | 187 | int in_sync; /* know to not need resync */ |
172 | struct semaphore reconfig_sem; | 188 | struct mutex reconfig_mutex; |
173 | atomic_t active; | 189 | atomic_t active; |
174 | 190 | ||
175 | int changed; /* true if we might need to reread partition info */ | 191 | int changed; /* true if we might need to reread partition info */ |
@@ -249,7 +265,8 @@ struct mdk_personality | |||
249 | int (*spare_active) (mddev_t *mddev); | 265 | int (*spare_active) (mddev_t *mddev); |
250 | sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); | 266 | sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); |
251 | int (*resize) (mddev_t *mddev, sector_t sectors); | 267 | int (*resize) (mddev_t *mddev, sector_t sectors); |
252 | int (*reshape) (mddev_t *mddev, int raid_disks); | 268 | int (*check_reshape) (mddev_t *mddev); |
269 | int (*start_reshape) (mddev_t *mddev); | ||
253 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); | 270 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); |
254 | /* quiesce moves between quiescence states | 271 | /* quiesce moves between quiescence states |
255 | * 0 - fully active | 272 | * 0 - fully active |
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index c100fa5d4bfa..774e1acfb8c4 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -102,6 +102,18 @@ typedef struct mdp_device_descriptor_s { | |||
102 | #define MD_SB_ERRORS 1 | 102 | #define MD_SB_ERRORS 1 |
103 | 103 | ||
104 | #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ | 104 | #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ |
105 | |||
106 | /* | ||
107 | * Notes: | ||
108 | * - if an array is being reshaped (restriped) in order to change the | ||
109 | * the number of active devices in the array, 'raid_disks' will be | ||
110 | * the larger of the old and new numbers. 'delta_disks' will | ||
111 | * be the "new - old". So if +ve, raid_disks is the new value, and | ||
112 | * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the | ||
113 | * old value and "raid_disks+delta_disks" is the new (smaller) value. | ||
114 | */ | ||
115 | |||
116 | |||
105 | typedef struct mdp_superblock_s { | 117 | typedef struct mdp_superblock_s { |
106 | /* | 118 | /* |
107 | * Constant generic information | 119 | * Constant generic information |
@@ -146,7 +158,13 @@ typedef struct mdp_superblock_s { | |||
146 | __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ | 158 | __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ |
147 | #endif | 159 | #endif |
148 | __u32 recovery_cp; /* 11 recovery checkpoint sector count */ | 160 | __u32 recovery_cp; /* 11 recovery checkpoint sector count */ |
149 | __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 12]; | 161 | /* There are only valid for minor_version > 90 */ |
162 | __u64 reshape_position; /* 12,13 next address in array-space for reshape */ | ||
163 | __u32 new_level; /* 14 new level we are reshaping to */ | ||
164 | __u32 delta_disks; /* 15 change in number of raid_disks */ | ||
165 | __u32 new_layout; /* 16 new layout */ | ||
166 | __u32 new_chunk; /* 17 new chunk size (bytes) */ | ||
167 | __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; | ||
150 | 168 | ||
151 | /* | 169 | /* |
152 | * Personality information | 170 | * Personality information |
@@ -207,7 +225,14 @@ struct mdp_superblock_1 { | |||
207 | * NOTE: signed, so bitmap can be before superblock | 225 | * NOTE: signed, so bitmap can be before superblock |
208 | * only meaningful of feature_map[0] is set. | 226 | * only meaningful of feature_map[0] is set. |
209 | */ | 227 | */ |
210 | __u8 pad1[128-100]; /* set to 0 when written */ | 228 | |
229 | /* These are only valid with feature bit '4' */ | ||
230 | __u64 reshape_position; /* next address in array-space for reshape */ | ||
231 | __u32 new_level; /* new level we are reshaping to */ | ||
232 | __u32 delta_disks; /* change in number of raid_disks */ | ||
233 | __u32 new_layout; /* new layout */ | ||
234 | __u32 new_chunk; /* new chunk size (bytes) */ | ||
235 | __u8 pad1[128-124]; /* set to 0 when written */ | ||
211 | 236 | ||
212 | /* constant this-device information - 64 bytes */ | 237 | /* constant this-device information - 64 bytes */ |
213 | __u64 data_offset; /* sector start of data, often 0 */ | 238 | __u64 data_offset; /* sector start of data, often 0 */ |
@@ -240,8 +265,9 @@ struct mdp_superblock_1 { | |||
240 | 265 | ||
241 | /* feature_map bits */ | 266 | /* feature_map bits */ |
242 | #define MD_FEATURE_BITMAP_OFFSET 1 | 267 | #define MD_FEATURE_BITMAP_OFFSET 1 |
268 | #define MD_FEATURE_RESHAPE_ACTIVE 4 | ||
243 | 269 | ||
244 | #define MD_FEATURE_ALL 1 | 270 | #define MD_FEATURE_ALL 5 |
245 | 271 | ||
246 | #endif | 272 | #endif |
247 | 273 | ||
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 9d5494aaac0f..3009c813d83d 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
@@ -130,6 +130,6 @@ struct r1bio_s { | |||
130 | * with failure when last write completes (and all failed). | 130 | * with failure when last write completes (and all failed). |
131 | * Record that bi_end_io was called with this flag... | 131 | * Record that bi_end_io was called with this flag... |
132 | */ | 132 | */ |
133 | #define R1BIO_Returned 4 | 133 | #define R1BIO_Returned 6 |
134 | 134 | ||
135 | #endif | 135 | #endif |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index 394da8207b34..914af667044f 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -135,6 +135,7 @@ struct stripe_head { | |||
135 | atomic_t count; /* nr of active thread/requests */ | 135 | atomic_t count; /* nr of active thread/requests */ |
136 | spinlock_t lock; | 136 | spinlock_t lock; |
137 | int bm_seq; /* sequence number for bitmap flushes */ | 137 | int bm_seq; /* sequence number for bitmap flushes */ |
138 | int disks; /* disks in stripe */ | ||
138 | struct r5dev { | 139 | struct r5dev { |
139 | struct bio req; | 140 | struct bio req; |
140 | struct bio_vec vec; | 141 | struct bio_vec vec; |
@@ -156,6 +157,7 @@ struct stripe_head { | |||
156 | #define R5_ReadError 8 /* seen a read error here recently */ | 157 | #define R5_ReadError 8 /* seen a read error here recently */ |
157 | #define R5_ReWrite 9 /* have tried to over-write the readerror */ | 158 | #define R5_ReWrite 9 /* have tried to over-write the readerror */ |
158 | 159 | ||
160 | #define R5_Expanded 10 /* This block now has post-expand data */ | ||
159 | /* | 161 | /* |
160 | * Write method | 162 | * Write method |
161 | */ | 163 | */ |
@@ -174,7 +176,9 @@ struct stripe_head { | |||
174 | #define STRIPE_DELAYED 6 | 176 | #define STRIPE_DELAYED 6 |
175 | #define STRIPE_DEGRADED 7 | 177 | #define STRIPE_DEGRADED 7 |
176 | #define STRIPE_BIT_DELAY 8 | 178 | #define STRIPE_BIT_DELAY 8 |
177 | 179 | #define STRIPE_EXPANDING 9 | |
180 | #define STRIPE_EXPAND_SOURCE 10 | ||
181 | #define STRIPE_EXPAND_READY 11 | ||
178 | /* | 182 | /* |
179 | * Plugging: | 183 | * Plugging: |
180 | * | 184 | * |
@@ -211,12 +215,24 @@ struct raid5_private_data { | |||
211 | int raid_disks, working_disks, failed_disks; | 215 | int raid_disks, working_disks, failed_disks; |
212 | int max_nr_stripes; | 216 | int max_nr_stripes; |
213 | 217 | ||
218 | /* used during an expand */ | ||
219 | sector_t expand_progress; /* MaxSector when no expand happening */ | ||
220 | sector_t expand_lo; /* from here up to expand_progress it out-of-bounds | ||
221 | * as we haven't flushed the metadata yet | ||
222 | */ | ||
223 | int previous_raid_disks; | ||
224 | |||
214 | struct list_head handle_list; /* stripes needing handling */ | 225 | struct list_head handle_list; /* stripes needing handling */ |
215 | struct list_head delayed_list; /* stripes that have plugged requests */ | 226 | struct list_head delayed_list; /* stripes that have plugged requests */ |
216 | struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ | 227 | struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ |
217 | atomic_t preread_active_stripes; /* stripes with scheduled io */ | 228 | atomic_t preread_active_stripes; /* stripes with scheduled io */ |
218 | 229 | ||
219 | char cache_name[20]; | 230 | atomic_t reshape_stripes; /* stripes with pending writes for reshape */ |
231 | /* unfortunately we need two cache names as we temporarily have | ||
232 | * two caches. | ||
233 | */ | ||
234 | int active_name; | ||
235 | char cache_name[2][20]; | ||
220 | kmem_cache_t *slab_cache; /* for allocating stripes */ | 236 | kmem_cache_t *slab_cache; /* for allocating stripes */ |
221 | 237 | ||
222 | int seq_flush, seq_write; | 238 | int seq_flush, seq_write; |
@@ -238,9 +254,10 @@ struct raid5_private_data { | |||
238 | wait_queue_head_t wait_for_overlap; | 254 | wait_queue_head_t wait_for_overlap; |
239 | int inactive_blocked; /* release of inactive stripes blocked, | 255 | int inactive_blocked; /* release of inactive stripes blocked, |
240 | * waiting for 25% to be free | 256 | * waiting for 25% to be free |
241 | */ | 257 | */ |
258 | int pool_size; /* number of disks in stripeheads in pool */ | ||
242 | spinlock_t device_lock; | 259 | spinlock_t device_lock; |
243 | struct disk_info disks[0]; | 260 | struct disk_info *disks; |
244 | }; | 261 | }; |
245 | 262 | ||
246 | typedef struct raid5_private_data raid5_conf_t; | 263 | typedef struct raid5_private_data raid5_conf_t; |