linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/1] raid0: discard requests do not align to chunk boundary
@ 2014-06-03 21:18 Eivind Sarto
  2014-06-04  2:20 ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: Eivind Sarto @ 2014-06-03 21:18 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-raid

Raid0 only sets max_discard_sectors, but does not force alignment of discard requests.  Discard request
will be broken up into chunk-sized REQ_DISCARD by blkdev_issue_discard(), but if the sector is not 
chunk-aligned, each REQ_DISCARD to raid0 will all remain unaligned and raid0 will ned to split them all.

This patch will prevent splitting of REQ_DISCARD requests.

-eivind

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

* Re: [patch 1/1] raid0: discard requests do not align to chunk boundary
  2014-06-03 21:18 [patch 1/1] raid0: discard requests do not align to chunk boundary Eivind Sarto
@ 2014-06-04  2:20 ` NeilBrown
  2014-06-04  4:51   ` Eivind Sarto
  0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2014-06-04  2:20 UTC (permalink / raw)
  To: Eivind Sarto; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

On Tue, 3 Jun 2014 14:18:53 -0700 Eivind Sarto <eivindsarto@gmail.com> wrote:

> Raid0 only sets max_discard_sectors, but does not force alignment of discard requests.  Discard request
> will be broken up into chunk-sized REQ_DISCARD by blkdev_issue_discard(), but if the sector is not 
> chunk-aligned, each REQ_DISCARD to raid0 will all remain unaligned and raid0 will ned to split them all.
> 
> This patch will prevent splitting of REQ_DISCARD requests.
> 
> -eivind

Which patch would that be, exactly.  :-)

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [patch 1/1] raid0: discard requests do not align to chunk boundary
  2014-06-04  2:20 ` NeilBrown
@ 2014-06-04  4:51   ` Eivind Sarto
  0 siblings, 0 replies; 3+ messages in thread
From: Eivind Sarto @ 2014-06-04  4:51 UTC (permalink / raw)
  To: NeilBrown; +Cc: Eivind Sarto, linux-raid

[-- Attachment #1: Type: text/plain, Size: 25 bytes --]

Oops.  This one.
-eivind

[-- Attachment #2: raid0_discard_requests_do_not_align_to_chunk_boundary.patch --]
[-- Type: application/octet-stream, Size: 1413 bytes --]

Author: Eivind Sarto <esarto@fusionio.com>
Date: Tue Jun  3 14:07:29 2014

raid0: discard requests do not align to chunk boundary

Raid0 sets max_discard_sectors equal to chunk_size.  However, that does
make blkdev_issue_discard() to issue chunk-aligned REQ_DISCARD to raid0.
If blkdev_issue_discard() is called with a non-chunk-aligned sector, it will
break the request into multiple chunk-sized bio requests, but all the bio
requests to raid0 will stay mis-aligned (and raid0 will need to split them all).

This patch sets the device queue discard granularity + alignment.
It will make blkdev_issue_discard() always break REQ_DISCARD requests into
aligned requests to raid0, after the first partial/mis-aligned request has been
issued.

Signed-off-by: Eivind Sarto <esarto@fusionio.com>

--- a/drivers/md/raid0.c	2014-06-02 11:26:29.000000000 -0700
+++ b/drivers/md/raid0.c	2014-06-03 11:56:05.000000000 -0700
@@ -440,6 +440,8 @@ static int raid0_run(struct mddev *mddev
 	blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
 	blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
 	blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
+	mddev->queue->limits.discard_alignment = mddev->chunk_sectors << 9;
+	mddev->queue->limits.discard_granularity = mddev->chunk_sectors << 9;
 
 	/* if private is not null, we are here after takeover */
 	if (mddev->private == NULL) {

[-- Attachment #3: Type: text/plain, Size: 624 bytes --]


On Jun 3, 2014, at 7:20 PM, NeilBrown <neilb@suse.de> wrote:

> On Tue, 3 Jun 2014 14:18:53 -0700 Eivind Sarto <eivindsarto@gmail.com> wrote:
> 
>> Raid0 only sets max_discard_sectors, but does not force alignment of discard requests.  Discard request
>> will be broken up into chunk-sized REQ_DISCARD by blkdev_issue_discard(), but if the sector is not 
>> chunk-aligned, each REQ_DISCARD to raid0 will all remain unaligned and raid0 will ned to split them all.
>> 
>> This patch will prevent splitting of REQ_DISCARD requests.
>> 
>> -eivind
> 
> Which patch would that be, exactly.  :-)
> 
> NeilBrown


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

end of thread, other threads:[~2014-06-04  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 21:18 [patch 1/1] raid0: discard requests do not align to chunk boundary Eivind Sarto
2014-06-04  2:20 ` NeilBrown
2014-06-04  4:51   ` Eivind Sarto

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).