diff options
author | Artur Paszkiewicz <artur.paszkiewicz@intel.com> | 2017-04-04 13:13:58 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-04-10 12:01:37 -0700 |
commit | ae1713e296449caf820635d384a99936ce281a71 (patch) | |
tree | 24e93bffe6c6cb527f282655ce4a447209629c6d /drivers/md/raid5-ppl.c | |
parent | 845b9e229fe0716ab6b4d94b4364c99069667b59 (diff) |
raid5-ppl: partial parity calculation optimization
In case of read-modify-write, partial partity is the same as the result
of ops_run_prexor5(), so we can just copy sh->dev[pd_idx].page into
sh->ppl_page instead of calculating it again.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid5-ppl.c')
-rw-r--r-- | drivers/md/raid5-ppl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c index 71968cf47d7d..4eb0ebcf9c29 100644 --- a/drivers/md/raid5-ppl.c +++ b/drivers/md/raid5-ppl.c @@ -153,7 +153,7 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, struct dma_async_tx_descriptor *tx) { int disks = sh->disks; - struct page **xor_srcs = flex_array_get(percpu->scribble, 0); + struct page **srcs = flex_array_get(percpu->scribble, 0); int count = 0, pd_idx = sh->pd_idx, i; struct async_submit_ctl submit; @@ -166,18 +166,18 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, * differently. */ if (sh->reconstruct_state == reconstruct_state_prexor_drain_run) { - /* rmw: xor old data and parity from updated disks */ - for (i = disks; i--;) { - struct r5dev *dev = &sh->dev[i]; - if (test_bit(R5_Wantdrain, &dev->flags) || i == pd_idx) - xor_srcs[count++] = dev->page; - } + /* + * rmw: xor old data and parity from updated disks + * This is calculated earlier by ops_run_prexor5() so just copy + * the parity dev page. + */ + srcs[count++] = sh->dev[pd_idx].page; } else if (sh->reconstruct_state == reconstruct_state_drain_run) { /* rcw: xor data from all not updated disks */ for (i = disks; i--;) { struct r5dev *dev = &sh->dev[i]; if (test_bit(R5_UPTODATE, &dev->flags)) - xor_srcs[count++] = dev->page; + srcs[count++] = dev->page; } } else { return tx; @@ -188,10 +188,10 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, + sizeof(struct page *) * (sh->disks + 2)); if (count == 1) - tx = async_memcpy(sh->ppl_page, xor_srcs[0], 0, 0, PAGE_SIZE, + tx = async_memcpy(sh->ppl_page, srcs[0], 0, 0, PAGE_SIZE, &submit); else - tx = async_xor(sh->ppl_page, xor_srcs, 0, count, PAGE_SIZE, + tx = async_xor(sh->ppl_page, srcs, 0, count, PAGE_SIZE, &submit); return tx; |