提交 ad283ea4 编写于 作者: D Dan Williams

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: NAndre Noll <maan@systemlinux.org>
Acked-by: NMaciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 d6f38f31
...@@ -756,13 +756,14 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc, ...@@ -756,13 +756,14 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
hw_desc->src[0] = val; hw_desc->src[0] = val;
} }
static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc) static inline enum sum_check_flags
iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
{ {
struct iop3xx_desc_aau *hw_desc = desc->hw_desc; struct iop3xx_desc_aau *hw_desc = desc->hw_desc;
struct iop3xx_aau_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field; struct iop3xx_aau_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
iop_paranoia(!(desc_ctrl.tx_complete && desc_ctrl.zero_result_en)); iop_paranoia(!(desc_ctrl.tx_complete && desc_ctrl.zero_result_en));
return desc_ctrl.zero_result_err; return desc_ctrl.zero_result_err << SUM_CHECK_P;
} }
static inline void iop_chan_append(struct iop_adma_chan *chan) static inline void iop_chan_append(struct iop_adma_chan *chan)
......
...@@ -428,18 +428,20 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc, ...@@ -428,18 +428,20 @@ static inline void iop_desc_set_block_fill_val(struct iop_adma_desc_slot *desc,
hw_desc->block_fill_data = val; hw_desc->block_fill_data = val;
} }
static inline int iop_desc_get_zero_result(struct iop_adma_desc_slot *desc) static inline enum sum_check_flags
iop_desc_get_zero_result(struct iop_adma_desc_slot *desc)
{ {
struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc; struct iop13xx_adma_desc_hw *hw_desc = desc->hw_desc;
struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field; struct iop13xx_adma_desc_ctrl desc_ctrl = hw_desc->desc_ctrl_field;
struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field; struct iop13xx_adma_byte_count byte_count = hw_desc->byte_count_field;
enum sum_check_flags flags;
BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result)); BUG_ON(!(byte_count.tx_complete && desc_ctrl.zero_result));
if (desc_ctrl.pq_xfer_en) flags = byte_count.zero_result_err_q << SUM_CHECK_Q;
return byte_count.zero_result_err_q; flags |= byte_count.zero_result_err << SUM_CHECK_P;
else
return byte_count.zero_result_err; return flags;
} }
static inline void iop_chan_append(struct iop_adma_chan *chan) static inline void iop_chan_append(struct iop_adma_chan *chan)
......
...@@ -246,7 +246,7 @@ static int page_is_zero(struct page *p, unsigned int offset, size_t len) ...@@ -246,7 +246,7 @@ static int page_is_zero(struct page *p, unsigned int offset, size_t len)
*/ */
struct dma_async_tx_descriptor * struct dma_async_tx_descriptor *
async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
int src_cnt, size_t len, u32 *result, int src_cnt, size_t len, enum sum_check_flags *result,
struct async_submit_ctl *submit) struct async_submit_ctl *submit)
{ {
struct dma_chan *chan = async_tx_find_channel(submit, DMA_XOR_VAL, 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,7 +304,7 @@ async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
async_tx_quiesce(&tx); async_tx_quiesce(&tx);
*result = page_is_zero(dest, offset, len) ? 0 : 1; *result = !page_is_zero(dest, offset, len) << SUM_CHECK_P;
async_tx_sync_epilog(submit); async_tx_sync_epilog(submit);
submit->flags = flags_orig; submit->flags = flags_orig;
......
...@@ -2590,7 +2590,7 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, ...@@ -2590,7 +2590,7 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
* we are done. Otherwise update the mismatch count and repair * we are done. Otherwise update the mismatch count and repair
* parity if !MD_RECOVERY_CHECK * parity if !MD_RECOVERY_CHECK
*/ */
if (sh->ops.zero_sum_result == 0) if ((sh->ops.zero_sum_result & SUM_CHECK_P_RESULT) == 0)
/* parity is correct (on disc, /* parity is correct (on disc,
* not in buffer any more) * not in buffer any more)
*/ */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define _RAID5_H #define _RAID5_H
#include <linux/raid/xor.h> #include <linux/raid/xor.h>
#include <linux/dmaengine.h>
/* /*
* *
...@@ -215,8 +216,8 @@ struct stripe_head { ...@@ -215,8 +216,8 @@ struct stripe_head {
* @target - STRIPE_OP_COMPUTE_BLK target * @target - STRIPE_OP_COMPUTE_BLK target
*/ */
struct stripe_operations { struct stripe_operations {
int target; int target;
u32 zero_sum_result; enum sum_check_flags zero_sum_result;
} ops; } ops;
struct r5dev { struct r5dev {
struct bio req; struct bio req;
......
...@@ -148,7 +148,7 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset, ...@@ -148,7 +148,7 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset,
struct dma_async_tx_descriptor * struct dma_async_tx_descriptor *
async_xor_val(struct page *dest, struct page **src_list, unsigned int offset, async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
int src_cnt, size_t len, u32 *result, int src_cnt, size_t len, enum sum_check_flags *result,
struct async_submit_ctl *submit); struct async_submit_ctl *submit);
struct dma_async_tx_descriptor * struct dma_async_tx_descriptor *
......
...@@ -86,6 +86,25 @@ enum dma_ctrl_flags { ...@@ -86,6 +86,25 @@ enum dma_ctrl_flags {
DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
}; };
/**
* enum sum_check_bits - bit position of pq_check_flags
*/
enum sum_check_bits {
SUM_CHECK_P = 0,
SUM_CHECK_Q = 1,
};
/**
* enum pq_check_flags - result of async_{xor,pq}_zero_sum operations
* @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise
* @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise
*/
enum sum_check_flags {
SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P),
SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q),
};
/** /**
* dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t.
* See linux/cpumask.h * See linux/cpumask.h
...@@ -245,7 +264,7 @@ struct dma_device { ...@@ -245,7 +264,7 @@ struct dma_device {
unsigned int src_cnt, size_t len, unsigned long flags); unsigned int src_cnt, size_t len, unsigned long flags);
struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)( struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)(
struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt,
size_t len, u32 *result, unsigned long flags); size_t len, enum sum_check_flags *result, unsigned long flags);
struct dma_async_tx_descriptor *(*device_prep_dma_memset)( struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
struct dma_chan *chan, dma_addr_t dest, int value, size_t len, struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
unsigned long flags); unsigned long flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册