Re: [f2fs-dev] fstrim does not recognize FSVER=1.13 of F2FS partitions
Brought to you by:
kjgkr
|
From: Jaegeuk K. <ja...@ke...> - 2020-03-25 19:59:37
|
On 03/25, John wrote: > On Wed, Mar 25, 2020 at 2:41 PM John wrote: > > I can confirm that it is true with an encrypted ext4 partition. I get > > the same error, "fstrim: /mnt/test: the discard operation is not > > supported" when I try it there on the same device. Unless there is a > > good reason for it, not having discard on LUKS encrypted partitions > > seems like a pretty serious omission. Perhaps it is intentional. > > I see now from searching that this is by design, > https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard/TRIM_support_for_solid_state_drives_(SSD) > > I added the "discard" option to the entry in /etc/crypttab and > rebooted. I am now able to get a successful run of fstrim on this F2FS > partition: > > # fstrim -v /mnt/media > /mnt/media: 0 B (0 bytes) trimmed > > Is it normal to return 0 bytes trimmed for F2FS partitions? By It's normal, and that's why I asked -o nodiscard. The reason is F2FS creates asynchronous discard thread to alleviate long discarding latency among RW IOs. It keeps candidates in memory, and the thread issues them in idle time. In that mode, when you do fstrim, F2FS collects all the discard candidates given address space, and returns zero, since it didn't issue any discard command at the moment. But, if you set -o nodiscard, you can see the actual trimmed size, since F2FS disabled the async discard thread and issue discard rightaway if device supports it. > contrast, if I go to my test SSD, create a LUKS partition, open it > with the --allow-discards option to cryptsetup, format it to ext4, > mount that and then run fstrim on it, I am getting non-0 values for > fstrim when I run it: > > # fstrim -v /mnt/test_crypt_ext4 > /mnt/test_crypt_ext4: 3.9 GiB (4123463680 bytes) trimmed > > So I think something still isn't quite right with F2FS over crypto_LUKS. > > Thanks for the help! |