Bug 2122782

Summary: how to interface with discard options for vdo pool volumes?
Product: Red Hat Enterprise Linux 9 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: VDO QA Contact: cluster-qe <cluster-qe>
Status: NEW --- Docs Contact:
Severity: low    
Priority: unspecified CC: agk, awalsh, heinzm, jbrassow, prajnoha, zkabelac
Version: 9.1   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Marthaler 2022-08-30 19:01:10 UTC
Description of problem:

lvmvdo(7) mentions the usage of discarding with with vdo pool lvs, however it doesn't mention any lvm commands or options to make it happen. I noticed the flag '--discards' doesn't work with lvconvert or lvchange when dealing with VDO volumes. Is the only way to interface with these volumes to mounted an fs on top and using fstrim? 

[root@hayes-01 ~]# lvconvert --yes --type vdo-pool -n vdo_lv -V100G --discards nopassdown vdo_sanity/vdo_pool
  Command does not accept option: --discards nopassdown.

[root@hayes-01 ~]# lvchange --discards nopassdown vdo_sanity/vdo_pool
  Command on LV vdo_sanity/vdo_pool uses options that require LV types thinpool .
  Command not permitted on LV vdo_sanity/vdo_pool.


Version-Release number of selected component (if applicable):
lvm2-2.03.14-6.el8    BUILT: Fri Jul 29 05:40:53 CDT 2022
lvm2-libs-2.03.14-6.el8    BUILT: Fri Jul 29 05:40:53 CDT 2022

Comment 1 Zdenek Kabelac 2023-01-17 22:15:40 UTC
lvmvdo man page refers usage of Discard/TRIM  in chapter '5. Usage of Discard/TRIM with a VDOLV'.

Currently there is no support for similar logic of internal pool discard usage as it is in thin-pool.
So it could be said there is something closely matching 'nopassdown' - we can't pass discard through vdo-pool to vdo pool origin volume - this is currently not handled by kernel target.

I'd likele close this BZ - we may add this --discard option in future to those lvm commands once the vdo kernel target will gain this feature.

But if it would help with clarification, we may put in some explicit paragraph describing this difference - although we do not propagate anywhere usage of this option with vdo-pools ?

Comment 2 Corey Marthaler 2023-02-22 20:42:22 UTC
The section you describe says it can be done, but doesn't say how. If it's supported, then shouldn't an fstrim work on the vdo lv?

[root@virt-008 ~]# lvs -a -o +devices
  LV               VG            Attr       LSize   Pool     Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices          
  root             rhel_virt-008 -wi-ao----  <6.20g                                                         /dev/vda2(205)   
  swap             rhel_virt-008 -wi-ao---- 820.00m                                                         /dev/vda2(0)     
  snap             vdo_sanity    swi-a-s---   6.00g          vdo_lv 0.03                                    /dev/sda(12800)  
  vdo_lv           vdo_sanity    owi-a-s--- 101.95g vdo_pool                                                vdo_pool(0)      
  vdo_pool         vdo_sanity    dwi-------  50.00g                 10.00                                   vdo_pool_vdata(0)
  [vdo_pool_vdata] vdo_sanity    Dwi-ao----  50.00g                                                         /dev/sda(0)
      
[root@virt-008 ~]# mount -o discard /dev/vdo_sanity/vdo_lv /mnt/vdo_lv

[root@virt-008 ~]# fstrim -v /mnt/vdo_lv
fstrim: /mnt/vdo_lv: the discard operation is not supported