All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] md/raid5: Compare apples to apples (or sectors to sectors)
@ 2016-02-16 21:44 Jes.Sorensen
  2016-02-16 22:06 ` Shaohua Li
  0 siblings, 1 reply; 2+ messages in thread
From: Jes.Sorensen @ 2016-02-16 21:44 UTC (permalink / raw)
  To: shli; +Cc: linux-raid

From: Jes Sorensen <Jes.Sorensen@redhat.com>

'max_discard_sectors' is in sectors, while 'stripe' is in bytes.

This fixes the problem where DISCARD would get disabled on some larger
RAID5 configurations (6 or more drives in my testing), while it worked
as expected with smaller configurations.

Fixes: 620125f2bf8 ("MD: raid5 trim support")
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
This bug has been present since RAID5 DISCARD was introduced, so it applies
to stable as well.

 drivers/md/raid5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index b4f02c9..7f770b0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7014,8 +7014,8 @@ static int raid5_run(struct mddev *mddev)
 		}
 
 		if (discard_supported &&
-		   mddev->queue->limits.max_discard_sectors >= stripe &&
-		   mddev->queue->limits.discard_granularity >= stripe)
+		    mddev->queue->limits.max_discard_sectors >= (stripe >> 9) &&
+		    mddev->queue->limits.discard_granularity >= stripe)
 			queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
 						mddev->queue);
 		else
-- 
1.8.3.1


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

* Re: [PATCH] md/raid5: Compare apples to apples (or sectors to sectors)
  2016-02-16 21:44 [PATCH] md/raid5: Compare apples to apples (or sectors to sectors) Jes.Sorensen
@ 2016-02-16 22:06 ` Shaohua Li
  0 siblings, 0 replies; 2+ messages in thread
From: Shaohua Li @ 2016-02-16 22:06 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: linux-raid

On Tue, Feb 16, 2016 at 04:44:24PM -0500, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> 'max_discard_sectors' is in sectors, while 'stripe' is in bytes.
> 
> This fixes the problem where DISCARD would get disabled on some larger
> RAID5 configurations (6 or more drives in my testing), while it worked
> as expected with smaller configurations.
> 
> Fixes: 620125f2bf8 ("MD: raid5 trim support")
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Applied, thanks!

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

end of thread, other threads:[~2016-02-16 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 21:44 [PATCH] md/raid5: Compare apples to apples (or sectors to sectors) Jes.Sorensen
2016-02-16 22:06 ` Shaohua Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.