linux-stable/drivers/md
Dan Williams 91c0092484 md: raid5_run_ops - run stripe operations outside sh->lock
When the raid acceleration work was proposed, Neil laid out the following
attack plan:

1/ move the xor and copy operations outside spin_lock(&sh->lock)
2/ find/implement an asynchronous offload api

The raid5_run_ops routine uses the asynchronous offload api (async_tx) and
the stripe_operations member of a stripe_head to carry out xor+copy
operations asynchronously, outside the lock.

To perform operations outside the lock a new set of state flags is needed
to track new requests, in-flight requests, and completed requests.  In this
new model handle_stripe is tasked with scanning the stripe_head for work,
updating the stripe_operations structure, and finally dropping the lock and
calling raid5_run_ops for processing.  The following flags outline the
requests that handle_stripe can make of raid5_run_ops:

STRIPE_OP_BIOFILL
 - copy data into request buffers to satisfy a read request
STRIPE_OP_COMPUTE_BLK
 - generate a missing block in the cache from the other blocks
STRIPE_OP_PREXOR
 - subtract existing data as part of the read-modify-write process
STRIPE_OP_BIODRAIN
 - copy data out of request buffers to satisfy a write request
STRIPE_OP_POSTXOR
 - recalculate parity for new data that has entered the cache
STRIPE_OP_CHECK
 - verify that the parity is correct
