This is a simple patch that prevents blkdev_issue_discard() from issuing mis-aligned REQ_DISCARD to raid0. Currently, raid0 only sets max_discard_sectors equal to chunk size. But that will only break a larger discard request into multiple chunk sized requests. It will not align those requests. If the original (big) request is not chunk-aligned, blkdev_issue_discard() will issue mis-aligned chunk-sized discards to raid0, and raid0 will have to split them all. The patch comment had example block traces that illustrates the problem.
Attachment:
raid0_prevent_unaligned_discard_requests.patch
Description: Binary data