Re: [PATCH 02/19] raid5: move write operations to a workqueue

Jeff Garzik
2006-09-11T23:36:55Z

Dan Williams wrote:
> From: Dan Williams <dan.j.williams@intel.com>
>
> Enable handle_stripe5 to pass off write operations to
> raid5_do_soft_blocks_ops (which can be run as a workqueue). The operations
> moved are reconstruct-writes and read-modify-writes formerly handled by
> compute_parity5.
>
> Changelog:
> * moved raid5_do_soft_block_ops changes into a separate patch
> * changed handle_write_operations5 to only initiate write operations, which
> prevents new writes from being requested while the current one is in flight
> * all blocks undergoing a write are now marked locked and !uptodate at the
> beginning of the write operation
> * blocks undergoing a read-modify-write need a request flag to distinguish
> them from blocks that are locked for reading. Reconstruct-writes still use
> the R5_LOCKED bit to select blocks for the operation
> * integrated the work queue Kconfig option
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>
> drivers/md/Kconfig | 21 +++++
> drivers/md/raid5.c | 192 ++++++++++++++++++++++++++++++++++++++------
> include/linux/raid/raid5.h | 3 +
> 3 files changed, 190 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
> index bf869ed..2a16b3b 100644
> --- a/drivers/md/Kconfig
> +++ b/drivers/md/Kconfig
> @@ -162,6 +162,27 @@ config MD_RAID5_RESHAPE
> There should be enough spares already present to make the new
> array workable.
>
> +config MD_RAID456_WORKQUEUE
> + depends on MD_RAID456
> + bool "Offload raid work to a workqueue from raid5d"
> + ---help---
> + This option enables raid work (block copy and xor operations)
> + to run in a workqueue. If your platform has a high context
> + switch penalty say N. If you are using hardware offload or
> + are running on an SMP platform say Y.
> +
> + If unsure say, Y.
> +
> +config MD_RAID456_WORKQUEUE_MULTITHREAD
> + depends on MD_RAID456_WORKQUEUE && SMP
> + bool "Enable multi-threaded raid processing"
> + default y
> + ---help---
> + This option controls whether the raid workqueue will be multi-
> + threaded or single threaded.
> +
> + If unsure say, Y.

In the final patch that gets merged, these configuration options should
go away. We are very anti-#ifdef in Linux, for a variety of reasons.
In this particular instance, code complexity increases and
maintainability decreases as the #ifdef forest grows.

Jeff