Closed ephemient closed 6 years ago
Looks very well, thanks! I have only minor remarks about portability (will review closely later).
I'd like to ask you to add TRIM to fsck too (somewhere here), it should be pretty straightforward.
Do you mean mkfs (link) or fsck (text)?
I'm not sure mkfs needs TRIM support when a user can just run blkdiscard
beforehand.
Offline TRIM in fsck seems a little more interesting, but it doesn't look like any other filesystems have this functionality. Maybe something to print out the allocation bitmap? (Like dumpe2fs or xfs_db.) Then a shell script can run blkdiscard
or fallocate
on the free extents.
Do you mean mkfs (link) or fsck (text)?
mkfs, sorry for confusion.
I'm not sure mkfs needs TRIM support when a user can just run blkdiscard beforehand.
Yes, but most users will forget or don't even know about that.
Offline TRIM in fsck seems a little more interesting, but it doesn't look like any other filesystems have this functionality. Maybe something to print out the allocation bitmap?
dumpexfat utility can print used used sectors.
I think fsck does not need to do any TRIM as this is fully covered by fuse-exfat.
I'm not sure mkfs needs TRIM support when a user can just run blkdiscard beforehand.
Yes, but most users will forget or don't even know about that.
IMO it's a bit dangerous to do by default, and periodic fstrim -a
should already be configured on systems where it's desirable. But it's easy enough to add, I suppose.
IMO it's a bit dangerous to do by default
Do you mean that there's a chance to recover data after mkfs if it wasn't trimmed?
Primarily, I'd be concerned that TRIM on an encrypted block device can expose block usage patterns, secondly recovery, and finally, some devices where it might be be slow or buggy.
I'd be concerned that TRIM on an encrypted block device can expose block usage patterns, secondly recovery, and finally, some devices where it might be be slow or buggy.
Makes sense. Let's leave trim on mkfs optional.
I'm planning a big update, your changes will be included into it. Thanks!
Is that supposed to work with current distributions? I compiled the trim branch and trim merged into master, but fstrim still fails saying that the discard operation is not supported. I guess all required headers were found:
checking linux/fs.h usability... yes
checking linux/fs.h presence... yes
checking for linux/fs.h... yes
checking for struct fstrim_range... yes
See #85.
This has been lightly tested with
filefrag
(invokingbmap
) andfstrim
(ioctl(FITRIM)
) on my Linux box sharing an exFAT partition with Windows.