linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvmtrim
@ 2011-10-19 12:48 Yann Droneaud
  2011-10-19 12:56 ` Alasdair G Kergon
  0 siblings, 1 reply; 6+ messages in thread
From: Yann Droneaud @ 2011-10-19 12:48 UTC (permalink / raw)
  To: linux-lvm

Hi,

Is there any tool for LVM like fstrim(8) (which would likely be called
"lvmtrim") ?

http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/3695

This tool would discard currently unused PE of an active VG like
fstrim(8) is doing on ext4,btrfs,xfs blocks (depending on filesystem
support).

Regards.

-- 
Yann Droneaud

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

* Re: [linux-lvm] lvmtrim
  2011-10-19 12:48 [linux-lvm] lvmtrim Yann Droneaud
@ 2011-10-19 12:56 ` Alasdair G Kergon
  2011-10-19 13:07   ` Alasdair G Kergon
  2011-10-19 13:26   ` Yann Droneaud
  0 siblings, 2 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2011-10-19 12:56 UTC (permalink / raw)
  To: Yann Droneaud; +Cc: linux-lvm

On Wed, Oct 19, 2011 at 02:48:20PM +0200, Yann Droneaud wrote:
> Is there any tool for LVM like fstrim(8) (which would likely be called
> "lvmtrim") ?
 
vgtrim

> This tool would discard currently unused PE of an active VG like
> fstrim(8) is doing on ext4,btrfs,xfs blocks (depending on filesystem
> support).

Sounds a reasonable idea to me, although I question how the PEs that
would benefit from it would have got into that state in the first place,
given that lvreduce already has trim support if you had
devices/issue_discards = 1 in your lvm.conf.
 
Alasdair

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

* Re: [linux-lvm] lvmtrim
  2011-10-19 12:56 ` Alasdair G Kergon
@ 2011-10-19 13:07   ` Alasdair G Kergon
  2011-10-19 13:16     ` Alasdair G Kergon
  2011-10-19 13:26   ` Yann Droneaud
  1 sibling, 1 reply; 6+ messages in thread
From: Alasdair G Kergon @ 2011-10-19 13:07 UTC (permalink / raw)
  To: Yann Droneaud; +Cc: linux-lvm

On Wed, Oct 19, 2011 at 01:56:54PM +0100, Alasdair G Kergon wrote:
> vgtrim
 
Suggested spec if someone wants to implement this:

1) factor out the discard code from release_pv_segment so it can be shared
and used on existing segments too;

2) Add vgtrim (+man page) which takes VG-style arguments, uses
process_each_pv_in_vg which uses process_each_segment_in_pv which checks if
segment is free and if so calls the code from (1) to issue a discard on it.

Alasdair

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

* Re: [linux-lvm] lvmtrim
  2011-10-19 13:07   ` Alasdair G Kergon
@ 2011-10-19 13:16     ` Alasdair G Kergon
  0 siblings, 0 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2011-10-19 13:16 UTC (permalink / raw)
  To: Yann Droneaud; +Cc: linux-lvm

On Wed, Oct 19, 2011 at 02:07:23PM +0100, Alasdair G Kergon wrote:
> 2) Add vgtrim (+man page) which takes VG-style arguments, uses
> process_each_pv_in_vg which uses process_each_segment_in_pv which checks if
> segment is free and if so calls the code from (1) to issue a discard on it.
 
Adding a new cmd involves:
  create tools/vgtrim.c   (e.g. use stripped down vgdisplay.c as template?)
  Add to SOURCES in Makefile
  Add section to commands.h (alphabetically)

Alasdair

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

* Re: [linux-lvm] lvmtrim
  2011-10-19 12:56 ` Alasdair G Kergon
  2011-10-19 13:07   ` Alasdair G Kergon
@ 2011-10-19 13:26   ` Yann Droneaud
  2011-10-19 13:29     ` Alasdair G Kergon
  1 sibling, 1 reply; 6+ messages in thread
From: Yann Droneaud @ 2011-10-19 13:26 UTC (permalink / raw)
  To: LVM general discussion and development

Le mercredi 19 octobre 2011 à 13:56 +0100, Alasdair G Kergon a écrit :
> On Wed, Oct 19, 2011 at 02:48:20PM +0200, Yann Droneaud wrote:
> > Is there any tool for LVM like fstrim(8) (which would likely be called
> > "lvmtrim") ?
>  
> vgtrim
> 
> > This tool would discard currently unused PE of an active VG like
> > fstrim(8) is doing on ext4,btrfs,xfs blocks (depending on filesystem
> > support).
> 
> Sounds a reasonable idea to me, although I question how the PEs that
> would benefit from it would have got into that state in the first place,
> given that lvreduce already has trim support if you had
> devices/issue_discards = 1 in your lvm.conf.
>  

Perhaps when you forgot to discard/TRIM the whole SSD before re-using it
in an active VG.

Perhaps in the case you're migrating from an older version of the LVM2
tools ?

Or issue_discards was set to 0.

Regards.

-- 
Yann Droneaud

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

* Re: [linux-lvm] lvmtrim
  2011-10-19 13:26   ` Yann Droneaud
@ 2011-10-19 13:29     ` Alasdair G Kergon
  0 siblings, 0 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2011-10-19 13:29 UTC (permalink / raw)
  To: Yann Droneaud; +Cc: LVM general discussion and development

On Wed, Oct 19, 2011 at 03:26:15PM +0200, Yann Droneaud wrote:
> Perhaps when you forgot to discard/TRIM the whole SSD before re-using it
> in an active VG.
> Perhaps in the case you're migrating from an older version of the LVM2
> tools ?
> Or issue_discards was set to 0.
 
Indeed.

It's a simple tool to write, so I'm throwing it open to see if anyone wants
to write and contribute it

Alasdair

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

end of thread, other threads:[~2011-10-19 13:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-19 12:48 [linux-lvm] lvmtrim Yann Droneaud
2011-10-19 12:56 ` Alasdair G Kergon
2011-10-19 13:07   ` Alasdair G Kergon
2011-10-19 13:16     ` Alasdair G Kergon
2011-10-19 13:26   ` Yann Droneaud
2011-10-19 13:29     ` Alasdair G Kergon

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