diff options
| author | Dan Williams <dan.j.williams@intel.com> | 2009-08-29 22:09:26 -0400 |
|---|---|---|
| committer | Dan Williams <dan.j.williams@intel.com> | 2009-08-29 22:09:26 -0400 |
| commit | ad283ea4a3ce82cda2efe33163748a397b31b1eb (patch) | |
| tree | 11cd739195f336895abe9e4a62d824e49a41c24f | |
| parent | d6f38f31f3ad4b0dd33fe970988f14e7c65ef702 (diff) | |
async_tx: add sum check flags
Replace the flat zero_sum_result with a collection of flags to contain
the P (xor) zero-sum result, and the soon to be utilized Q (raid6 reed
solomon syndrome) zero-sum result. Use the SUM_CHECK_ namespace instead
of DMA_ since these flags will be used on non-dma-zero-sum enabled
platforms.
Reviewed-by: Andre Noll <maan@systemlinux.org>
Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| -rw-r--r-- | arch/arm/include/asm/hardware/iop3xx-adma.h | 5 | ||||
| -rw-r--r-- | arch/arm/mach-iop13xx/include/mach/adma.h | 12 | ||||
| -rw-r--r-- | crypto/async_tx/async_xor.c | 4 | ||||
| -rw-r--r-- | drivers/md/raid5.c | 2 | ||||
| -rw-r--r-- | drivers/md/raid5.h | 5 | ||||
| -rw-r--r-- | include/linux/async_tx.h | 2 | ||||
| -rw-r--r-- | include/linux/dmaengine.h | 21 |
7 files changed, 37 insertions, 14 deletions
diff --git a/arch/arm/include/asm/hardware/iop3xx-adma.h b/arch/arm/include/asm/hardware/iop3xx-adma.h index 83e6ba338e2c..26eefea02314 100644 --- a/arch/arm/include/asm/hardware/iop3xx-adma.h +++ b/arch/arm/include/asm/hardware/iop3xx-adma.h | |||
| @@ -756,13 +756,14 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc, | |||
| 756 | hw_desc->src[0] = val; | 756 | hw_desc->src[0] = val; |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc) | 759 | static inline enum sum_check_flags |
| 760 | iop_desc_get_zero_result(struct iop_adma_desc_slot *desc) | ||
| 760 | { | 761 | { |
| 761 | struct iop3xx_desc_aau *hw_desc = desc->hw_desc; | 762 | struct iop3xx_desc_aau *hw_desc = desc->hw_desc; |
| 762 | struct iop3xx_aau_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field; | 763 | struct iop3xx_aau_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field; |
| 763 | 764 | ||
| 764 | iop_paranoia(!(desc_ctrl.tx_complete && desc_ctrl.zero_result_en)); | 765 | iop_paranoia(!(desc_ctrl.tx_complete && desc_ctrl.zero_result_en)); |
| 765 | return desc_ctrl.zero_result_err; | 766 | return desc_ctrl.zero_result_err << SUM_CHECK_P; |
| 766 | } | 767 | } |
| 767 | 768 | ||
| 768 | static inline void iop_chan_append(struct iop_adma_chan *chan) | 769 | static inline void iop_chan_append(struct iop_adma_chan *chan) |
diff --git a/arch/arm/mach-iop13xx/include/mach/adma.h b/arch/arm/mach-iop13xx/include/mach/adma.h index 5722e86f2174..1cd31df8924d 100644 --- a/arch/arm/mach-iop13xx/include/mach/adma.h +++ b/arch/arm/mach-iop13xx/include/mach/adma.h | |||
| @@ -428,18 +428,20 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc, | |||
| 428 | hw_desc->block_fill_data = val; | 428 | hw_desc->block_fill_data = val; |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc) | 431 | static inline enum sum_check_flags |
| 432 | iop_desc_get_zero_result(struct iop_adma_desc_slot *desc) | ||
| 432 | { | 433 | { |
| 433 | struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; | 434 | struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; |
| 434 | struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field; | 435 | struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field; |
| 435 | struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field; | 436 | struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field; |
| 437 | enum sum_check_flags flags; | ||
| 436 | 438 | ||
| 437 | BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result)); | 439 | BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result)); |
| 438 | 440 | ||
| 439 | if (desc_ctrl.pq_xfer_en) | 441 | flags = byte_count.zero_result_err_q << SUM_CHECK_Q; |
| 440 | return byte_count.zero_result_err_q; | 442 | flags |= byte_count.zero_result_err << SUM_CHECK_P; |
| 441 | else | 443 | |
| 442 | return byte_count.zero_result_err; | 444 | return flags; |
| 443 | } | 445 | } |
| 444 | 446 | ||
| 445 | static inline void iop_chan_append(struct iop_adma_chan *chan) | 447 | static inline void iop_chan_append(struct iop_adma_chan *chan) |
diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c index 1e96c4df7061..78fb7780272a 100644 --- a/crypto/async_tx/async_xor.c +++ b/crypto/async_tx/async_xor.c | |||
| @@ -246,7 +246,7 @@ static int page_is_zero(struct page *p, unsigned int offset, size_t len) | |||
| 246 | */ | 246 | */ |
| 247 | struct dma_async_tx_descriptor * | 247 | struct dma_async_tx_descriptor * |
| 248 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, | 248 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, |
| 249 | int src_cnt, size_t len, u32 *result, | 249 | int src_cnt, size_t len, enum sum_check_flags *result, |
| 250 | struct async_submit_ctl *submit) | 250 | struct async_submit_ctl *submit) |
| 251 | { | 251 | { |
| 252 | struct dma_chan *chan = async_tx_find_channel(submit, DMA_XOR_VAL, | 252 | struct dma_chan *chan = async_tx_find_channel(submit, DMA_XOR_VAL, |
| @@ -304,7 +304,7 @@ async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, | |||
| 304 | 304 | ||
| 305 | async_tx_quiesce(&tx); | 305 | async_tx_quiesce(&tx); |
| 306 | 306 | ||
| 307 | *result = page_is_zero(dest, offset, len) ? 0 : 1; | 307 | *result = !page_is_zero(dest, offset, len) << SUM_CHECK_P; |
| 308 | 308 | ||
| 309 | async_tx_sync_epilog(submit); | 309 | async_tx_sync_epilog(submit); |
| 310 | submit->flags = flags_orig; | 310 | submit->flags = flags_orig; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7727954cf726..1f2a266f3cf7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -2590,7 +2590,7 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, | |||
| 2590 | * we are done. Otherwise update the mismatch count and repair | 2590 | * we are done. Otherwise update the mismatch count and repair |
| 2591 | * parity if !MD_RECOVERY_CHECK | 2591 | * parity if !MD_RECOVERY_CHECK |
| 2592 | */ | 2592 | */ |
| 2593 | if (sh->ops.zero_sum_result == 0) | 2593 | if ((sh->ops.zero_sum_result & SUM_CHECK_P_RESULT) == 0) |
| 2594 | /* parity is correct (on disc, | 2594 | /* parity is correct (on disc, |
| 2595 | * not in buffer any more) | 2595 | * not in buffer any more) |
| 2596 | */ | 2596 | */ |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index e7baabffee86..75f2c6c4cf90 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _RAID5_H | 2 | #define _RAID5_H |
| 3 | 3 | ||
| 4 | #include <linux/raid/xor.h> | 4 | #include <linux/raid/xor.h> |
| 5 | #include <linux/dmaengine.h> | ||
| 5 | 6 | ||
| 6 | /* | 7 | /* |
| 7 | * | 8 | * |
| @@ -215,8 +216,8 @@ struct stripe_head { | |||
| 215 | * @target - STRIPE_OP_COMPUTE_BLK target | 216 | * @target - STRIPE_OP_COMPUTE_BLK target |
| 216 | */ | 217 | */ |
| 217 | struct stripe_operations { | 218 | struct stripe_operations { |
| 218 | int target; | 219 | int target; |
| 219 | u32 zero_sum_result; | 220 | enum sum_check_flags zero_sum_result; |
| 220 | } ops; | 221 | } ops; |
| 221 | struct r5dev { | 222 | struct r5dev { |
| 222 | struct bio req; | 223 | struct bio req; |
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h index 00cfb637ddf2..3d21a2517518 100644 --- a/include/linux/async_tx.h +++ b/include/linux/async_tx.h | |||
| @@ -148,7 +148,7 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset, | |||
| 148 | 148 | ||
| 149 | struct dma_async_tx_descriptor * | 149 | struct dma_async_tx_descriptor * |
| 150 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, | 150 | async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, |
| 151 | int src_cnt, size_t len, u32 *result, | 151 | int src_cnt, size_t len, enum sum_check_flags *result, |
| 152 | struct async_submit_ctl *submit); | 152 | struct async_submit_ctl *submit); |
| 153 | 153 | ||
| 154 | struct dma_async_tx_descriptor * | 154 | struct dma_async_tx_descriptor * |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 6768727d00d7..02447afcebad 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -87,6 +87,25 @@ enum dma_ctrl_flags { | |||
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | /** | 89 | /** |
| 90 | * enum sum_check_bits - bit position of pq_check_flags | ||
| 91 | */ | ||
| 92 | enum sum_check_bits { | ||
| 93 | SUM_CHECK_P = 0, | ||
| 94 | SUM_CHECK_Q = 1, | ||
| 95 | }; | ||
| 96 | |||
| 97 | /** | ||
| 98 | * enum pq_check_flags - result of async_{xor,pq}_zero_sum operations | ||
| 99 | * @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise | ||
| 100 | * @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise | ||
| 101 | */ | ||
| 102 | enum sum_check_flags { | ||
| 103 | SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P), | ||
| 104 | SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q), | ||
| 105 | }; | ||
| 106 | |||
| 107 | |||
| 108 | /** | ||
| 90 | * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. | 109 | * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. |
| 91 | * See linux/cpumask.h | 110 | * See linux/cpumask.h |
| 92 | */ | 111 | */ |
| @@ -245,7 +264,7 @@ struct dma_device { | |||
| 245 | unsigned int src_cnt, size_t len, unsigned long flags); | 264 | unsigned int src_cnt, size_t len, unsigned long flags); |
| 246 | struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)( | 265 | struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)( |
| 247 | struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, | 266 | struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, |
| 248 | size_t len, u32 *result, unsigned long flags); | 267 | size_t len, enum sum_check_flags *result, unsigned long flags); |
| 249 | struct dma_async_tx_descriptor *(*device_prep_dma_memset)( | 268 | struct dma_async_tx_descriptor *(*device_prep_dma_memset)( |
| 250 | struct dma_chan *chan, dma_addr_t dest, int value, size_t len, | 269 | struct dma_chan *chan, dma_addr_t dest, int value, size_t len, |
| 251 | unsigned long flags); | 270 | unsigned long flags); |
