diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-09 21:14:47 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-09 21:14:47 -0400 |
commit | d344c5e0856ad03278d8700b503762dbc8b86e12 (patch) | |
tree | a6d893a643470a3c2580a58f3228a55fa1fd1d82 /include/linux/raid | |
parent | 010988e888a0abbe7118635c1b33d049caae6b29 (diff) | |
parent | 87fc767b832ef5a681a0ff9d203c3289bc3be2bf (diff) |
Manual merge with Linus
Diffstat (limited to 'include/linux/raid')
-rw-r--r-- | include/linux/raid/bitmap.h | 15 | ||||
-rw-r--r-- | include/linux/raid/linear.h | 4 | ||||
-rw-r--r-- | include/linux/raid/md_k.h | 81 | ||||
-rw-r--r-- | include/linux/raid/md_p.h | 16 | ||||
-rw-r--r-- | include/linux/raid/raid1.h | 13 | ||||
-rw-r--r-- | include/linux/raid/raid5.h | 14 |
6 files changed, 69 insertions, 74 deletions
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 4bf1659f8aa8..9de99198caf1 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #define BITMAP_H 1 | 7 | #define BITMAP_H 1 |
8 | 8 | ||
9 | #define BITMAP_MAJOR 3 | 9 | #define BITMAP_MAJOR 3 |
10 | #define BITMAP_MINOR 38 | 10 | #define BITMAP_MINOR 39 |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * in-memory bitmap: | 13 | * in-memory bitmap: |
@@ -147,8 +147,9 @@ typedef struct bitmap_super_s { | |||
147 | __u32 state; /* 48 bitmap state information */ | 147 | __u32 state; /* 48 bitmap state information */ |
148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ | 148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ |
149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ | 149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ |
150 | __u32 write_behind; /* 60 number of outstanding write-behind writes */ | ||
150 | 151 | ||
151 | __u8 pad[256 - 60]; /* set to zero */ | 152 | __u8 pad[256 - 64]; /* set to zero */ |
152 | } bitmap_super_t; | 153 | } bitmap_super_t; |
153 | 154 | ||
154 | /* notes: | 155 | /* notes: |
@@ -226,6 +227,9 @@ struct bitmap { | |||
226 | 227 | ||
227 | unsigned long flags; | 228 | unsigned long flags; |
228 | 229 | ||
230 | unsigned long max_write_behind; /* write-behind mode */ | ||
231 | atomic_t behind_writes; | ||
232 | |||
229 | /* | 233 | /* |
230 | * the bitmap daemon - periodically wakes up and sweeps the bitmap | 234 | * the bitmap daemon - periodically wakes up and sweeps the bitmap |
231 | * file, cleaning up bits and flushing out pages to disk as necessary | 235 | * file, cleaning up bits and flushing out pages to disk as necessary |
@@ -260,9 +264,10 @@ int bitmap_setallbits(struct bitmap *bitmap); | |||
260 | void bitmap_write_all(struct bitmap *bitmap); | 264 | void bitmap_write_all(struct bitmap *bitmap); |
261 | 265 | ||
262 | /* these are exported */ | 266 | /* these are exported */ |
263 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); | 267 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, |
264 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, | 268 | unsigned long sectors, int behind); |
265 | int success); | 269 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, |
270 | unsigned long sectors, int success, int behind); | ||
266 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); | 271 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); |
267 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); | 272 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); |
268 | void bitmap_close_sync(struct bitmap *bitmap); | 273 | void bitmap_close_sync(struct bitmap *bitmap); |
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index e04c4fe45b53..7eaf290e10e7 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h | |||
@@ -14,8 +14,8 @@ typedef struct dev_info dev_info_t; | |||
14 | struct linear_private_data | 14 | struct linear_private_data |
15 | { | 15 | { |
16 | dev_info_t **hash_table; | 16 | dev_info_t **hash_table; |
17 | dev_info_t *smallest; | 17 | sector_t hash_spacing; |
18 | int nr_zones; | 18 | int preshift; /* shift before dividing by hash_spacing */ |
19 | dev_info_t disks[0]; | 19 | dev_info_t disks[0]; |
20 | }; | 20 | }; |
21 | 21 | ||
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 8c14ba565a45..ebce949b1443 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -86,70 +86,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; | |||
86 | #define MAX_CHUNK_SIZE (4096*1024) | 86 | #define MAX_CHUNK_SIZE (4096*1024) |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * default readahead | ||
90 | */ | ||
91 | |||
92 | static inline int disk_faulty(mdp_disk_t * d) | ||
93 | { | ||
94 | return d->state & (1 << MD_DISK_FAULTY); | ||
95 | } | ||
96 | |||
97 | static inline int disk_active(mdp_disk_t * d) | ||
98 | { | ||
99 | return d->state & (1 << MD_DISK_ACTIVE); | ||
100 | } | ||
101 | |||
102 | static inline int disk_sync(mdp_disk_t * d) | ||
103 | { | ||
104 | return d->state & (1 << MD_DISK_SYNC); | ||
105 | } | ||
106 | |||
107 | static inline int disk_spare(mdp_disk_t * d) | ||
108 | { | ||
109 | return !disk_sync(d) && !disk_active(d) && !disk_faulty(d); | ||
110 | } | ||
111 | |||
112 | static inline int disk_removed(mdp_disk_t * d) | ||
113 | { | ||
114 | return d->state & (1 << MD_DISK_REMOVED); | ||
115 | } | ||
116 | |||
117 | static inline void mark_disk_faulty(mdp_disk_t * d) | ||
118 | { | ||
119 | d->state |= (1 << MD_DISK_FAULTY); | ||
120 | } | ||
121 | |||
122 | static inline void mark_disk_active(mdp_disk_t * d) | ||
123 | { | ||
124 | d->state |= (1 << MD_DISK_ACTIVE); | ||
125 | } | ||
126 | |||
127 | static inline void mark_disk_sync(mdp_disk_t * d) | ||
128 | { | ||
129 | d->state |= (1 << MD_DISK_SYNC); | ||
130 | } | ||
131 | |||
132 | static inline void mark_disk_spare(mdp_disk_t * d) | ||
133 | { | ||
134 | d->state = 0; | ||
135 | } | ||
136 | |||
137 | static inline void mark_disk_removed(mdp_disk_t * d) | ||
138 | { | ||
139 | d->state = (1 << MD_DISK_FAULTY) | (1 << MD_DISK_REMOVED); | ||
140 | } | ||
141 | |||
142 | static inline void mark_disk_inactive(mdp_disk_t * d) | ||
143 | { | ||
144 | d->state &= ~(1 << MD_DISK_ACTIVE); | ||
145 | } | ||
146 | |||
147 | static inline void mark_disk_nonsync(mdp_disk_t * d) | ||
148 | { | ||
149 | d->state &= ~(1 << MD_DISK_SYNC); | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * MD's 'extended' device | 89 | * MD's 'extended' device |
154 | */ | 90 | */ |
155 | struct mdk_rdev_s | 91 | struct mdk_rdev_s |
@@ -166,6 +102,7 @@ struct mdk_rdev_s | |||
166 | int sb_loaded; | 102 | int sb_loaded; |
167 | sector_t data_offset; /* start of data in array */ | 103 | sector_t data_offset; /* start of data in array */ |
168 | sector_t sb_offset; | 104 | sector_t sb_offset; |
105 | int sb_size; /* bytes in the superblock */ | ||
169 | int preferred_minor; /* autorun support */ | 106 | int preferred_minor; /* autorun support */ |
170 | 107 | ||
171 | /* A device can be in one of three states based on two flags: | 108 | /* A device can be in one of three states based on two flags: |
@@ -181,6 +118,9 @@ struct mdk_rdev_s | |||
181 | int faulty; /* if faulty do not issue IO requests */ | 118 | int faulty; /* if faulty do not issue IO requests */ |
182 | int in_sync; /* device is a full member of the array */ | 119 | int in_sync; /* device is a full member of the array */ |
183 | 120 | ||
121 | unsigned long flags; /* Should include faulty and in_sync here. */ | ||
122 | #define WriteMostly 4 /* Avoid reading if at all possible */ | ||
123 | |||
184 | int desc_nr; /* descriptor index in the superblock */ | 124 | int desc_nr; /* descriptor index in the superblock */ |
185 | int raid_disk; /* role of device in array */ | 125 | int raid_disk; /* role of device in array */ |
186 | int saved_raid_disk; /* role that device used to have in the | 126 | int saved_raid_disk; /* role that device used to have in the |
@@ -272,12 +212,19 @@ struct mddev_s | |||
272 | atomic_t writes_pending; | 212 | atomic_t writes_pending; |
273 | request_queue_t *queue; /* for plugging ... */ | 213 | request_queue_t *queue; /* for plugging ... */ |
274 | 214 | ||
215 | atomic_t write_behind; /* outstanding async IO */ | ||
216 | unsigned int max_write_behind; /* 0 = sync */ | ||
217 | |||
275 | struct bitmap *bitmap; /* the bitmap for the device */ | 218 | struct bitmap *bitmap; /* the bitmap for the device */ |
276 | struct file *bitmap_file; /* the bitmap file */ | 219 | struct file *bitmap_file; /* the bitmap file */ |
277 | long bitmap_offset; /* offset from superblock of | 220 | long bitmap_offset; /* offset from superblock of |
278 | * start of bitmap. May be | 221 | * start of bitmap. May be |
279 | * negative, but not '0' | 222 | * negative, but not '0' |
280 | */ | 223 | */ |
224 | long default_bitmap_offset; /* this is the offset to use when | ||
225 | * hot-adding a bitmap. It should | ||
226 | * eventually be settable by sysfs. | ||
227 | */ | ||
281 | 228 | ||
282 | struct list_head all_mddevs; | 229 | struct list_head all_mddevs; |
283 | }; | 230 | }; |
@@ -314,6 +261,12 @@ struct mdk_personality_s | |||
314 | int (*resize) (mddev_t *mddev, sector_t sectors); | 261 | int (*resize) (mddev_t *mddev, sector_t sectors); |
315 | int (*reshape) (mddev_t *mddev, int raid_disks); | 262 | int (*reshape) (mddev_t *mddev, int raid_disks); |
316 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); | 263 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); |
264 | /* quiesce moves between quiescence states | ||
265 | * 0 - fully active | ||
266 | * 1 - no new requests allowed | ||
267 | * others - reserved | ||
268 | */ | ||
269 | void (*quiesce) (mddev_t *mddev, int state); | ||
317 | }; | 270 | }; |
318 | 271 | ||
319 | 272 | ||
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index dc65cd435494..c100fa5d4bfa 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
@@ -79,6 +79,11 @@ | |||
79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ | 79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ |
80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ | 80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ |
81 | 81 | ||
82 | #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. | ||
83 | * read requests will only be sent here in | ||
84 | * dire need | ||
85 | */ | ||
86 | |||
82 | typedef struct mdp_device_descriptor_s { | 87 | typedef struct mdp_device_descriptor_s { |
83 | __u32 number; /* 0 Device number in the entire set */ | 88 | __u32 number; /* 0 Device number in the entire set */ |
84 | __u32 major; /* 1 Device major number */ | 89 | __u32 major; /* 1 Device major number */ |
@@ -193,7 +198,7 @@ struct mdp_superblock_1 { | |||
193 | 198 | ||
194 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ | 199 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ |
195 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ | 200 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ |
196 | __u32 layout; /* only for raid5 currently */ | 201 | __u32 layout; /* only for raid5 and raid10 currently */ |
197 | __u64 size; /* used size of component devices, in 512byte sectors */ | 202 | __u64 size; /* used size of component devices, in 512byte sectors */ |
198 | 203 | ||
199 | __u32 chunksize; /* in 512byte sectors */ | 204 | __u32 chunksize; /* in 512byte sectors */ |
@@ -212,7 +217,9 @@ struct mdp_superblock_1 { | |||
212 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ | 217 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ |
213 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ | 218 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ |
214 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ | 219 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ |
215 | __u8 pad2[64-56]; /* set to 0 when writing */ | 220 | __u8 devflags; /* per-device flags. Only one defined...*/ |
221 | #define WriteMostly1 1 /* mask for writemostly flag in above */ | ||
222 | __u8 pad2[64-57]; /* set to 0 when writing */ | ||
216 | 223 | ||
217 | /* array state information - 64 bytes */ | 224 | /* array state information - 64 bytes */ |
218 | __u64 utime; /* 40 bits second, 24 btes microseconds */ | 225 | __u64 utime; /* 40 bits second, 24 btes microseconds */ |
@@ -231,5 +238,10 @@ struct mdp_superblock_1 { | |||
231 | __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ | 238 | __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ |
232 | }; | 239 | }; |
233 | 240 | ||
241 | /* feature_map bits */ | ||
242 | #define MD_FEATURE_BITMAP_OFFSET 1 | ||
243 | |||
244 | #define MD_FEATURE_ALL 1 | ||
245 | |||
234 | #endif | 246 | #endif |
235 | 247 | ||
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 9d93cf12e890..60e19b667548 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
@@ -80,6 +80,9 @@ struct r1bio_s { | |||
80 | atomic_t remaining; /* 'have we finished' count, | 80 | atomic_t remaining; /* 'have we finished' count, |
81 | * used from IRQ handlers | 81 | * used from IRQ handlers |
82 | */ | 82 | */ |
83 | atomic_t behind_remaining; /* number of write-behind ios remaining | ||
84 | * in this BehindIO request | ||
85 | */ | ||
83 | sector_t sector; | 86 | sector_t sector; |
84 | int sectors; | 87 | int sectors; |
85 | unsigned long state; | 88 | unsigned long state; |
@@ -107,4 +110,14 @@ struct r1bio_s { | |||
107 | #define R1BIO_Uptodate 0 | 110 | #define R1BIO_Uptodate 0 |
108 | #define R1BIO_IsSync 1 | 111 | #define R1BIO_IsSync 1 |
109 | #define R1BIO_Degraded 2 | 112 | #define R1BIO_Degraded 2 |
113 | #define R1BIO_BehindIO 3 | ||
114 | /* For write-behind requests, we call bi_end_io when | ||
115 | * the last non-write-behind device completes, providing | ||
116 | * any write was successful. Otherwise we call when | ||
117 | * any write-behind write succeeds, otherwise we call | ||
118 | * with failure when last write completes (and all failed). | ||
119 | * Record that bi_end_io was called with this flag... | ||
120 | */ | ||
121 | #define R1BIO_Returned 4 | ||
122 | |||
110 | #endif | 123 | #endif |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index d63ddcb4afad..176fc653c284 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
@@ -134,6 +134,7 @@ struct stripe_head { | |||
134 | unsigned long state; /* state flags */ | 134 | unsigned long state; /* state flags */ |
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 | struct r5dev { | 138 | struct r5dev { |
138 | struct bio req; | 139 | struct bio req; |
139 | struct bio_vec vec; | 140 | struct bio_vec vec; |
@@ -165,12 +166,13 @@ struct stripe_head { | |||
165 | /* | 166 | /* |
166 | * Stripe state | 167 | * Stripe state |
167 | */ | 168 | */ |
168 | #define STRIPE_ERROR 1 | ||
169 | #define STRIPE_HANDLE 2 | 169 | #define STRIPE_HANDLE 2 |
170 | #define STRIPE_SYNCING 3 | 170 | #define STRIPE_SYNCING 3 |
171 | #define STRIPE_INSYNC 4 | 171 | #define STRIPE_INSYNC 4 |
172 | #define STRIPE_PREREAD_ACTIVE 5 | 172 | #define STRIPE_PREREAD_ACTIVE 5 |
173 | #define STRIPE_DELAYED 6 | 173 | #define STRIPE_DELAYED 6 |
174 | #define STRIPE_DEGRADED 7 | ||
175 | #define STRIPE_BIT_DELAY 8 | ||
174 | 176 | ||
175 | /* | 177 | /* |
176 | * Plugging: | 178 | * Plugging: |
@@ -210,10 +212,20 @@ struct raid5_private_data { | |||
210 | 212 | ||
211 | struct list_head handle_list; /* stripes needing handling */ | 213 | struct list_head handle_list; /* stripes needing handling */ |
212 | struct list_head delayed_list; /* stripes that have plugged requests */ | 214 | struct list_head delayed_list; /* stripes that have plugged requests */ |
215 | struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ | ||
213 | atomic_t preread_active_stripes; /* stripes with scheduled io */ | 216 | atomic_t preread_active_stripes; /* stripes with scheduled io */ |
214 | 217 | ||
215 | char cache_name[20]; | 218 | char cache_name[20]; |
216 | kmem_cache_t *slab_cache; /* for allocating stripes */ | 219 | kmem_cache_t *slab_cache; /* for allocating stripes */ |
220 | |||
221 | int seq_flush, seq_write; | ||
222 | int quiesce; | ||
223 | |||
224 | int fullsync; /* set to 1 if a full sync is needed, | ||
225 | * (fresh device added). | ||
226 | * Cleared when a sync completes. | ||
227 | */ | ||
228 | |||
217 | /* | 229 | /* |
218 | * Free stripes pool | 230 | * Free stripes pool |
219 | */ | 231 | */ |