diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-31 15:12:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-31 15:12:19 -0400 |
| commit | bf699c9bac124f0a095d8ef06f2d6b219300a822 (patch) | |
| tree | de1c4f852b0c68a87eeed25119443eeca8379c66 | |
| parent | aefba418bfecd1985a08f50a95bd854a119f0153 (diff) | |
| parent | da17bf4306fd3a52e938b121df82a7baa10eb282 (diff) | |
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md:
async_tx: fix asynchronous raid6 recovery for ddf layouts
async_pq: rename scribble page
async_pq: kill a stray dma_map() call and other cleanups
md/raid6: kill a gcc-4.0.1 'uninitialized variable' warning
raid6/async_tx: handle holes in block list in async_syndrome_val
md/async: don't pass a memory pointer as a page pointer.
md: Fix handling of raid5 array which is being reshaped to fewer devices.
md: fix problems with RAID6 calculations for DDF.
md/raid456: downlevel multicore operations to raid_run_ops
md: drivers/md/unroll.pl replaced with awk analog
md: remove clumsy usage of do_sync_mapping_range from bitmap code
md: raid1/raid10: handle allocation errors during array setup.
md/raid5: initialize conf->device_lock earlier
md/raid1/raid10: add a cond_resched
Revert "md: do not progress the resync process if the stripe was blocked"
| -rw-r--r-- | crypto/async_tx/async_pq.c | 60 | ||||
| -rw-r--r-- | crypto/async_tx/async_raid6_recov.c | 100 | ||||
| -rw-r--r-- | crypto/async_tx/async_xor.c | 18 | ||||
| -rw-r--r-- | drivers/md/Makefile | 22 | ||||
| -rw-r--r-- | drivers/md/bitmap.c | 9 | ||||
| -rw-r--r-- | drivers/md/md.c | 2 | ||||
| -rw-r--r-- | drivers/md/raid1.c | 6 | ||||
| -rw-r--r-- | drivers/md/raid10.c | 5 | ||||
| -rw-r--r-- | drivers/md/raid5.c | 182 | ||||
| -rw-r--r-- | drivers/md/raid5.h | 14 | ||||
| -rw-r--r-- | drivers/md/raid6altivec.uc | 2 | ||||
| -rw-r--r-- | drivers/md/raid6int.uc | 2 | ||||
| -rw-r--r-- | drivers/md/raid6test/Makefile | 42 | ||||
| -rw-r--r-- | drivers/md/unroll.awk | 20 | ||||
| -rw-r--r-- | drivers/md/unroll.pl | 24 |
15 files changed, 284 insertions, 224 deletions
diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c index b88db6d1dc65..6b5cc4fba59f 100644 --- a/crypto/async_tx/async_pq.c +++ b/crypto/async_tx/async_pq.c | |||
| @@ -26,14 +26,10 @@ | |||
| 26 | #include <linux/async_tx.h> | 26 | #include <linux/async_tx.h> |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * scribble - space to hold throwaway P buffer for synchronous gen_syndrome | 29 | * pq_scribble_page - space to hold throwaway P or Q buffer for |
| 30 | * synchronous gen_syndrome | ||
| 30 | */ | 31 | */ |
| 31 | static struct page *scribble; | 32 | static struct page *pq_scribble_page; |
| 32 | |||
| 33 | static bool is_raid6_zero_block(struct page *p) | ||
| 34 | { | ||
| 35 | return p == (void *) raid6_empty_zero_page; | ||
| 36 | } | ||
| 37 | 33 | ||
| 38 | /* the struct page *blocks[] parameter passed to async_gen_syndrome() | 34 | /* the struct page *blocks[] parameter passed to async_gen_syndrome() |
| 39 | * and async_syndrome_val() contains the 'P' destination address at | 35 | * and async_syndrome_val() contains the 'P' destination address at |
| @@ -83,7 +79,7 @@ do_async_gen_syndrome(struct dma_chan *chan, struct page **blocks, | |||
| 83 | * sources and update the coefficients accordingly | 79 | * sources and update the coefficients accordingly |
| 84 | */ | 80 | */ |
| 85 | for (i = 0, idx = 0; i < src_cnt; i++) { | 81 | for (i = 0, idx = 0; i < src_cnt; i++) { |
| 86 | if (is_raid6_zero_block(blocks[i])) | 82 | if (blocks[i] == NULL) |
| 87 | continue; | 83 | continue; |
| 88 | dma_src[idx] = dma_map_page(dma->dev, blocks[i], offset, len, | 84 | dma_src[idx] = dma_map_page(dma->dev, blocks[i], offset, len, |
| 89 | DMA_TO_DEVICE); | 85 | DMA_TO_DEVICE); |
| @@ -160,9 +156,9 @@ do_sync_gen_syndrome(struct page **blocks, unsigned int offset, int disks, | |||
| 160 | srcs = (void **) blocks; | 156 | srcs = (void **) blocks; |
| 161 | 157 | ||
| 162 | for (i = 0; i < disks; i++) { | 158 | for (i = 0; i < disks; i++) { |
| 163 | if (is_raid6_zero_block(blocks[i])) { | 159 | if (blocks[i] == NULL) { |
| 164 | BUG_ON(i > disks - 3); /* P or Q can't be zero */ | 160 | BUG_ON(i > disks - 3); /* P or Q can't be zero */ |
| 165 | srcs[i] = blocks[i]; | 161 | srcs[i] = (void*)raid6_empty_zero_page; |
| 166 | } else | 162 | } else |
| 167 | srcs[i] = page_address(blocks[i]) + offset; | 163 | srcs[i] = page_address(blocks[i]) + offset; |
| 168 | } | 164 | } |
| @@ -186,10 +182,14 @@ do_sync_gen_syndrome(struct page **blocks, unsigned int offset, int disks, | |||
| 186 | * blocks[disks-1] to NULL. When P or Q is omitted 'len' must be <= | 182 | * blocks[disks-1] to NULL. When P or Q is omitted 'len' must be <= |
| 187 | * PAGE_SIZE as a temporary buffer of this size is used in the | 183 | * PAGE_SIZE as a temporary buffer of this size is used in the |
| 188 | * synchronous path. 'disks' always accounts for both destination | 184 | * synchronous path. 'disks' always accounts for both destination |
| 189 | * buffers. | 185 | * buffers. If any source buffers (blocks[i] where i < disks - 2) are |
| 186 | * set to NULL those buffers will be replaced with the raid6_zero_page | ||
| 187 | * in the synchronous path and omitted in the hardware-asynchronous | ||
| 188 | * path. | ||
| 190 | * | 189 | * |
| 191 | * 'blocks' note: if submit->scribble is NULL then the contents of | 190 | * 'blocks' note: if submit->scribble is NULL then the contents of |
| 192 | * 'blocks' may be overridden | 191 | * 'blocks' may be overwritten to perform address conversions |
| 192 | * (dma_map_page() or page_address()). | ||
| 193 | */ | 193 | */ |
| 194 | struct dma_async_tx_descriptor * | 194 | struct dma_async_tx_descriptor * |
| 195 | async_gen_syndrome(struct page **blocks, unsigned int offset, int disks, | 195 | async_gen_syndrome(struct page **blocks, unsigned int offset, int disks, |
| @@ -227,11 +227,11 @@ async_gen_syndrome(struct page **blocks, unsigned int offset, int disks, | |||
| 227 | async_tx_quiesce(&submit->depend_tx); | 227 | async_tx_quiesce(&submit->depend_tx); |
| 228 | 228 | ||
| 229 | if (!P(blocks, disks)) { | 229 | if (!P(blocks, disks)) { |
| 230 | P(blocks, disks) = scribble; | 230 | P(blocks, disks) = pq_scribble_page; |
| 231 | BUG_ON(len + offset > PAGE_SIZE); | 231 | BUG_ON(len + offset > PAGE_SIZE); |
| 232 | } | 232 | } |
| 233 | if (!Q(blocks, disks)) { | 233 | if (!Q(blocks, disks)) { |
| 234 | Q(blocks, disks) = scribble; | 234 | Q(blocks, disks) = pq_scribble_page; |
| 235 | BUG_ON(len + offset > PAGE_SIZE); | 235 | BUG_ON(len + offset > PAGE_SIZE); |
| 236 | } | 236 | } |
| 237 | do_sync_gen_syndrome(blocks, offset, disks, len, submit); | 237 | do_sync_gen_syndrome(blocks, offset, disks, len, submit); |
| @@ -265,8 +265,10 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks, | |||
| 265 | len); | 265 | len); |
| 266 | struct dma_device *device = chan ? chan->device : NULL; | 266 | struct dma_device *device = chan ? chan->device : NULL; |
| 267 | struct dma_async_tx_descriptor *tx; | 267 | struct dma_async_tx_descriptor *tx; |
| 268 | unsigned char coefs[disks-2]; | ||
| 268 | enum dma_ctrl_flags dma_flags = submit->cb_fn ? DMA_PREP_INTERRUPT : 0; | 269 | enum dma_ctrl_flags dma_flags = submit->cb_fn ? DMA_PREP_INTERRUPT : 0; |
| 269 | dma_addr_t *dma_src = NULL; | 270 | dma_addr_t *dma_src = NULL; |
| 271 | int src_cnt = 0; | ||
| 270 | 272 | ||
| 271 | BUG_ON(disks < 4); | 273 | BUG_ON(disks < 4); |
| 272 | 274 | ||
| @@ -285,22 +287,32 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks, | |||
| 285 | __func__, disks, len); | 287 | __func__, disks, len); |
| 286 | if (!P(blocks, disks)) | 288 | if (!P(blocks, disks)) |
| 287 | dma_flags |= DMA_PREP_PQ_DISABLE_P; | 289 | dma_flags |= DMA_PREP_PQ_DISABLE_P; |
| 290 | else | ||
| 291 | pq[0] = dma_map_page(dev, P(blocks, disks), | ||
| 292 | offset, len, | ||
| 293 | DMA_TO_DEVICE); | ||
| 288 | if (!Q(blocks, disks)) | 294 | if (!Q(blocks, disks)) |
| 289 | dma_flags |= DMA_PREP_PQ_DISABLE_Q; | 295 | dma_flags |= DMA_PREP_PQ_DISABLE_Q; |
| 296 | else | ||
| 297 | pq[1] = dma_map_page(dev, Q(blocks, disks), | ||
| 298 | offset, len, | ||
| 299 | DMA_TO_DEVICE); | ||
| 300 | |||
| 290 | if (submit->flags & ASYNC_TX_FENCE) | 301 | if (submit->flags & ASYNC_TX_FENCE) |
| 291 | dma_flags |= DMA_PREP_FENCE; | 302 | dma_flags |= DMA_PREP_FENCE; |
| 292 | for (i = 0; i < disks; i++) | 303 | for (i = 0; i < disks-2; i++) |
| 293 | if (likely(blocks[i])) { | 304 | if (likely(blocks[i])) { |
| 294 | BUG_ON(is_raid6_zero_block(blocks[i])); | 305 | dma_src[src_cnt] = dma_map_page(dev, blocks[i], |
| 295 | dma_src[i] = dma_map_page(dev, blocks[i], | 306 | offset, len, |
| 296 | offset, len, | 307 | DMA_TO_DEVICE); |
| 297 | DMA_TO_DEVICE); | 308 | coefs[src_cnt] = raid6_gfexp[i]; |
| 309 | src_cnt++; | ||
| 298 | } | 310 | } |
| 299 | 311 | ||
| 300 | for (;;) { | 312 | for (;;) { |
| 301 | tx = device->device_prep_dma_pq_val(chan, pq, dma_src, | 313 | tx = device->device_prep_dma_pq_val(chan, pq, dma_src, |
| 302 | disks - 2, | 314 | src_cnt, |
| 303 | raid6_gfexp, | 315 | coefs, |
| 304 | len, pqres, | 316 | len, pqres, |
| 305 | dma_flags); | 317 | dma_flags); |
| 306 | if (likely(tx)) | 318 | if (likely(tx)) |
| @@ -373,9 +385,9 @@ EXPORT_SYMBOL_GPL(async_syndrome_val); | |||
| 373 | 385 | ||
| 374 | static int __init async_pq_init(void) | 386 | static int __init async_pq_init(void) |
| 375 | { | 387 | { |
| 376 | scribble = alloc_page(GFP_KERNEL); | 388 | pq_scribble_page = alloc_page(GFP_KERNEL); |
| 377 | 389 | ||
| 378 | if (scribble) | 390 | if (pq_scribble_page) |
| 379 | return 0; | 391 | return 0; |
| 380 | 392 | ||
| 381 | pr_err("%s: failed to allocate required spare page\n", __func__); | 393 | pr_err("%s: failed to allocate required spare page\n", __func__); |
| @@ -385,7 +397,7 @@ static int __init async_pq_init(void) | |||
| 385 | 397 | ||