STRIPE_OP_IO
 - submit i/o to the member disks (note this was already performed outside
   the stripe lock, but it made sense to add it as an operation type

The flow is:
1/ handle_stripe sets STRIPE_OP_* in sh->ops.pending
2/ raid5_run_ops reads sh->ops.pending, sets sh->ops.ack, and submits the
   operation to the async_tx api
3/ async_tx triggers the completion callback routine to set
   sh->ops.complete and release the stripe
4/ handle_stripe runs again to finish the operation and optionally submit
   new operations that were previously blocked

Note this patch just defines raid5_run_ops, subsequent commits (one per
major operation type) modify handle_stripe to take advantage of this
routine.

Changelog:
* removed ops_complete_biodrain in favor of ops_complete_postxor and
  ops_complete_write.
* removed the raid5_run_ops workqueue
* call bi_end_io for reads in ops_complete_biofill, saves a call to
  handle_stripe
* explicitly handle the 2-disk raid5 case (xor becomes memcpy), Neil Brown
* fix race between async engines and bi_end_io call for reads, Neil Brown
* remove unnecessary spin_lock from ops_complete_biofill
* remove test_and_set/test_and_clear BUG_ONs, Neil Brown
* remove explicit interrupt handling for channel switching, this feature
  was absorbed (i.e. it is now implicit) by the async_tx api
* use return_io in ops_complete_biofill

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Acked-By: NeilBrown <neilb@suse.de>
2007-07-13 08:06:15 -07:00
..
raid6test [PATCH] RAID6 Altivec fix 2005-09-17 11:49:58 -07:00
.gitignore gitignore: misc files 2006-01-01 22:21:50 +01:00
Kconfig async_tx: add the async_tx api 2007-07-13 08:06:14 -07:00
Makefile xor: make 'xor_blocks' a library routine for use with async_tx 2007-07-13 08:06:14 -07:00
bitmap.c md: don't write more than is required of the last page of a bitmap 2007-05-23 20:14:14 -07:00
dm-bio-list.h dm: bio list helpers 2007-05-09 12:30:47 -07:00
dm-bio-record.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dm-crypt.c dm crypt: add null iv 2007-05-09 12:30:46 -07:00
dm-delay.c dm: delay target 2007-05-09 12:30:47 -07:00
dm-emc.c [PATCH] struct path: rename DM's struct path 2006-12-08 08:28:40 -08:00
dm-exception-store.c dm exception store: update dm io interface 2007-05-09 12:30:47 -07:00
dm-hw-handler.c BUG_ON() Conversion in md/dm-hw-handler.c 2006-03-24 18:36:27 +01:00
dm-hw-handler.h dm mpath: log device name 2007-05-09 12:30:46 -07:00
dm-io.c dm io: remove old interface 2007-05-09 12:30:47 -07:00
dm-io.h dm io: remove old interface 2007-05-09 12:30:47 -07:00
dm-ioctl.c [PATCH] mark struct file_operations const 4 2007-02-12 09:48:45 -08:00
dm-linear.c [PATCH] dm: map and endio symbolic return codes 2006-12-08 08:29:09 -08:00
dm-log.c dm log: fix resume failed log device 2007-05-09 12:30:48 -07:00
dm-log.h [PATCH] dm: log: rename complete_resync_work 2006-12-08 08:29:09 -08:00
dm-mpath.c dm mpath: log device name 2007-05-09 12:30:46 -07:00
dm-mpath.h [PATCH] struct path: rename DM's struct path 2006-12-08 08:28:40 -08:00
dm-path-selector.c BUG_ON() Conversion in md/dm-path-selector.c 2006-03-26 18:21:58 +02:00
dm-path-selector.h [PATCH] struct path: rename DM's struct path 2006-12-08 08:28:40 -08:00
dm-raid1.c dm raid1: switch rh_in_sync to blocking in do_reads 2007-05-09 12:30:48 -07:00
dm-round-robin.c [PATCH] struct path: rename DM's struct path 2006-12-08 08:28:40 -08:00
dm-snap.c [PATCH] make drivers/md/dm-snap.c:ksnapd static 2006-12-08 08:29:09 -08:00
dm-snap.h [PATCH] dm snapshot: add workqueue 2006-10-03 08:04:14 -07:00
dm-stripe.c [PATCH] dm: map and endio symbolic return codes 2006-12-08 08:29:09 -08:00
dm-table.c dm: allow offline devices 2007-05-09 12:30:47 -07:00
dm-target.c [PATCH] dm: improve error message consistency 2006-06-26 09:58:36 -07:00
dm-zero.c [PATCH] dm: map and endio symbolic return codes 2006-12-08 08:29:09 -08:00
dm.c dm mpath: log device name 2007-05-09 12:30:46 -07:00
dm.h [PATCH] dm: suspend: add noflush pushback 2006-12-08 08:29:09 -08:00
faulty.c [PATCH] md: Don't assume that READ==0 and WRITE==1 - use the names explicitly 2006-12-13 09:05:48 -08:00
kcopyd.c dm kcopyd: update dm io interface 2007-05-09 12:30:47 -07:00
kcopyd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
linear.c md: fix bug with linear hot-add and elsewhere 2007-05-23 20:14:14 -07:00
md.c xor: make 'xor_blocks' a library routine for use with async_tx 2007-07-13 08:06:14 -07:00
mktables.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
multipath.c [PATCH] md: fix up maintenance of ->degraded in multipath 2006-10-28 11:30:51 -07:00
raid0.c md: avoid overflow in raid0 calculation with large components 2007-05-23 20:14:14 -07:00
raid1.c md: fix bug in error handling during raid1 repair 2007-06-16 13:16:15 -07:00
raid5.c md: raid5_run_ops - run stripe operations outside sh->lock 2007-07-13 08:06:15 -07:00
raid6.h [PATCH] RAID6 Altivec fix 2005-09-17 11:49:58 -07:00
raid6algos.c [PATCH] drivers/md/raid6algos.c: fix a NULL dereference 2006-06-23 07:43:08 -07:00
raid6altivec.uc [PATCH] RAID6 Altivec fix 2005-09-17 11:49:58 -07:00
raid6int.uc Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
raid6mmx.c [PATCH] md: RAID6: clean up CPUID and FPU enter/exit code 2007-03-01 14:53:36 -08:00
raid6recov.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
raid6sse1.c [PATCH] md: RAID6: clean up CPUID and FPU enter/exit code 2007-03-01 14:53:36 -08:00
raid6sse2.c [PATCH] md: RAID6: clean up CPUID and FPU enter/exit code 2007-03-01 14:53:36 -08:00
raid6x86.h [PATCH] md: RAID6: clean up CPUID and FPU enter/exit code 2007-03-01 14:53:36 -08:00
raid10.c md: fix two raid10 bugs 2007-06-16 13:16:15 -07:00
unroll.pl Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00