All of lore.kernel.org
 help / color / mirror / Atom feed
* Is trim/discard supported on LVM RAID logical volume?
@ 2016-11-29 12:59 Patrick Dung
  2016-11-29 20:20 ` Chris Murphy
  2016-11-30 16:18 ` Phil Turmel
  0 siblings, 2 replies; 7+ messages in thread
From: Patrick Dung @ 2016-11-29 12:59 UTC (permalink / raw)
  To: linux-raid

Hello,

Sorry if it is a cross posting.
I had post my question in linux-lvm mailing list but did not have reply.

In my old setting, fstrim is supported:
ext4 over LVM over MD software raid 1 (mdadm) > SSD.

After reading the recommendation in RHEL 6
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-ssd.html

I changed to use raid 1 mirror using 'LVM RAID logical volume'. It
make use of MD raid internally.
But I found fstrim does not work anymore. Is the behavior expected?

Thanks and regards,
Patrick

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

* Re: Is trim/discard supported on LVM RAID logical volume?
  2016-11-29 12:59 Is trim/discard supported on LVM RAID logical volume? Patrick Dung
@ 2016-11-29 20:20 ` Chris Murphy
  2016-11-29 22:09   ` Andreas Klauer
  2016-11-30 16:18 ` Phil Turmel
  1 sibling, 1 reply; 7+ messages in thread
From: Chris Murphy @ 2016-11-29 20:20 UTC (permalink / raw)
  To: Patrick Dung; +Cc: Linux-RAID

Seen /etc/lvm/lvm.conf issue_discards is probably set to 0.


Chris Murphy

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

* Re: Is trim/discard supported on LVM RAID logical volume?
  2016-11-29 20:20 ` Chris Murphy
@ 2016-11-29 22:09   ` Andreas Klauer
  2016-11-29 22:21     ` Chris Murphy
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Klauer @ 2016-11-29 22:09 UTC (permalink / raw)
  To: Chris Murphy; +Cc: Patrick Dung, Linux-RAID

On Tue, Nov 29, 2016 at 01:20:16PM -0700, Chris Murphy wrote:
> Seen /etc/lvm/lvm.conf issue_discards is probably set to 0.

It should be 0 unless you understand what it's doing and actually want it...

Don't confuse LVM's issue_discards with cryptsetup's allow_discards.

Regards
Andreas Klauer

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

* Re: Is trim/discard supported on LVM RAID logical volume?
  2016-11-29 22:09   ` Andreas Klauer
@ 2016-11-29 22:21     ` Chris Murphy
  2016-11-29 23:32       ` Andreas Klauer
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Murphy @ 2016-11-29 22:21 UTC (permalink / raw)
  To: Andreas Klauer; +Cc: Chris Murphy, Patrick Dung, Linux-RAID

On Tue, Nov 29, 2016 at 3:09 PM, Andreas Klauer
<Andreas.Klauer@metamorpher.de> wrote:
> On Tue, Nov 29, 2016 at 01:20:16PM -0700, Chris Murphy wrote:
>> Seen /etc/lvm/lvm.conf issue_discards is probably set to 0.
>
> It should be 0 unless you understand what it's doing and actually want it...
>
> Don't confuse LVM's issue_discards with cryptsetup's allow_discards.

Reading the documentation for both, they're functionally the same
thing in that with these options the particular layer will pass on a
trim to the next layer underneath it. So if the idea is to get trim to
to the SSD as the original poster suggests they want, then they'd have
to use the option at every logical device. Of course there are good
reasons to support trim affecting one or more layers, but not pass it
onto the physical block device.


-- 
Chris Murphy

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

* Re: Is trim/discard supported on LVM RAID logical volume?
  2016-11-29 22:21     ` Chris Murphy
@ 2016-11-29 23:32       ` Andreas Klauer
  2016-11-30  8:25         ` Patrick Dung
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Klauer @ 2016-11-29 23:32 UTC (permalink / raw)
  To: Chris Murphy; +Cc: Patrick Dung, Linux-RAID

On Tue, Nov 29, 2016 at 03:21:36PM -0700, Chris Murphy wrote:
> Reading the documentation for both, they're functionally the same
> thing in that with these options the particular layer will pass on a
> trim to the next layer underneath it.

