linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] md/raid10: Improve handling raid10 discard request
@ 2021-02-03 13:45 Xiao Ni
  2021-02-03 13:45 ` [PATCH 1/5] md: add md_submit_discard_bio() for submitting discard bio Xiao Ni
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Xiao Ni @ 2021-02-03 13:45 UTC (permalink / raw)
  To: songliubraving
  Cc: linux-raid, matthew.ruffell, colyli, guoqing.jiang, ncroxon

Hi all

Now mkfs on raid10 which is combined with ssd/nvme disks takes a long time.
This patch set tries to resolve this problem.

This patch set had been reverted because of a data corruption problem. This
version fix this problem. The root cause which causes the data corruption is
the wrong calculation of start address of near copies disks.

Now we use a similar way with raid0 to handle discard request for raid10.
Because the discard region is very big, we can calculate the start/end
address for each disk. Then we can submit the discard request to each disk.
But for raid10, it has copies. For near layout, if the discard request
doesn't align with chunk size, we calculate a start_disk_offset. Now we only
use start_disk_offset for the first disk, but it should be used for the
near copies disks too.

[  789.709501] discard bio start : 70968, size : 191176
[  789.709507] first stripe index 69, start disk index 0, start disk offset 70968
[  789.709509] last stripe index 256, end disk index 0, end disk offset 262144
[  789.709511] disk 0, dev start : 70968, dev end : 262144
[  789.709515] disk 1, dev start : 70656, dev end : 262144

For example, in this test case, it has 2 near copies. The start_disk_offset
for the first disk is 70968. It should use the same offset address for second disk.
But it uses the start address of this chunk. It discard more region. This version
simply spilt the un-aligned part with strip size.

And it fixes another problem. The calculation of stripe_size is wrong in reverted version.

Xiao Ni (5):
  md: add md_submit_discard_bio() for submitting discard bio
  md/raid10: extend r10bio devs to raid disks
  md/raid10: pull codes that wait for blocked dev into one function
  md/raid10: improve raid10 discard request
  md/raid10: improve discard request for far layout

 drivers/md/md.c     |  20 +++
 drivers/md/md.h     |   2 +
 drivers/md/raid0.c  |  14 +-
 drivers/md/raid10.c | 429 +++++++++++++++++++++++++++++++++++++++++++++-------
 drivers/md/raid10.h |   1 +
 5 files changed, 397 insertions(+), 69 deletions(-)

-- 
2.7.5


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-02-04  7:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 13:45 [PATCH 0/5] md/raid10: Improve handling raid10 discard request Xiao Ni
2021-02-03 13:45 ` [PATCH 1/5] md: add md_submit_discard_bio() for submitting discard bio Xiao Ni
2021-02-03 15:44   ` Christoph Hellwig
2021-02-04  1:51     ` Xiao Ni
2021-02-04  4:07     ` Xiao Ni
2021-02-04  7:19       ` Christoph Hellwig
2021-02-04  7:37         ` Xiao Ni
2021-02-03 13:45 ` [PATCH 2/5] md/raid10: extend r10bio devs to raid disks Xiao Ni
2021-02-03 15:44   ` Christoph Hellwig
2021-02-03 13:45 ` [PATCH 3/5] md/raid10: pull codes that wait for blocked dev into one function Xiao Ni
2021-02-03 15:46   ` Christoph Hellwig
2021-02-04  1:54     ` Xiao Ni
2021-02-03 13:45 ` [PATCH 4/5] md/raid10: improve raid10 discard request Xiao Ni
2021-02-03 15:50   ` Christoph Hellwig
2021-02-04  2:00     ` Xiao Ni
2021-02-03 13:45 ` [PATCH 5/5] md/raid10: improve discard request for far layout Xiao Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).