From: Frank Li <[email protected]>

Remove the async_tx dependency from ops_run_partial_parity() and
ppl_xor().  The function now returns void and operates synchronously:

- count==1: copy_page() replaces async_memcpy
- count>1:  memcpy + xor_blocks() replaces async_xor
- ppl_xor(): xor_blocks() replaces async_xor + async_tx_quiesce

Drop #include <linux/async_tx.h> and add #include <linux/xor.h>.

Signed-off-by: Frank Li <[email protected]>
---
 drivers/md/raid5-ppl.c | 40 ++++++++++++++++------------------------
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
index 7f8a9d3fd578d..bd844b4e8b372 100644
--- a/drivers/md/raid5-ppl.c
+++ b/drivers/md/raid5-ppl.c
@@ -8,7 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/slab.h>
 #include <linux/crc32c.h>
-#include <linux/async_tx.h>
+#include <linux/raid/xor.h>
 #include <linux/raid/md_p.h>
 #include "md.h"
 #include "raid5.h"
@@ -154,14 +154,11 @@ struct ppl_io_unit {
        struct bio_vec biovec[PPL_IO_INLINE_BVECS];
 };
 
-struct dma_async_tx_descriptor *
-ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu,
-                      struct dma_async_tx_descriptor *tx)
+void ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu 
*percpu)
 {
        int disks = sh->disks;
        struct page **srcs = percpu->scribble;
        int count = 0, pd_idx = sh->pd_idx, i;
-       struct async_submit_ctl submit;
 
        pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector);
 
@@ -186,20 +183,20 @@ ops_run_partial_parity(struct stripe_head *sh, struct 
raid5_percpu *percpu,
                                srcs[count++] = dev->page;
                }
        } else {
-               return tx;
+               return;
        }
 
-       init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, tx,
-                         NULL, sh, (void *) (srcs + sh->disks + 2));
-
-       if (count == 1)
-               tx = async_memcpy(sh->ppl_page, srcs[0], 0, 0, PAGE_SIZE,
-                                 &submit);
-       else
-               tx = async_xor(sh->ppl_page, srcs, 0, count, PAGE_SIZE,
-                              &submit);
+       if (count == 1) {
+               copy_page(page_address(sh->ppl_page), page_address(srcs[0]));
+       } else {
+               void *dest = page_address(sh->ppl_page);
+               void **ptrs = (void **)srcs;
+               int j;
 
-       return tx;
+               for (j = 0; j < count; j++)
+                       ptrs[j] = page_address(srcs[j]);
+               xor_gen(dest, ptrs, count, PAGE_SIZE);
+       }
 }
 
 static void *ppl_io_pool_alloc(gfp_t gfp_mask, void *pool_data)
@@ -706,15 +703,10 @@ void ppl_stripe_write_finished(struct stripe_head *sh)
 
 static void ppl_xor(int size, struct page *page1, struct page *page2)
 {
-       struct async_submit_ctl submit;
-       struct dma_async_tx_descriptor *tx;
-       struct page *xor_srcs[] = { page1, page2 };
-
-       init_async_submit(&submit, ASYNC_TX_ACK|ASYNC_TX_XOR_DROP_DST,
-                         NULL, NULL, NULL, NULL);
-       tx = async_xor(page1, xor_srcs, 0, 2, size, &submit);
+       void *dest = page_address(page1);
+       void *ptrs[2] = { dest, page_address(page2) };
 
-       async_tx_quiesce(&tx);
+       xor_gen(dest, ptrs, 2, size);
 }
 
 /*

-- 
2.43.0


Reply via email to