Skip to content

md/raid10: Improve handling raid10 discard request

Xiao Ni linux-raid 3 versions – Applied

Status from this message: I applied the set to md-next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/25 patches 3 repliesApplied
  2. v2 posting 1/25 patches 4 repliesSuperseded
  3. v15 patches 10 repliesSuperseded

Patches in v2 posting 2/2 Applied

#Subject and filesSizeRepliesApplied
1/5md: add md_submit_discard_bio() for submitting discard biodrivers/md/md.c drivers/md/md.h drivers/md/raid0.c+24 -120 replies
2/5md/raid10: extend r10bio devs to raid disksdrivers/md/raid10.c+5 -50 replies
3/5md/raid10: pull the code that wait for blocked dev into one functiondrivers/md/raid10.c+69 -510 replies
4/5md/raid10: improve raid10 discard requestdrivers/md/raid10.c+262 -10 replies
5/5md/raid10: improve discard request for far layoutdrivers/md/raid10.c drivers/md/raid10.h+61 -190 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchColy LiGuoqing Jiang
1/5R-b R-b
2/5R-b
3/5
4/5R-b R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH V2 0/5] md/raid10: Improve handling raid10 discard request

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.

V2: Fix problems pointed by Christoph Hellwig.

Xiao Ni (5):
md: add md_submit_discard_bio() for submitting discard bio md/raid10: extend r10bio devs to raid disks
md/raid10: pull the code 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 | 434 +++++++++++++++++++++++++++++++++++++++++++++-------
 drivers/md/raid10.h |   1 +
 5 files changed, 402 insertions(+), 69 deletions(-)
Signature · 1 line
2.7.5