discard/fstrim/blkdiscard works fine with issue_discards=0.

If it doesn't work, setting issue_discards=1 won't do a thing for you. 
That flag only affects the lvm tool itself, discard freed LVM extents 
after lvreduce or pvmove. Can't undo botched resizes anymore, too bad.

Most storage layers simply don't have any setting for this at all.
It just works. Or it does not (in many cases, old/stable kernel/distro).
cryptsetup's allow-discards is the exception, the one layer where you 
have to manually enable something to make it work.

Regards
Andreas Klauer

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

* Re: Is trim/discard supported on LVM RAID logical volume?
  2016-11-29 23:32       ` Andreas Klauer
@ 2016-11-30  8:25         ` Patrick Dung
  0 siblings, 0 replies; 7+ messages in thread
From: Patrick Dung @ 2016-11-30  8:25 UTC (permalink / raw)
  To: Andreas Klauer; +Cc: Chris Murphy, Linux-RAID

Hello,

I got a reply in linux-lvm that there should be problem, and Heinz
from Redhat is looking into it.
related message:
https://www.redhat.com/archives/linux-lvm/2016-November/msg00041.html

For your information, I have issue_discards set to 1.
If I create a non-RAID LVM, the fstrim works.

Thanks and regards,
Patrick

On Wed, Nov 30, 2016 at 7:32 AM, Andreas Klauer
<Andreas.Klauer@metamorpher.de> wrote:
> On Tue, Nov 29, 2016 at 03:21:36PM -0700, Chris Murphy wrote:
>> Reading the documentation for both, they're functionally the same
>> thing in that with these options the particular layer will pass on a
>> trim to the next layer underneath it.
>
> discard/fstrim/blkdiscard works fine with issue_discards=0.
>
> If it doesn't work, setting issue_discards=1 won't do a thing for you.
> That flag only affects the lvm tool itself, discard freed LVM extents
> after lvreduce or pvmove. Can't undo botched resizes anymore, too bad.
>
> Most storage layers simply don't have any setting for this at all.
> It just works. Or it does not (in many cases, old/stable kernel/distro).
> cryptsetup's allow-discards is the exception, the one layer where you
> have to manually enable something to make it work.
>
> Regards
> Andreas Klauer

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

* Re: Is trim/discard supported on LVM RAID logical volume?
  2016-11-29 12:59 Is trim/discard supported on LVM RAID logical volume? Patrick Dung
  2016-11-29 20:20 ` Chris Murphy
@ 2016-11-30 16:18 ` Phil Turmel
  1 sibling, 0 replies; 7+ messages in thread
From: Phil Turmel @ 2016-11-30 16:18 UTC (permalink / raw)
  To: Patrick Dung, linux-raid

On 11/29/2016 07:59 AM, Patrick Dung wrote:
> Hello,
> 
> Sorry if it is a cross posting.
> I had post my question in linux-lvm mailing list but did not have reply.
> 
> In my old setting, fstrim is supported:
> ext4 over LVM over MD software raid 1 (mdadm) > SSD.
> 
> After reading the recommendation in RHEL 6
> https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-ssd.html
> 
> I changed to use raid 1 mirror using 'LVM RAID logical volume'. It
> make use of MD raid internally.
> But I found fstrim does not work anymore. Is the behavior expected?

I can't remember when it was changed, but md raid is only trustworthy
for the mirroring types, and only if the underlying devices return
zeroes when reading trimmed blocks.  Since this isn't guaranteed, and I
recall reading that some devices that claim to return zeroes don't, md
raid cannot determine automatically if it is safe.

Theoretically, raid5 could be compatible if the underlying device
returns zeros, and trims always cover entire stripes.  But that would
require code within mdadm to track stripe-fragment trims that have been
received.  Blegh.

Phil


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

end of thread, other threads:[~2016-11-30 16:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-29 12:59 Is trim/discard supported on LVM RAID logical volume? Patrick Dung
2016-11-29 20:20 ` Chris Murphy
2016-11-29 22:09   ` Andreas Klauer
2016-11-29 22:21     ` Chris Murphy
2016-11-29 23:32       ` Andreas Klauer
2016-11-30  8:25         ` Patrick Dung
2016-11-30 16:18 ` Phil Turmel

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.