Re: Reg thin pool and discard handling

Zdenek Kabelac <[email protected]> Fri, 12 Jan 2024 11:45:07 +0100
Newsgroups dev.linux.lists.lvm-devel
Message-ID <[email protected]>
Dne 11. 01. 24 v 4:41 Lakshmi Narasimhan Sundararajan napsal(a):
> Hi Team,
> A very happy new year to you all.
> 
> When a thin pool is created it has option to control discard behavior.
> Typically the useful ones are either discard_passdown vs no_discard_passdown.
> 
> My question is as below:
> If the thin pool is in "no_discard_passdown" and later changes to
> "discard_passdown", would there be a way to reinitiate discard for
> those ranges that was not passed down?
> 
> Typically fs sitting on top of the thin lv controls discard ranges and
> that was already handled as "no_discard_passdown".
> Later if say, the backing storage gets filled up, then how can one
> re-initiate discard again to allow it to reach
> backing storage?
> 

Hi

When you run   'fstrim' operation on freshly mounted fs  it should trim
all the areas that are empty.

There is also an offline tool   'thin_trim'  - see  man thin_trim(8)
maybe that's exactly what you are looking for ?

But in this case it would need some dmsetup manipulation as
lvm2 is not supporting ATM 'component activation' in RW mode
(might be probably worth to add such support for cases like this - but
we would like to track such stuff in metadata so it needs some thinking)

Regards

Zdenek